2026-08-09 00:41:30,901 INFO core: Event loop thread started, running loop forever
2026-08-09 00:41:31,202 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 00:41:31,206 INFO core: _init_accounts coroutine started
2026-08-09 00:41:31,206 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 00:41:31,215 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 00:42:03,933 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:03,950 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 00:42:03,951 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 00:42:03,953 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 00:42:31,207 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 00:42:33,063 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 00:42:33,064 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 00:42:33,067 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 00:42:33,067 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 00:42:33,080 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:35,394 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-09 00:42:35,406 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:37,782 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:40,179 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:42,619 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:44,888 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:47,235 INFO core: Account 1 connected and authorized via 91.108.56.178
2026-08-09 00:42:47,244 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 00:42:47,245 INFO core: Handlers installed for account 1
2026-08-09 00:42:47,246 INFO core: Initialized 1 account(s), 1 pair(s)
2026-08-09 00:42:47,247 INFO core: Memory RSS: 91.06 MB
2026-08-09 00:42:47,250 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:42:49,661 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:43:11,343 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:43:13,109 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:43:14,946 INFO core: Saved 344 dialog(s) to cache (account 1)
2026-08-09 00:43:14,948 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:43:16,532 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-09 00:45:26,539 INFO core: Event loop thread started, running loop forever
2026-08-09 00:45:26,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 00:45:26,845 INFO core: _init_accounts coroutine started
2026-08-09 00:45:26,846 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 00:45:26,855 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 00:48:23,742 ERROR core: pairs sync error: cannot schedule new futures after interpreter shutdown
2026-08-09 00:48:23,743 ERROR core: Watchdog error: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 611, in _watchdog_loop
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 00:50:22,618 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 00:50:22,634 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 00:55:42,675 INFO core: Event loop thread started, running loop forever
2026-08-09 00:55:42,976 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 00:55:42,980 INFO core: _init_accounts coroutine started
2026-08-09 00:55:42,981 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 00:55:42,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:00:17,012 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 01:00:17,035 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:05:36,953 INFO core: Event loop thread started, running loop forever
2026-08-09 01:05:37,255 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 01:05:37,260 INFO core: _init_accounts coroutine started
2026-08-09 01:05:37,260 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 01:05:37,279 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:10:42,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:15:10,281 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 01:15:10,281 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 01:15:10,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 01:15:10,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:20:27,536 INFO core: Event loop thread started, running loop forever
2026-08-09 01:20:27,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 01:20:27,844 INFO core: _init_accounts coroutine started
2026-08-09 01:20:27,844 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 01:20:27,852 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:25:31,846 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 01:25:31,846 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:25:31,848 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 01:30:51,973 INFO core: Event loop thread started, running loop forever
2026-08-09 01:30:52,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 01:30:52,279 INFO core: _init_accounts coroutine started
2026-08-09 01:30:52,280 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 01:30:52,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:35:11,863 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 01:35:11,863 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 01:35:11,865 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 01:35:11,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:40:04,799 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 01:40:04,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:45:26,240 INFO core: Event loop thread started, running loop forever
2026-08-09 01:45:26,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 01:45:26,546 INFO core: _init_accounts coroutine started
2026-08-09 01:45:26,546 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 01:45:26,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:50:06,829 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 01:55:11,259 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 01:55:11,260 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 01:55:11,264 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:00:16,994 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 02:00:16,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:00:28,343 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 02:00:28,350 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:05:32,644 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 02:05:32,644 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 02:05:32,655 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 02:05:32,656 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 02:05:32,660 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:10:12,761 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 02:10:12,762 WARNING core: Account 1: connect timed out after 35s
2026-08-09 02:10:12,763 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 02:10:12,763 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 02:10:12,765 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 02:10:12,766 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 02:10:12,767 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 02:10:12,770 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:15:18,368 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 02:15:18,369 WARNING core: Account 1: connect timed out after 35s
2026-08-09 02:15:18,369 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 02:15:18,370 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 02:15:18,370 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 02:15:18,371 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 02:15:18,371 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 02:15:24,991 INFO core: Event loop thread started, running loop forever
2026-08-09 02:15:25,292 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 02:15:25,297 INFO core: _init_accounts coroutine started
2026-08-09 02:15:25,298 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 02:15:25,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:20:24,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:25:43,407 INFO core: Event loop thread started, running loop forever
2026-08-09 02:25:43,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 02:25:43,717 INFO core: _init_accounts coroutine started
2026-08-09 02:25:43,717 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 02:25:43,728 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:30:28,949 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 02:30:28,949 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 02:30:28,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:35:30,857 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 02:35:30,863 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 02:35:30,863 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:40:36,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 02:40:43,825 INFO core: Event loop thread started, running loop forever
2026-08-09 02:40:44,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 02:40:44,129 INFO core: _init_accounts coroutine started
2026-08-09 02:40:44,131 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 02:40:44,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:45:39,007 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:50:06,088 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 02:50:06,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:55:19,035 INFO core: Event loop thread started, running loop forever
2026-08-09 02:55:19,337 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 02:55:19,341 INFO core: _init_accounts coroutine started
2026-08-09 02:55:19,342 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 02:55:19,350 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 02:55:19,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 02:55:19,364 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 03:00:26,543 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-09 03:00:26,545 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 03:00:26,545 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 03:00:26,546 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 03:00:26,546 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-09 03:00:36,405 INFO core: Event loop thread started, running loop forever
2026-08-09 03:00:36,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 03:00:36,712 INFO core: _init_accounts coroutine started
2026-08-09 03:00:36,714 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 03:00:36,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:00:36,727 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 03:00:36,741 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 03:00:36,742 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 03:00:36,747 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 03:05:06,316 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:10:48,393 INFO core: Event loop thread started, running loop forever
2026-08-09 03:10:48,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 03:10:48,698 INFO core: _init_accounts coroutine started
2026-08-09 03:10:48,699 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 03:10:48,706 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:15:35,354 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 03:15:35,355 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 03:15:35,357 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 03:15:35,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:20:26,995 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 03:20:26,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:25:10,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:30:39,141 INFO core: Event loop thread started, running loop forever
2026-08-09 03:30:39,442 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 03:30:39,446 INFO core: _init_accounts coroutine started
2026-08-09 03:30:39,447 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 03:30:39,454 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:35:39,025 INFO core: Event loop thread started, running loop forever
2026-08-09 03:35:39,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 03:35:39,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:40:26,096 INFO core: Event loop thread started, running loop forever
2026-08-09 03:40:26,397 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 03:40:26,401 INFO core: _init_accounts coroutine started
2026-08-09 03:40:26,402 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 03:40:26,407 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:45:08,221 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 03:45:08,222 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 03:45:08,231 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 03:45:08,233 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 03:45:08,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:50:18,113 INFO core: Event loop thread started, running loop forever
2026-08-09 03:50:18,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 03:50:18,419 INFO core: _init_accounts coroutine started
2026-08-09 03:50:18,419 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 03:50:18,431 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 03:50:18,431 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 03:50:18,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 03:50:18,435 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 03:50:18,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 03:50:18,450 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 03:50:18,451 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 03:55:25,338 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 03:55:25,339 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 03:55:27,277 INFO core: Event loop thread started, running loop forever
2026-08-09 03:55:27,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 03:55:27,586 INFO core: _init_accounts coroutine started
2026-08-09 03:55:27,587 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 03:55:27,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:00:34,363 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 04:00:47,145 INFO core: Event loop thread started, running loop forever
2026-08-09 04:00:47,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 04:00:47,451 INFO core: _init_accounts coroutine started
2026-08-09 04:00:47,452 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 04:00:47,468 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:05:43,538 INFO core: Event loop thread started, running loop forever
2026-08-09 04:05:43,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 04:05:43,844 INFO core: _init_accounts coroutine started
2026-08-09 04:05:43,845 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 04:05:43,853 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:10:13,640 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:15:41,620 INFO core: Event loop thread started, running loop forever
2026-08-09 04:15:41,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 04:15:41,925 INFO core: _init_accounts coroutine started
2026-08-09 04:15:41,926 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 04:15:41,937 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:20:46,069 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:25:31,304 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 04:25:31,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:30:48,555 INFO core: Event loop thread started, running loop forever
2026-08-09 04:30:48,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 04:30:48,860 INFO core: _init_accounts coroutine started
2026-08-09 04:30:48,860 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 04:30:48,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:35:16,765 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:40:17,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:45:23,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 04:45:23,460 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 04:45:23,460 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-09 04:45:23,461 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 04:45:23,461 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 04:45:23,462 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 04:45:23,462 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-09 04:45:23,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 04:45:23,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 04:45:37,400 INFO core: Event loop thread started, running loop forever
2026-08-09 04:45:37,701 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 04:45:37,705 INFO core: _init_accounts coroutine started
2026-08-09 04:45:37,706 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 04:45:37,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:50:09,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 04:55:11,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 04:55:11,430 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 04:55:11,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 04:55:11,434 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 04:55:11,439 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:00:17,313 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 05:00:17,315 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 05:00:17,315 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 05:00:20,891 INFO core: Event loop thread started, running loop forever
2026-08-09 05:00:21,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 05:00:21,197 INFO core: _init_accounts coroutine started
2026-08-09 05:00:21,198 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 05:00:21,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:05:09,370 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 05:05:09,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:10:09,836 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:15:51,844 INFO core: Event loop thread started, running loop forever
2026-08-09 05:15:52,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 05:15:52,150 INFO core: _init_accounts coroutine started
2026-08-09 05:15:52,151 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 05:15:52,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:20:43,907 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 05:20:43,908 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 05:20:43,910 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 05:20:43,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:20:43,914 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 05:25:49,303 INFO core: Event loop thread started, running loop forever
2026-08-09 05:25:49,604 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 05:25:49,609 INFO core: _init_accounts coroutine started
2026-08-09 05:25:49,610 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 05:25:49,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:25:49,628 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-09 05:25:50,319 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 05:25:50,320 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 05:25:50,321 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 05:30:34,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:35:08,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:40:23,549 INFO core: Event loop thread started, running loop forever
2026-08-09 05:40:23,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 05:40:23,858 INFO core: _init_accounts coroutine started
2026-08-09 05:40:23,859 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 05:40:23,865 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:45:30,368 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 05:45:33,429 INFO core: Event loop thread started, running loop forever
2026-08-09 05:45:33,730 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 05:45:33,734 INFO core: _init_accounts coroutine started
2026-08-09 05:45:33,735 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 05:45:33,748 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 05:45:33,749 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 05:45:33,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:45:33,753 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 05:50:47,444 INFO core: Event loop thread started, running loop forever
2026-08-09 05:50:47,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 05:50:47,750 INFO core: _init_accounts coroutine started
2026-08-09 05:50:47,751 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 05:50:47,760 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:55:29,611 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 05:55:29,613 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 05:55:29,623 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 06:00:07,909 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 06:00:07,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:05:09,563 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 06:05:09,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:10:39,524 INFO core: Event loop thread started, running loop forever
2026-08-09 06:10:39,825 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 06:10:39,829 INFO core: _init_accounts coroutine started
2026-08-09 06:10:39,830 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 06:10:39,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:10:39,850 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 06:10:39,850 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 06:10:39,852 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 06:10:39,853 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 06:10:39,861 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 06:10:39,862 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 06:10:39,867 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 06:10:39,867 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 06:15:09,360 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 06:15:09,362 WARNING core: Account 1: connect timed out after 35s
2026-08-09 06:15:21,635 INFO core: Event loop thread started, running loop forever
2026-08-09 06:15:21,936 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 06:15:21,940 INFO core: _init_accounts coroutine started
2026-08-09 06:15:21,941 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 06:15:21,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:20:16,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:25:04,034 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 06:25:04,048 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:30:14,018 INFO core: Event loop thread started, running loop forever
2026-08-09 06:30:14,319 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 06:30:14,324 INFO core: _init_accounts coroutine started
2026-08-09 06:30:14,326 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 06:30:14,337 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:35:04,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 06:35:04,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 06:35:04,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 06:35:04,114 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 06:35:04,117 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:40:21,674 INFO core: Event loop thread started, running loop forever
2026-08-09 06:40:21,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 06:40:21,979 INFO core: _init_accounts coroutine started
2026-08-09 06:40:21,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 06:40:21,986 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:45:06,369 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 06:45:06,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:50:42,344 INFO core: Event loop thread started, running loop forever
2026-08-09 06:50:42,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 06:50:42,664 INFO core: _init_accounts coroutine started
2026-08-09 06:50:42,665 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 06:50:42,731 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 06:55:39,412 INFO core: Event loop thread started, running loop forever
2026-08-09 06:55:39,713 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 06:55:39,718 INFO core: _init_accounts coroutine started
2026-08-09 06:55:39,719 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 06:55:39,728 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:00:37,837 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 07:00:37,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:05:08,718 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:10:48,541 INFO core: Event loop thread started, running loop forever
2026-08-09 07:10:48,842 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 07:10:48,847 INFO core: _init_accounts coroutine started
2026-08-09 07:10:48,848 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 07:10:48,855 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 07:10:48,855 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 07:10:48,857 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 07:10:48,858 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 07:10:48,866 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 07:10:48,866 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 07:10:48,871 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 07:10:48,872 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 07:10:48,874 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:15:37,483 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 07:15:37,486 WARNING core: Account 1: connect timed out after 35s
2026-08-09 07:15:37,488 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 07:15:37,488 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 07:15:37,489 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 07:15:37,491 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 07:15:37,492 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 07:15:37,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:20:44,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 07:20:44,419 WARNING core: Account 1: connect timed out after 35s
2026-08-09 07:20:44,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 07:20:44,419 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 07:20:44,420 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 07:20:44,421 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 07:20:44,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 07:20:44,510 INFO core: Event loop thread started, running loop forever
2026-08-09 07:20:44,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 07:20:44,814 INFO core: _init_accounts coroutine started
2026-08-09 07:20:44,815 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 07:20:44,830 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-09 07:20:44,838 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 07:25:21,918 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:30:07,472 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 07:30:07,475 INFO core: _init_accounts coroutine started
2026-08-09 07:30:07,475 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 07:30:07,484 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:35:13,360 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 07:35:43,854 INFO core: Event loop thread started, running loop forever
2026-08-09 07:35:44,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 07:35:44,160 INFO core: _init_accounts coroutine started
2026-08-09 07:35:44,160 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 07:35:44,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:40:05,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:45:05,496 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 07:45:05,497 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 07:45:05,504 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:50:11,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 07:50:30,853 INFO core: Event loop thread started, running loop forever
2026-08-09 07:50:31,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 07:50:31,163 INFO core: _init_accounts coroutine started
2026-08-09 07:50:31,164 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 07:50:31,173 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 07:50:31,174 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 07:50:31,175 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 07:50:31,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 07:50:31,179 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 07:55:20,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:00:09,778 INFO core: Event loop thread started, running loop forever
2026-08-09 08:00:10,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 08:00:10,086 INFO core: _init_accounts coroutine started
2026-08-09 08:00:10,087 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 08:00:10,101 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:05:38,836 INFO core: Event loop thread started, running loop forever
2026-08-09 08:05:39,137 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 08:05:39,141 INFO core: _init_accounts coroutine started
2026-08-09 08:05:39,142 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 08:05:39,149 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:10:10,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:15:14,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 08:15:14,879 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 08:15:14,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 08:15:14,883 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 08:15:14,886 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:15:14,895 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 08:15:14,895 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 08:20:39,375 INFO core: Event loop thread started, running loop forever
2026-08-09 08:20:39,677 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 08:20:39,682 INFO core: _init_accounts coroutine started
2026-08-09 08:20:39,682 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 08:20:39,701 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:25:36,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:30:31,506 INFO core: Event loop thread started, running loop forever
2026-08-09 08:30:31,808 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 08:30:31,813 INFO core: _init_accounts coroutine started
2026-08-09 08:30:31,814 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 08:30:31,820 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:35:52,091 INFO core: Event loop thread started, running loop forever
2026-08-09 08:35:52,392 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 08:35:52,396 INFO core: _init_accounts coroutine started
2026-08-09 08:35:52,396 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 08:35:52,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:40:11,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:45:34,907 INFO core: Event loop thread started, running loop forever
2026-08-09 08:45:35,208 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 08:45:35,214 INFO core: _init_accounts coroutine started
2026-08-09 08:45:35,214 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 08:45:35,231 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:50:41,377 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 08:50:48,332 INFO core: Event loop thread started, running loop forever
2026-08-09 08:50:48,634 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 08:50:48,640 INFO core: _init_accounts coroutine started
2026-08-09 08:50:48,640 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 08:50:48,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 08:55:19,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:00:26,368 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 09:00:26,369 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 09:00:26,379 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 09:00:26,379 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 09:00:26,380 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 09:00:26,380 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-09 09:00:26,380 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 09:00:26,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 09:00:31,976 INFO core: Event loop thread started, running loop forever
2026-08-09 09:00:32,280 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 09:00:32,287 INFO core: _init_accounts coroutine started
2026-08-09 09:00:32,287 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:00:32,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:05:31,484 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 09:05:31,497 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:10:47,614 INFO core: Event loop thread started, running loop forever
2026-08-09 09:10:47,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 09:10:47,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:15:19,861 INFO core: _init_accounts coroutine started
2026-08-09 09:15:19,863 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:15:19,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:20:50,805 INFO core: Event loop thread started, running loop forever
2026-08-09 09:20:51,107 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 09:20:51,111 INFO core: _init_accounts coroutine started
2026-08-09 09:20:51,112 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:20:51,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:22:08,662 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 09:22:08,662 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 09:22:08,663 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 09:22:08,664 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 09:22:08,673 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 09:22:08,674 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 09:22:08,679 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:22:08,679 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:22:08,680 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:22:40,926 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:22:40,927 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:22:40,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:22:40,938 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:22:40,939 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:22:40,940 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:23:12,873 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:23:12,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:23:44,964 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:23:44,965 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:23:44,966 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:23:44,966 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:23:44,967 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:23:44,968 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:23:44,968 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:23:44,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:24:17,949 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:24:17,950 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:24:17,952 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:24:17,952 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:24:17,953 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:24:17,954 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:24:17,959 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:24:50,967 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:24:50,968 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:24:50,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:24:50,975 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:24:50,977 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:25:14,183 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:25:14,184 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:25:14,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:25:23,335 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:25:23,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:25:55,540 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:25:55,543 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:26:27,918 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 09:26:27,919 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:26:27,922 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:26:27,923 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:26:27,924 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:26:27,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:27:00,518 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:27:00,518 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 09:27:00,520 INFO core: Memory RSS: 89.16 MB
2026-08-09 09:27:00,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:27:33,373 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:27:33,380 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:27:33,381 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:27:33,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:27:33,382 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:28:06,382 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 09:28:06,384 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:28:06,385 INFO core: Memory RSS: 89.18 MB
2026-08-09 09:28:06,386 INFO core: _init_accounts coroutine started
2026-08-09 09:28:06,386 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:28:06,387 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:28:06,391 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:28:06,391 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:28:06,393 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:28:06,394 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:28:06,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:28:38,499 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:28:38,500 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:28:38,501 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:28:38,503 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:28:38,503 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:28:38,503 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 09:28:38,503 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 09:28:38,504 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:28:38,505 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:28:38,506 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 09:28:38,508 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 09:28:38,516 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 09:28:38,516 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 09:28:38,518 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:28:38,518 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:28:38,525 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:29:11,022 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:29:11,023 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:29:11,023 INFO core: Memory RSS: 89.18 MB
2026-08-09 09:29:11,023 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:29:11,025 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:29:11,027 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:29:11,030 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:29:11,030 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:29:11,030 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:29:11,031 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:29:11,031 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:29:11,031 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:29:11,033 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:29:11,033 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:29:11,034 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:29:43,475 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:29:43,476 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:29:43,477 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:29:43,480 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:29:43,483 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:29:43,483 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:29:43,483 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:29:43,484 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:29:43,485 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:29:43,486 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:29:43,486 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:29:43,489 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:29:43,491 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:29:43,491 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:30:16,336 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:30:16,336 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:30:16,337 INFO core: Memory RSS: 89.18 MB
2026-08-09 09:30:16,337 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:30:16,340 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:30:16,342 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:30:16,342 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:30:16,343 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:30:16,343 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:30:16,343 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:30:16,344 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:30:16,344 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:30:16,354 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:30:16,367 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:30:42,156 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:30:42,156 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:30:42,159 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:30:42,160 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:30:42,161 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:30:42,161 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:30:42,163 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:30:49,047 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:30:49,056 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:30:49,057 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:31:21,151 INFO core: Memory RSS: 89.42 MB
2026-08-09 09:31:21,152 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:31:21,163 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:31:21,164 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:31:21,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:31:52,453 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 09:31:52,455 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:31:52,457 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:31:52,458 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:31:52,459 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:31:52,461 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:31:52,462 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:31:52,469 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:31:52,470 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:32:24,586 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:32:24,587 INFO core: Memory RSS: 89.45 MB
2026-08-09 09:32:24,588 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:32:24,592 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:32:24,593 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:32:24,596 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:32:24,597 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:32:24,598 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:32:24,600 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:32:24,601 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 09:32:24,601 INFO core: Memory RSS: 89.47 MB
2026-08-09 09:32:24,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:32:56,718 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:32:56,720 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:32:56,727 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:32:56,728 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:32:56,729 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:32:56,731 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:32:56,733 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:32:56,734 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:32:56,735 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 09:32:56,736 INFO core: _init_accounts coroutine started
2026-08-09 09:32:56,736 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:32:56,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:33:29,511 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 09:33:29,513 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 09:33:29,513 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:33:29,514 INFO core: Memory RSS: 89.47 MB
2026-08-09 09:33:29,516 INFO core: Memory RSS: 89.47 MB
2026-08-09 09:33:29,520 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 09:33:29,521 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:33:29,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:33:29,522 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:34:02,326 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:34:02,327 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:34:02,329 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:34:02,329 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 09:34:02,330 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:34:02,332 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:34:02,332 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:34:02,335 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:34:02,339 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:34:02,349 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 09:34:02,349 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 09:34:02,352 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:34:02,352 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:34:02,355 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:34:34,781 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:34:34,782 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:34:34,782 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:34:34,783 INFO core: Memory RSS: 89.55 MB
2026-08-09 09:34:34,784 INFO core: Memory RSS: 89.55 MB
2026-08-09 09:34:34,785 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:34:34,789 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:34:34,793 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:34:34,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:34:34,797 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:34:34,798 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:34:34,799 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:35:07,712 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:35:07,713 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:35:07,713 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:35:07,715 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:35:07,717 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:35:07,719 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:35:07,719 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:35:07,720 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:35:07,721 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:35:07,721 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:35:07,723 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:35:07,731 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:35:20,680 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:35:20,681 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:35:20,681 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:35:20,682 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:35:20,683 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:35:20,685 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:35:20,687 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:35:20,687 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:35:20,687 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:35:20,687 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:35:20,688 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:35:20,688 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:35:20,688 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:35:20,689 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:35:20,689 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:35:20,690 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:35:20,690 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:35:20,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:35:40,687 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:35:40,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:35:40,689 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:36:13,410 INFO core: Memory RSS: 89.55 MB
2026-08-09 09:36:13,411 INFO core: Memory RSS: 89.55 MB
2026-08-09 09:36:13,412 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:36:13,416 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:36:13,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:36:13,420 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:36:13,421 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:36:13,422 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:36:13,423 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:36:13,424 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:36:13,425 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:36:13,427 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:36:13,430 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:36:13,435 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:36:13,438 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:36:13,439 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:36:13,440 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:36:13,441 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:36:46,294 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:36:46,295 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:36:46,296 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:36:46,298 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:36:46,300 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:36:46,302 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:36:46,305 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:36:46,306 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:36:46,306 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:36:46,306 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:36:46,306 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:36:46,306 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:36:46,306 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:36:46,307 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:36:46,307 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:36:46,307 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:36:46,308 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:36:46,308 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:36:46,309 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:36:46,312 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:36:46,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:37:18,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:37:51,377 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:37:51,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:37:51,379 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:37:51,379 INFO core: Memory RSS: 89.58 MB
2026-08-09 09:37:51,380 INFO core: Memory RSS: 89.58 MB
2026-08-09 09:37:51,382 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:37:51,385 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:37:51,386 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:37:51,397 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:37:51,400 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:37:51,400 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:37:51,401 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:37:51,401 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:37:51,402 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:37:51,402 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:37:51,402 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:37:51,403 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:37:51,405 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:38:23,695 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:38:23,700 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:38:23,707 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:38:23,710 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:38:23,712 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:38:56,348 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:38:56,350 INFO core: Memory RSS: 89.59 MB
2026-08-09 09:38:56,351 INFO core: Memory RSS: 89.59 MB
2026-08-09 09:38:56,353 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:38:56,353 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:38:56,355 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 09:38:56,356 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:38:56,360 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:38:56,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:39:30,434 INFO core: Memory RSS: 89.59 MB
2026-08-09 09:39:30,435 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:39:30,435 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:39:30,436 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:39:30,438 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:39:30,438 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:39:30,439 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:39:30,439 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:39:30,441 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 09:39:30,443 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:39:30,444 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:39:30,444 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:39:30,444 INFO core: _init_accounts coroutine started
2026-08-09 09:39:30,444 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:39:30,445 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:39:30,445 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:39:30,454 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:40:02,292 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:40:02,293 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:40:02,294 INFO core: Memory RSS: 89.60 MB
2026-08-09 09:40:02,294 INFO core: Memory RSS: 89.60 MB
2026-08-09 09:40:02,295 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:40:02,299 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:40:02,303 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:40:02,303 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:40:02,304 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:40:02,304 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:40:02,306 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:40:02,308 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:40:02,310 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:40:02,311 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:40:02,321 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 09:40:02,322 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 09:40:02,333 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:40:02,339 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:40:02,344 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:40:02,344 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:40:02,345 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 09:40:02,351 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 09:40:02,355 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:40:02,376 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:40:34,540 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:40:34,541 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:40:34,541 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:40:34,542 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:40:34,543 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:40:34,547 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:40:34,552 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:40:34,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:40:34,557 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:40:34,559 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:40:34,561 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:40:34,564 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:40:42,465 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:40:42,466 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:40:42,467 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:40:42,468 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:40:42,469 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:40:42,469 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:40:42,470 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:40:42,472 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:40:42,472 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:40:42,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:40:42,474 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:41:07,324 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:41:07,326 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:41:07,327 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:41:07,328 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:41:07,330 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:41:39,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:42:12,211 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 09:42:12,211 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 09:42:12,212 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:42:12,217 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:42:12,223 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:42:12,224 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:42:12,225 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:42:12,226 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:42:12,226 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:42:12,227 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:42:12,228 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:42:12,229 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:42:12,230 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:42:12,231 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:42:12,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:42:12,236 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:42:45,280 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:42:45,285 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:42:45,289 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:42:45,291 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:42:45,292 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:42:45,293 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:42:45,296 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:42:45,300 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:42:45,301 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:42:45,302 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:42:45,302 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:42:45,302 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:42:45,302 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:42:45,303 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:42:45,303 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:42:45,303 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:42:45,304 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:42:45,304 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:42:45,305 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:42:45,308 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:43:17,260 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:43:17,261 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:43:17,261 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:43:17,261 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:43:17,262 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:43:17,263 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:43:17,266 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:43:17,270 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:43:17,272 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:43:17,273 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:43:17,275 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:43:17,275 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:43:17,276 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:43:17,277 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:43:17,279 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:43:17,280 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:43:17,282 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:43:17,283 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:43:17,283 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:43:17,284 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:43:17,284 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:43:17,285 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:43:17,285 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:43:17,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:43:17,291 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:43:49,592 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:43:49,597 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:43:49,598 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:43:49,598 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:43:49,599 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:43:49,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:43:49,601 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:43:49,602 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:44:21,915 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:44:21,919 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:44:21,922 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:44:21,923 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:44:21,924 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:44:21,926 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:44:21,927 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:44:21,927 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:44:21,929 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:44:21,929 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:44:21,931 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:44:21,932 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:44:21,934 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:44:21,935 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:44:21,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:44:21,937 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:44:21,938 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:44:21,939 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:44:21,940 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:44:54,704 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:44:54,706 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:44:54,707 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:44:54,707 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:44:54,708 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:44:54,709 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:44:54,710 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:44:54,713 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:44:54,715 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:44:54,718 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:44:54,718 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:44:54,724 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:45:10,439 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:45:10,440 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:45:10,440 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:45:10,441 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:45:10,442 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:45:10,442 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:45:10,442 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:45:10,443 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:45:10,443 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:45:10,443 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:45:10,445 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:45:10,447 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:45:10,448 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:45:10,448 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:45:10,448 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:45:10,448 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:45:10,449 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:45:10,449 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:45:10,450 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:45:10,450 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:45:10,452 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:45:10,452 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:45:10,453 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:45:10,453 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:45:10,454 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:45:10,471 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:45:26,603 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:45:26,603 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:45:26,604 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:45:26,604 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:45:26,605 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:45:26,605 INFO core: Memory RSS: 89.69 MB
2026-08-09 09:45:26,606 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:45:26,610 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:45:26,612 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:45:26,615 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:45:26,619 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:45:26,620 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:45:26,620 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:45:26,621 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:45:26,622 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:45:26,622 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:45:26,623 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:45:26,624 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:45:58,969 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:45:58,973 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:45:58,974 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:45:58,974 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:45:58,975 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:45:58,976 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:45:58,977 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:45:58,977 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:45:58,978 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:45:58,979 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:45:58,980 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:45:58,980 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:45:58,981 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:45:58,987 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:46:31,749 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:46:31,749 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:46:31,749 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:46:31,750 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:46:31,750 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:46:31,750 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:46:31,756 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:46:31,758 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:46:31,760 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:46:31,762 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:46:31,764 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:46:31,765 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:46:31,765 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:46:31,765 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:46:31,766 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:46:31,767 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:46:31,767 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:46:31,767 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:46:31,768 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:46:31,769 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:46:31,769 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:46:31,770 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:46:31,771 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:46:31,773 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:46:31,775 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:46:31,775 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:46:31,776 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:47:04,451 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:47:04,453 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:47:04,453 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:47:04,455 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:47:04,458 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:47:04,463 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:47:37,367 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:47:37,368 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:47:37,369 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:47:37,369 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:47:37,369 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:47:37,370 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:47:37,370 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:47:37,371 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:47:37,371 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 09:47:37,373 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:47:37,374 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:47:37,375 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:47:37,375 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:47:37,376 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:47:37,377 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:47:37,380 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:47:37,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:47:37,384 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:47:37,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:48:09,923 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:48:09,924 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:48:09,925 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:48:09,930 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:48:09,932 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 09:48:09,936 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:48:09,942 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:48:09,944 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:48:09,945 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:48:09,947 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:48:09,952 INFO core: _init_accounts coroutine started
2026-08-09 09:48:09,953 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:48:09,953 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:48:09,955 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:48:09,956 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:48:09,958 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:48:09,959 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:48:09,961 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:48:42,758 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:48:42,760 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:48:42,764 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:48:42,766 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:48:42,767 INFO core: Memory RSS: 90.00 MB
2026-08-09 09:48:42,770 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:48:42,771 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:48:42,772 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:48:42,775 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:48:42,777 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:48:42,779 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 09:48:42,779 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 09:48:42,783 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:48:42,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:48:42,786 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 09:49:15,536 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:49:15,537 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:49:15,539 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:49:15,539 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:49:15,540 INFO core: Memory RSS: 90.05 MB
2026-08-09 09:49:15,540 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:49:15,541 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:49:15,545 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:49:15,546 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 09:49:15,547 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:49:15,551 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:49:15,555 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:49:15,556 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:49:15,556 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:49:15,557 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:49:15,562 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:49:15,565 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:49:15,569 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:49:15,570 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:49:15,572 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:49:15,573 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:49:15,602 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:49:15,604 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:49:15,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:49:15,607 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:49:15,608 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:49:15,609 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:49:15,609 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:49:15,610 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:49:47,946 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:49:47,947 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:49:47,947 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:49:47,947 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:49:47,948 INFO core: Memory RSS: 90.18 MB
2026-08-09 09:49:47,949 INFO core: Memory RSS: 90.18 MB
2026-08-09 09:49:47,949 INFO core: Memory RSS: 90.18 MB
2026-08-09 09:49:47,950 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:49:47,952 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:49:47,955 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:49:47,958 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:49:47,961 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:49:47,961 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:49:47,962 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:49:47,962 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:49:47,963 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:49:47,963 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:49:47,964 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:49:47,964 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:49:47,965 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:49:47,966 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:49:47,967 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:49:47,968 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:49:47,969 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:49:47,969 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:49:47,970 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:49:47,971 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:49:47,972 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:49:47,973 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:49:47,977 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:50:20,834 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:50:20,835 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:50:20,836 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:20,837 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:20,837 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:20,838 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:20,839 INFO core: Memory RSS: 90.18 MB
2026-08-09 09:50:20,840 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:20,844 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:20,847 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:20,852 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:20,856 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:50:20,856 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:50:20,857 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:50:20,857 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:50:20,858 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:50:20,858 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:50:20,859 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:50:20,859 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:50:20,861 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:50:20,862 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:50:20,863 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:50:20,864 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:50:20,864 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:50:20,866 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:50:20,867 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:50:20,869 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:50:20,873 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:50:20,874 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:50:20,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:50:38,412 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:38,413 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:38,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:38,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:50:38,415 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:38,418 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:38,420 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:38,422 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:50:38,424 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:50:38,425 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:50:38,425 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:50:38,425 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:50:38,425 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:50:38,426 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:50:38,426 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:50:38,426 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:50:53,310 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:50:53,312 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 09:50:53,312 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 09:50:53,313 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:50:53,314 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:50:53,314 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:50:53,315 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:50:53,315 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:50:53,316 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:50:53,317 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:50:53,317 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:50:53,320 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:50:53,322 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:50:53,328 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:50:53,333 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:50:53,333 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:51:26,280 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:51:26,282 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:51:26,282 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:51:26,284 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:51:26,286 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:51:26,287 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:51:26,290 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:51:26,295 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:51:26,298 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:51:26,299 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:51:26,300 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:51:26,301 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:51:26,302 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:51:26,302 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:51:26,304 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:51:26,305 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:51:26,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:51:26,305 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:51:26,307 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:51:26,308 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:51:26,308 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:51:58,754 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:51:58,754 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:51:58,758 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:51:58,761 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:51:58,763 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:51:58,764 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:51:58,765 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:51:58,766 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:51:58,768 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:51:58,770 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:51:58,772 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:51:58,777 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:51:58,778 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:51:58,781 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:51:58,783 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:52:31,609 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:52:31,612 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:52:31,614 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:52:31,614 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:52:31,616 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:52:31,617 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:52:31,618 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:52:31,620 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:52:31,621 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:52:31,627 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:52:31,628 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:52:31,628 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:52:31,629 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:52:31,629 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:52:31,631 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:52:31,633 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:52:31,634 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:52:31,636 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:52:31,638 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:53:04,390 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:53:04,392 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:53:04,393 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:53:04,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:53:04,395 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:53:04,396 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:53:04,397 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:53:04,399 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:53:04,403 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:53:04,404 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:53:04,405 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:53:04,408 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:53:04,410 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:53:04,411 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:53:04,415 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:53:04,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:53:04,416 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:53:04,418 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:53:04,418 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:53:04,420 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:53:04,421 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:53:38,187 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:53:38,188 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:53:38,191 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:53:38,193 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:53:38,194 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:53:38,195 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:53:38,197 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:53:38,198 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:53:38,199 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:53:38,202 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:53:38,205 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:53:38,207 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:53:38,209 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:53:38,210 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:53:38,210 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:53:38,211 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:53:38,211 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:54:10,592 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:54:10,593 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:54:10,594 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:54:10,595 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:54:10,596 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:54:10,597 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:54:10,597 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:54:10,598 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:54:10,598 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:54:10,599 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:54:10,600 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:54:10,600 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:54:10,601 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:54:10,601 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:54:10,604 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:54:10,604 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:54:10,605 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:54:10,606 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:54:10,607 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:54:10,608 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:54:10,611 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:54:10,614 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:54:10,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:54:43,274 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:54:43,274 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:54:43,275 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:54:43,276 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:54:43,276 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:54:43,276 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:54:43,278 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:54:43,282 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:54:43,287 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:54:43,290 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:54:43,294 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:54:43,298 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:54:43,299 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:54:43,301 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:54:43,303 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:54:43,305 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:54:43,306 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:54:43,307 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:54:43,308 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:54:43,310 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:54:43,311 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:54:43,311 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:54:43,313 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:54:43,313 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:55:15,853 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:55:15,854 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:55:15,854 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:55:15,855 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:55:15,855 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:55:15,855 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:55:15,855 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:55:15,856 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:55:15,856 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:55:15,857 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:55:15,857 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:55:15,857 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:55:15,858 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:55:15,858 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:55:15,858 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:55:15,861 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:55:15,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:55:26,991 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:55:26,991 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:55:26,993 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:55:26,993 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:55:26,993 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:55:26,994 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:55:26,994 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:55:26,995 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:55:26,996 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:55:26,998 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:55:27,000 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:55:27,002 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:55:27,002 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:55:27,003 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:55:27,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:55:27,004 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:55:27,004 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:55:27,004 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:55:27,004 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:55:27,004 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:55:27,005 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:55:27,005 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:55:27,006 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:55:27,006 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:55:27,008 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:55:47,970 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:55:47,971 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:55:47,972 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:55:47,973 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:55:47,975 INFO core: Memory RSS: 90.25 MB
2026-08-09 09:55:47,978 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:55:47,979 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 09:55:47,984 INFO core: Memory RSS: 90.46 MB
2026-08-09 09:55:47,991 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:55:47,993 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:55:47,994 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:56:20,847 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:56:20,847 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:56:20,848 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:56:20,849 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:56:20,850 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 09:56:20,850 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:56:20,850 WARNING core: Account 1: connect timed out after 35s
2026-08-09 09:56:20,851 INFO core: Memory RSS: 90.46 MB
2026-08-09 09:56:20,851 INFO core: Memory RSS: 90.46 MB
2026-08-09 09:56:20,852 INFO core: Memory RSS: 90.46 MB
2026-08-09 09:56:20,852 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 09:56:20,855 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 09:56:20,856 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:56:20,856 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:56:20,857 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:56:20,859 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:56:20,864 INFO core: _init_accounts coroutine started
2026-08-09 09:56:20,865 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 09:56:20,866 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:56:20,868 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:56:20,869 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:56:20,871 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 09:56:20,872 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:56:20,874 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:56:20,875 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:56:20,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:56:20,876 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 09:56:20,878 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:56:20,879 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:56:20,879 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:56:20,879 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:56:20,880 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 09:56:20,882 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:56:20,892 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:56:53,542 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:56:53,543 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:56:53,543 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:56:53,544 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:56:53,544 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:56:53,545 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:56:53,546 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:56:53,546 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:56:53,547 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:56:53,550 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:56:53,556 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:56:53,560 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:56:53,562 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:56:53,562 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:56:53,562 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:56:53,563 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 09:56:53,563 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 09:56:53,564 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 09:56:53,565 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 09:56:53,565 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:56:53,565 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:56:53,566 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 09:56:53,569 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 09:56:53,573 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:56:53,574 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 09:56:53,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:57:28,159 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 09:57:28,162 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:57:28,163 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:57:28,164 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:57:28,165 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:57:28,167 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:57:28,168 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:57:28,170 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:57:28,172 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:57:28,173 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:57:28,174 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:57:28,175 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:57:28,178 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:57:28,181 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:57:28,185 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:57:28,186 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:57:28,188 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:57:28,190 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:57:28,191 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:58:00,349 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 09:58:00,350 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 09:58:00,355 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:58:32,689 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:58:32,690 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:58:32,691 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:58:32,692 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 09:58:32,693 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:58:32,694 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:58:32,695 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:58:32,698 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:58:32,702 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:58:32,704 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:58:32,710 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:58:32,711 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:58:32,715 INFO core: Memory RSS: 90.61 MB
2026-08-09 09:58:32,721 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:58:32,722 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:58:32,723 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:58:32,730 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:58:32,733 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:58:32,733 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:58:32,736 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:58:32,736 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:58:32,738 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:59:05,599 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:59:05,600 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:59:05,602 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:59:05,602 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 09:59:05,605 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 09:59:05,606 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 09:59:05,608 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:59:05,616 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:59:05,622 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:59:05,630 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 09:59:05,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 09:59:05,638 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:59:05,640 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:59:05,640 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 09:59:05,641 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 09:59:05,642 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:59:05,644 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:59:37,803 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 09:59:37,803 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 09:59:37,804 INFO core: Watchdog: connecting missing account 1
2026-08-09 09:59:37,804 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:59:37,805 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:59:37,806 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:59:37,807 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:59:37,808 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 09:59:37,808 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:59:37,808 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:59:37,808 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 09:59:37,809 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:59:37,809 INFO core: Memory RSS: 90.78 MB
2026-08-09 09:59:37,811 INFO core: Memory RSS: 90.78 MB
2026-08-09 09:59:37,811 INFO core: Memory RSS: 90.78 MB
2026-08-09 09:59:37,812 INFO core: Memory RSS: 90.78 MB
2026-08-09 09:59:37,813 INFO core: Memory RSS: 90.78 MB
2026-08-09 09:59:37,813 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:59:37,814 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:59:37,815 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 09:59:37,816 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:59:37,816 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 09:59:37,817 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 09:59:37,818 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 09:59:37,819 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 09:59:37,820 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:00:09,953 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:09,954 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:09,954 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:09,954 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:09,955 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:09,955 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:09,955 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:09,969 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:09,974 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:09,977 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:09,981 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:09,985 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:09,990 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:00:09,991 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:00:09,991 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:00:09,991 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:00:09,991 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:00:09,992 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:00:09,992 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:00:09,992 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:00:09,993 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:00:09,993 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:00:09,994 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:00:09,994 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:00:09,995 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:00:09,995 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:00:09,996 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:00:09,996 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:00:09,997 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:00:09,998 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:00:09,999 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:00:09,999 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:00:10,000 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:00:10,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:00:10,001 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:00:10,002 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:00:10,002 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:00:10,003 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:00:10,003 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:00:10,004 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:00:10,004 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:00:10,172 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:00:34,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:00:34,000 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:34,001 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:42,674 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:42,675 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:42,675 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:42,676 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:00:42,677 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:00:42,677 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:00:42,678 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:00:42,678 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:00:42,679 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:00:42,681 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:42,686 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:42,687 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:00:42,690 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:00:42,697 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:01:15,124 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:01:15,128 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:01:15,132 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:01:15,132 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:01:15,133 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:01:15,134 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:01:15,134 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:01:15,135 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:01:15,136 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:01:15,136 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:01:15,137 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:01:15,138 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:01:15,138 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:01:15,139 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:01:15,140 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:01:15,141 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:01:15,142 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:01:15,143 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:01:15,145 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:01:15,145 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:01:15,146 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:01:15,147 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:01:15,148 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:01:48,435 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:01:48,437 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:01:48,439 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:01:48,440 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:01:48,440 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:01:48,441 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:01:48,441 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:01:48,442 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:01:48,442 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:01:48,442 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:01:48,442 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:01:48,443 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:01:48,443 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:01:48,443 INFO core: Memory RSS: 91.61 MB
2026-08-09 10:01:48,456 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:01:48,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:01:48,465 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:01:48,466 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:02:25,879 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:02:25,880 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:02:25,881 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:02:25,882 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:02:25,882 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:02:25,882 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:02:25,884 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:02:25,885 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:02:25,886 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:02:25,887 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:02:25,888 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:02:25,888 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:02:25,888 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:02:25,891 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:02:25,892 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:02:25,893 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:02:25,894 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:02:25,895 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:02:25,895 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:02:25,896 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:02:25,898 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:02:25,906 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:02:25,906 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:02:25,906 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:02:25,907 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:02:25,909 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:02:25,910 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:02:25,911 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:02:25,911 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:02:25,912 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:02:25,913 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:02:25,914 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:02:25,915 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:02:25,916 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:02:25,917 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:02:25,917 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:02:25,918 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:02:25,919 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:02:25,920 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:02:25,921 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:02:25,921 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:02:25,922 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:02:57,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:02:57,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:02:57,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:02:57,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:02:57,419 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:02:57,419 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:02:57,420 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:02:57,421 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:02:57,421 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:02:57,423 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:02:57,429 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:02:57,435 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:02:57,440 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:02:57,446 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:02:57,446 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:02:57,448 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:02:57,453 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:03:29,572 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:03:29,574 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:03:29,576 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:03:29,577 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:03:29,578 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:03:29,580 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:03:29,582 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:03:29,582 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:03:29,586 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:03:29,587 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:03:29,588 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:03:29,589 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:03:29,590 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:03:29,591 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:03:29,592 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:03:29,593 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:03:29,595 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:03:29,595 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:02,699 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:04:02,700 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:04:02,700 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:04:02,700 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:04:02,701 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:04:02,701 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:04:02,703 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:04:02,704 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:02,705 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:04:02,706 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:04:02,709 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:04:02,711 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:02,712 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:04:02,712 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:04:02,713 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:04:02,713 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:04:02,714 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:04:02,715 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:02,718 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:04:02,721 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:04:02,734 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:02,736 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:04:02,737 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:02,739 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:04:02,740 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:02,744 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:04:02,744 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:02,745 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 10:04:02,746 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:02,747 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:04:02,748 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:04:02,748 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:02,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:04:34,834 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:04:34,836 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:04:34,837 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:04:34,837 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:04:34,841 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:04:34,850 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:04:34,855 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:04:34,857 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 10:04:34,865 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:04:34,878 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:34,880 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:04:34,881 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:34,882 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:04:34,882 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:34,883 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:04:34,884 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:04:34,884 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:04:34,885 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:34,886 INFO core: _init_accounts coroutine started
2026-08-09 10:04:34,886 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:04:34,886 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:04:34,887 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:34,888 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:04:34,888 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:04:34,889 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:05:07,742 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:05:07,743 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:05:07,744 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:05:07,745 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:05:07,746 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:05:07,746 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:05:07,747 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:07,748 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:07,748 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:07,748 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:05:07,749 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:07,749 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:05:07,749 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:05:07,750 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:05:07,750 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:05:07,750 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:05:07,750 INFO core: Memory RSS: 91.60 MB
2026-08-09 10:05:07,759 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:05:07,760 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:05:07,761 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:05:07,763 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:05:07,766 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 10:05:07,766 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 10:05:07,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:05:07,773 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:05:07,774 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:05:40,350 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 10:05:40,352 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:05:40,353 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:05:40,354 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:05:40,355 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:05:40,356 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:05:40,359 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:05:40,364 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:05:40,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:05:40,367 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:05:40,372 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:05:43,509 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:05:43,514 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:43,514 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:05:43,516 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:43,516 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:05:43,517 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:43,518 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:05:43,519 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:05:43,520 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:05:43,520 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:05:43,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:05:43,523 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 10:05:43,525 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:05:43,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:05:43,528 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:06:12,450 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:06:12,451 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:12,453 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:06:12,454 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:06:12,454 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:12,454 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:12,454 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:06:12,455 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:06:12,455 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:06:12,455 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:12,456 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:12,456 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:12,456 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:12,457 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:06:12,457 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:12,457 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:12,458 INFO core: Memory RSS: 91.69 MB
2026-08-09 10:06:12,458 INFO core: Memory RSS: 91.69 MB
2026-08-09 10:06:12,458 INFO core: Memory RSS: 91.69 MB
2026-08-09 10:06:12,459 INFO core: Memory RSS: 91.69 MB
2026-08-09 10:06:12,459 INFO core: Memory RSS: 91.69 MB
2026-08-09 10:06:12,459 INFO core: Memory RSS: 91.69 MB
2026-08-09 10:06:12,459 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:06:12,460 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:06:12,460 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:06:12,468 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:12,476 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 10:06:12,476 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 10:06:12,478 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:06:12,478 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:06:12,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:06:45,229 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:06:45,229 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:06:45,230 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:06:45,230 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:06:45,231 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:06:45,231 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:06:45,232 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:06:45,233 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:45,235 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:06:45,237 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:06:45,241 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:06:45,246 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:06:45,251 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:06:45,255 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:06:45,259 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:06:45,265 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:45,265 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:06:45,266 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:45,267 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:06:45,268 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:06:45,269 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:06:45,269 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:06:45,270 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:06:45,270 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:06:45,270 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:06:45,271 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:06:45,272 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:06:45,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:06:45,273 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:06:45,274 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:45,274 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:06:45,275 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:17,531 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:07:17,532 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:17,533 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:07:17,535 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:07:17,536 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:07:17,536 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:07:17,536 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:17,536 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:07:17,538 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:17,538 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:07:17,539 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:17,539 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:17,539 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:07:17,540 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:07:17,540 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:07:17,541 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:17,541 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:17,541 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:07:17,542 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:07:17,542 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:07:17,542 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:07:17,542 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:07:17,542 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:07:17,549 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:17,552 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:07:17,553 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:50,104 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:07:50,104 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:07:50,105 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:07:50,105 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:07:50,105 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:07:50,105 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:07:50,106 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:07:50,107 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:07:50,111 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:07:50,114 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:07:50,116 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:07:50,121 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:07:50,125 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:07:50,128 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:07:50,131 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:50,132 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:07:50,133 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:50,133 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:07:50,134 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:50,135 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:07:50,135 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:07:50,136 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:07:50,136 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:07:50,137 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:07:50,138 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:07:50,138 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:07:50,138 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:50,139 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:07:50,140 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:50,141 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:07:50,142 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:07:50,142 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:07:50,143 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:07:50,143 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:50,144 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:07:50,145 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:07:50,145 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:50,145 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:07:50,146 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:07:50,147 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:07:50,148 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:07:50,149 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:07:50,150 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:07:50,150 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:50,153 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:07:50,154 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:07:50,155 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:08:22,509 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:08:22,510 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:08:22,510 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:22,511 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:22,512 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:22,512 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:22,513 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:22,514 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:22,515 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:08:22,516 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:08:22,516 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:08:22,517 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:08:22,518 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:08:22,518 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:08:22,520 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:08:22,532 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:08:22,534 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:08:22,536 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:08:22,537 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:08:22,538 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:08:22,540 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:08:22,540 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:08:22,540 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:08:22,540 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:08:22,540 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:08:22,541 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:08:22,541 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:08:22,541 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:08:22,541 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:08:22,541 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:08:22,541 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:08:22,541 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:08:22,542 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:08:22,542 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:08:22,542 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:08:22,542 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:08:22,543 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:08:22,543 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:08:22,543 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:08:22,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:08:22,544 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:08:22,545 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:08:22,545 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:08:22,545 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:08:55,311 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:08:55,312 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:08:55,313 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:55,314 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:08:55,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:08:55,315 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:08:55,317 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:09:37,245 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:09:37,247 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:09:37,253 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:09:37,254 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:09:37,255 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:09:37,256 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:09:37,258 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:09:37,261 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:09:37,265 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:09:37,269 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:09:37,273 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:09:37,279 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:09:37,281 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:09:37,282 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:09:37,283 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:09:37,285 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:09:37,285 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:09:37,286 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:09:37,287 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:09:37,288 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:09:37,288 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:09:37,289 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:09:37,289 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:09:37,290 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:09:37,291 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:09:37,292 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:09:37,292 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:09:37,293 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:09:37,294 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:09:37,295 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:09:37,295 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:09:37,296 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:09:37,297 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:09:37,297 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:09:37,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:09:37,298 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:09:37,299 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:09:37,301 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:10:09,404 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:10:09,405 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:10:09,406 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:10:09,408 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:09,410 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:09,412 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:10:09,416 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:09,420 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:10:09,424 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:10:09,426 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:10:09,430 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:10:09,434 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:10:09,437 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:10:40,927 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:10:40,929 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:10:40,930 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:10:40,931 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:10:40,933 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:10:40,934 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:10:40,935 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:10:40,936 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:10:40,938 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:10:40,938 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:10:40,939 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:10:43,607 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:10:43,609 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:10:43,610 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:10:43,611 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:10:43,611 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:10:43,611 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:10:43,611 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:10:43,612 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:10:43,613 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:10:43,613 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:10:43,613 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:10:43,614 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:10:43,616 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:10:43,619 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:43,620 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:10:43,622 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:43,622 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:43,622 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:10:43,623 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:43,623 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:10:43,623 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:10:43,623 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:10:43,623 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:10:43,624 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:10:43,624 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:10:43,624 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:10:43,625 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:10:43,625 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:10:43,626 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:10:43,626 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:10:43,626 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:10:43,627 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:10:43,627 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:10:43,630 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:10:43,630 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 10:10:43,631 INFO core: Memory RSS: 91.71 MB
2026-08-09 10:10:43,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:11:15,546 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:15,547 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:15,547 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:15,547 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:15,548 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:15,548 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:15,550 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:15,556 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:15,560 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:15,563 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:15,566 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:15,571 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:15,575 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:11:15,576 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:11:15,577 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:11:15,578 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:11:15,579 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:11:15,581 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:11:15,583 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:15,585 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:11:15,588 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:15,589 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:11:15,589 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:11:15,590 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:11:15,593 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 10:11:15,595 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:11:15,596 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:11:15,597 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:15,597 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:11:15,597 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:15,598 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:11:15,598 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:11:15,599 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:15,600 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:11:15,600 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:15,601 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:15,601 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:15,602 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:15,603 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:11:15,604 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:11:15,605 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:11:15,606 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:15,606 INFO core: _init_accounts coroutine started
2026-08-09 10:11:15,606 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:11:15,607 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:11:15,607 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:15,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:11:48,124 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:48,125 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:48,125 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:48,126 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:48,126 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:48,127 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:11:48,127 INFO core: Memory RSS: 91.74 MB
2026-08-09 10:11:48,128 INFO core: Memory RSS: 91.74 MB
2026-08-09 10:11:48,128 INFO core: Memory RSS: 91.74 MB
2026-08-09 10:11:48,129 INFO core: Memory RSS: 91.74 MB
2026-08-09 10:11:48,129 INFO core: Memory RSS: 91.74 MB
2026-08-09 10:11:48,129 INFO core: Memory RSS: 91.74 MB
2026-08-09 10:11:48,129 INFO core: Memory RSS: 91.74 MB
2026-08-09 10:11:48,130 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:48,132 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:48,135 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:48,138 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:48,142 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:48,148 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:48,150 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:11:48,156 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:48,158 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:11:48,159 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:48,159 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:11:48,160 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:11:48,160 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:11:48,161 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:11:48,163 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:11:48,163 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:11:48,165 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:11:48,166 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:11:48,166 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:11:48,168 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:11:48,169 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 10:11:48,170 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 10:11:48,171 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:48,173 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:11:48,173 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:11:48,175 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:11:48,176 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:11:48,178 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:11:48,178 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:11:48,179 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:11:48,180 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:11:48,182 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:11:48,183 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:11:48,184 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:11:48,185 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:12:20,694 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:12:20,695 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:12:20,696 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:12:20,696 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:12:20,696 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:12:20,697 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 10:12:20,697 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:12:20,698 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:12:20,699 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:12:20,700 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:12:20,701 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:12:20,702 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 10:12:20,703 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:12:20,705 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:12:20,707 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:12:20,710 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:12:20,712 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:12:20,713 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:12:20,713 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:12:20,718 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:12:20,718 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:12:20,719 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:12:20,721 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:12:20,723 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:12:20,725 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:12:54,511 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:12:54,512 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:12:54,514 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:12:54,516 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:12:54,518 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:12:54,518 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:12:54,519 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:12:54,519 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:12:54,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:13:26,818 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:13:59,691 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:13:59,693 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:13:59,694 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:13:59,695 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:13:59,696 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:13:59,706 INFO core: Memory RSS: 91.86 MB
2026-08-09 10:13:59,707 INFO core: Memory RSS: 91.86 MB
2026-08-09 10:13:59,708 INFO core: Memory RSS: 91.86 MB
2026-08-09 10:13:59,709 INFO core: Memory RSS: 91.86 MB
2026-08-09 10:13:59,711 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:14:31,985 INFO core: Memory RSS: 91.87 MB
2026-08-09 10:14:31,988 INFO core: Memory RSS: 91.87 MB
2026-08-09 10:14:31,992 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:15:04,738 INFO core: Memory RSS: 91.87 MB
2026-08-09 10:15:04,740 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:15:04,740 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:15:04,741 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:15:04,743 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:15:04,744 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:15:04,744 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:15:04,744 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:15:04,744 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:15:04,745 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:15:04,745 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 10:15:04,746 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 10:15:04,747 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:15:04,747 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:15:04,750 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:15:04,750 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:15:04,750 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:15:04,755 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:15:04,759 INFO core: Memory RSS: 91.88 MB
2026-08-09 10:15:04,760 INFO core: Memory RSS: 91.88 MB
2026-08-09 10:15:04,762 INFO core: Memory RSS: 91.88 MB
2026-08-09 10:15:04,764 INFO core: Memory RSS: 91.88 MB
2026-08-09 10:15:04,764 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:15:04,765 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:15:04,765 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:15:04,766 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:15:04,768 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:15:04,769 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:15:04,769 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:15:04,770 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:15:04,771 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:15:04,771 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:15:04,772 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:15:04,772 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:15:04,774 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:15:04,775 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:15:04,776 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:15:04,776 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:15:04,784 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:15:04,786 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:15:04,787 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:15:04,788 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:15:04,789 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:15:04,789 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:15:04,790 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:15:04,790 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:15:04,790 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:15:04,790 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:15:04,791 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:15:04,791 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:15:04,792 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:15:04,792 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:15:04,794 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:15:04,795 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:15:04,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:15:04,807 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:15:04,813 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:15:06,952 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:15:06,953 INFO telethon.network.mtprotosender: Connection to 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:15:06,955 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:15:06,956 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:15:06,956 INFO telethon.network.mtprotosender: Connection to 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:15:06,957 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:15:06,958 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:15:06,961 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:15:37,477 INFO core: Memory RSS: 91.92 MB
2026-08-09 10:15:37,478 INFO core: Memory RSS: 91.92 MB
2026-08-09 10:15:37,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:16:10,601 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:16:10,603 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:16:10,603 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:16:10,604 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:16:10,605 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:16:10,605 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:16:41,802 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:17:33,954 INFO core: Memory RSS: 92.02 MB
2026-08-09 10:18:13,181 INFO core: Memory RSS: 92.02 MB
2026-08-09 10:18:13,183 INFO core: Memory RSS: 92.02 MB
2026-08-09 10:18:44,154 INFO core: Memory RSS: 92.02 MB
2026-08-09 10:20:15,356 INFO core: Memory RSS: 92.02 MB
2026-08-09 10:20:43,497 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:20:43,499 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:20:43,499 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:20:43,500 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:20:43,500 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:20:43,500 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:20:43,500 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:20:43,500 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:20:43,502 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 10:20:43,502 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 10:20:43,503 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 10:20:43,503 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 10:20:43,504 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 10:20:43,505 INFO core: Memory RSS: 92.11 MB
2026-08-09 10:20:43,505 INFO core: Memory RSS: 92.11 MB
2026-08-09 10:20:43,505 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 10:20:43,506 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 10:20:43,507 INFO core: Memory RSS: 92.11 MB
2026-08-09 10:20:43,508 INFO core: Memory RSS: 92.11 MB
2026-08-09 10:20:43,509 INFO core: Memory RSS: 92.11 MB
2026-08-09 10:20:43,510 INFO core: Memory RSS: 92.11 MB
2026-08-09 10:20:43,513 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:20:43,514 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:20:43,514 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:20:43,514 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:20:43,515 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:20:43,515 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:20:43,515 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:20:43,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:20:43,518 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:20:43,519 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 10:20:43,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:20:43,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:20:43,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:20:43,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:20:43,522 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:20:43,522 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:20:43,522 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:20:43,522 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:20:43,523 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:20:43,523 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:20:43,523 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:20:46,246 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:20:46,246 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:20:46,246 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:20:46,247 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:20:46,247 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:21:17,135 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:21:40,859 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:21:40,859 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:21:47,897 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:21:47,898 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:22:10,459 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:22:48,934 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:23:49,292 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:24:11,189 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:24:11,190 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:24:20,252 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:24:20,252 INFO core: Memory RSS: 92.12 MB
2026-08-09 10:24:20,253 INFO core: Memory RSS: 92.12 MB
2026-08-09 10:24:20,254 INFO core: Memory RSS: 92.12 MB
2026-08-09 10:24:20,255 INFO core: Memory RSS: 92.12 MB
2026-08-09 10:24:20,255 INFO core: Memory RSS: 92.12 MB
2026-08-09 10:24:20,256 INFO core: Memory RSS: 92.12 MB
2026-08-09 10:24:20,257 INFO core: Memory RSS: 92.12 MB
2026-08-09 10:24:20,257 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:24:20,258 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 10:24:20,259 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 10:24:20,260 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:24:20,263 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:24:20,264 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:24:20,264 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:24:20,265 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:24:20,265 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 10:24:20,266 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 10:24:20,266 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:24:20,267 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:24:20,268 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:24:20,268 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 10:24:20,271 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 10:24:20,272 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:24:20,274 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:24:20,275 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 10:24:20,277 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:24:20,279 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 10:24:51,031 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 10:25:21,118 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:25:21,120 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:25:23,068 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 10:25:23,070 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:25:23,073 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:25:23,079 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:25:23,082 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:25:23,085 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:25:23,086 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:25:23,087 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:25:23,091 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:25:23,093 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:25:23,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:25:23,107 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:25:23,108 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 10:25:23,108 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 10:25:23,109 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:25:45,785 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:25:45,787 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 10:25:51,883 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 10:25:51,884 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:25:51,884 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:25:51,884 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:25:51,884 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:25:51,884 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:25:51,885 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:25:51,886 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 10:25:51,887 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:25:51,887 INFO core: Watchdog: connecting missing account 1
2026-08-09 10:25:51,889 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 10:26:17,514 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 10:26:17,515 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 10:26:44,157 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 10:26:44,160 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 10:26:44,161 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 10:26:44,161 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 10:26:44,162 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:27:14,348 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:27:22,996 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:28:26,020 INFO core: Memory RSS: 92.28 MB
2026-08-09 10:29:57,143 INFO core: Memory RSS: 92.38 MB
2026-08-09 10:30:27,728 INFO core: Event loop thread started, running loop forever
2026-08-09 10:30:28,029 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 10:30:36,146 INFO core: _init_accounts coroutine started
2026-08-09 10:30:36,147 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:30:36,162 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:30:36,165 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-09 10:31:28,332 INFO core: Memory RSS: 92.60 MB
2026-08-09 10:31:28,332 INFO core: Memory RSS: 92.60 MB
2026-08-09 10:31:28,333 INFO core: Memory RSS: 92.60 MB
2026-08-09 10:31:28,333 WARNING core: Account 1: connect timed out after 35s
2026-08-09 10:31:28,334 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 10:31:59,273 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 10:35:18,119 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:35:33,190 INFO core: Event loop thread started, running loop forever
2026-08-09 10:35:33,491 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 10:36:06,378 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 10:36:06,378 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 10:36:06,379 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:36:06,380 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:36:06,380 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:36:06,384 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 10:36:24,676 INFO core: _init_accounts coroutine started
2026-08-09 10:36:55,391 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:40:06,711 ERROR core: _init_accounts failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 682, in connect
    sock = socket.create_connection(
        (self.host, self.port), self.connect_timeout, **kwargs
    )
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 868, in create_connection
    raise exceptions[0]
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 853, in create_connection
    sock.connect(sa)
    ~~~~~~~~~~~~^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 744, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 10:40:11,701 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 10:40:11,703 INFO core: _init_accounts coroutine started
2026-08-09 10:40:11,703 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:40:11,714 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 10:40:11,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:40:35,454 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 10:40:35,454 INFO core: _init_accounts coroutine started
2026-08-09 10:40:37,149 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:40:40,394 INFO core: _init_accounts coroutine started
2026-08-09 10:40:40,394 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:41:12,391 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 10:41:12,393 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 10:41:12,394 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 10:41:12,394 ERROR core: pairs sync error: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 10:45:07,256 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 10:45:22,233 INFO core: Event loop thread started, running loop forever
2026-08-09 10:45:22,236 INFO core: Event loop thread started, running loop forever
2026-08-09 10:45:22,534 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 10:45:22,538 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 10:45:50,715 INFO core: _init_accounts coroutine started
2026-08-09 10:45:50,715 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:45:50,722 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:47:00,220 INFO core: _init_accounts coroutine started
2026-08-09 10:47:29,877 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:50:20,436 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 10:50:25,551 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:50:51,575 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 10:51:22,326 INFO core: _init_accounts coroutine started
2026-08-09 10:51:22,327 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:55:35,766 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 10:55:49,389 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 10:55:49,390 INFO core: _init_accounts coroutine started
2026-08-09 10:55:49,391 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:55:49,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 10:56:38,075 INFO core: Event loop thread started, running loop forever
2026-08-09 10:56:38,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 10:56:57,620 INFO core: _init_accounts coroutine started
2026-08-09 10:57:28,289 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 10:59:08,774 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 11:00:20,846 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 11:00:20,848 INFO core: _init_accounts coroutine started
2026-08-09 11:00:20,848 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 11:00:20,852 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:05:31,889 ERROR core: _init_accounts failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 682, in connect
    sock = socket.create_connection(
        (self.host, self.port), self.connect_timeout, **kwargs
    )
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 868, in create_connection
    raise exceptions[0]
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 853, in create_connection
    sock.connect(sa)
    ~~~~~~~~~~~~^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 744, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 11:05:31,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:05:33,516 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 11:06:11,103 INFO core: _init_accounts coroutine started
2026-08-09 11:06:11,104 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 11:10:13,055 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:11:08,339 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 11:11:08,339 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 11:11:08,341 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 11:11:51,942 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 11:14:40,392 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 11:14:53,777 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 11:15:28,861 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 11:15:28,865 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 11:15:28,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:15:45,020 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:15:45,020 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:15:45,024 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:15:45,025 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:15:45,026 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 11:15:45,026 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 11:16:55,120 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:16:55,121 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:16:55,124 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 11:16:55,124 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 11:16:55,125 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 11:16:55,125 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 11:17:25,866 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:17:25,867 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:17:25,869 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 11:17:25,870 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 11:17:25,870 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 11:17:25,871 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 11:18:18,284 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:18:18,286 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:19:14,780 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 11:19:14,780 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 11:19:28,051 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 11:19:28,052 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 11:20:06,637 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:20:06,637 WARNING core: Account 1: connect timed out after 35s
2026-08-09 11:20:06,638 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 11:20:06,638 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 11:20:06,638 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 11:20:06,638 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 11:20:11,685 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:20:11,685 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 11:20:11,686 INFO core: Memory RSS: 89.25 MB
2026-08-09 11:20:11,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:20:17,020 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 11:20:48,185 INFO core: _init_accounts coroutine started
2026-08-09 11:20:48,185 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 11:21:21,252 INFO core: Memory RSS: 89.26 MB
2026-08-09 11:21:21,257 INFO core: Watchdog: connecting missing account 1
2026-08-09 11:21:21,258 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:21:21,263 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 11:21:21,264 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 11:21:28,090 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 11:21:28,090 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 11:21:28,092 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 11:21:28,095 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 11:22:48,126 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:22:48,127 WARNING core: Account 1: connect timed out after 35s
2026-08-09 11:22:48,127 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:22:48,128 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:22:48,129 INFO core: Memory RSS: 88.96 MB
2026-08-09 11:22:48,129 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 11:22:48,131 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 11:22:58,819 INFO core: Event loop thread started, running loop forever
2026-08-09 11:22:59,120 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 11:23:23,545 INFO core: _init_accounts coroutine started
2026-08-09 11:24:16,420 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 11:24:16,420 INFO core: Memory RSS: 88.96 MB
2026-08-09 11:24:49,139 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:25:04,092 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:25:04,093 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:25:04,098 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 11:25:04,098 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 11:25:04,100 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 11:25:04,100 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 11:25:04,133 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 11:25:04,133 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 11:25:04,137 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:26:00,950 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:26:00,951 INFO core: Memory RSS: 89.11 MB
2026-08-09 11:26:00,953 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 11:26:00,953 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:26:20,606 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 11:26:20,607 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 11:26:20,607 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 11:26:20,608 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 11:26:20,609 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 11:27:01,921 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:27:51,448 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:27:51,448 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:28:03,601 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:28:03,601 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:28:03,602 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:28:35,383 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 11:28:34,174 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:29:52,847 INFO core: Memory RSS: 89.15 MB
2026-08-09 11:29:52,848 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 11:29:52,848 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 11:29:52,849 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 11:29:52,850 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 11:30:05,980 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 11:30:05,981 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 11:30:05,981 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:30:05,982 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:30:05,986 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 11:30:05,986 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 11:30:05,987 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 11:30:05,987 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 11:30:05,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:30:37,377 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:30:54,954 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:30:54,956 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:31:04,911 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:31:04,912 INFO core: Memory RSS: 89.26 MB
2026-08-09 11:31:04,912 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 11:31:04,913 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 11:31:04,913 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 11:31:04,913 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 11:31:04,913 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 11:31:04,914 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 11:31:04,914 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 11:31:04,920 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:31:36,373 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:31:36,375 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:31:36,377 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 11:31:36,378 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 11:31:36,379 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 11:31:36,379 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 11:31:54,459 INFO core: Event loop thread started, running loop forever
2026-08-09 11:31:54,760 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 11:32:05,924 INFO core: _init_accounts coroutine started
2026-08-09 11:32:05,926 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 11:35:08,802 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:35:38,854 INFO core: Watchdog: connecting missing account 1
2026-08-09 11:35:38,860 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:36:56,825 INFO core: Memory RSS: 89.29 MB
2026-08-09 11:36:56,826 WARNING core: Account 1: connect timed out after 35s
2026-08-09 11:36:56,827 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 11:36:56,828 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 11:36:56,828 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:36:56,829 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 11:36:56,829 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 11:36:56,833 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 11:36:56,833 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 11:36:56,836 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:36:56,836 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 11:36:56,837 INFO core: Memory RSS: 89.35 MB
2026-08-09 11:36:56,846 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 11:37:27,513 INFO core: _init_accounts coroutine started
2026-08-09 11:37:40,088 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 11:37:40,089 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:37:40,091 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:37:40,094 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:37:40,095 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:37:40,097 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 11:38:28,680 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 11:38:59,659 INFO core: Memory RSS: 89.38 MB
2026-08-09 11:38:59,661 INFO core: Memory RSS: 89.38 MB
2026-08-09 11:38:59,661 INFO core: Watchdog: connecting missing account 1
2026-08-09 11:38:59,662 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 11:38:59,664 WARNING core: Account 1: connect timed out after 35s
2026-08-09 11:39:29,744 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:39:42,088 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 11:40:06,425 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 11:40:06,425 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 11:40:06,426 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 11:40:06,427 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 11:40:06,429 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 11:40:06,430 INFO core: Memory RSS: 89.41 MB
2026-08-09 11:40:06,431 INFO core: Memory RSS: 89.41 MB
2026-08-09 11:40:06,432 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 11:40:06,433 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 11:40:06,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:40:13,959 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:40:13,960 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:40:13,963 INFO telethon.network.mtprotosender: Connection to 91.108.56.182:443/TcpAbridged complete!
2026-08-09 11:40:13,965 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 11:40:31,365 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 11:40:44,330 INFO core: _init_accounts coroutine started
2026-08-09 11:40:44,330 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 11:40:44,331 WARNING core: Account 1: connect timed out after 35s
2026-08-09 11:40:44,331 WARNING core: Account 1: connect timed out after 35s
2026-08-09 11:43:48,441 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 11:44:08,814 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 11:44:54,767 INFO core: Memory RSS: 89.72 MB
2026-08-09 11:45:03,771 INFO core: Memory RSS: 89.72 MB
2026-08-09 11:45:03,772 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:45:03,773 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 11:45:03,773 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:45:03,774 WARNING core: Account 1: disconnect timed out after 10s
2026-08-09 11:45:03,774 WARNING core: Account 1: disconnect timed out after 10s
2026-08-09 11:45:03,776 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:45:03,776 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 11:45:03,777 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 11:45:03,777 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:45:03,778 INFO telethon.network.mtprotosender: Disconnection from None complete!
2026-08-09 11:45:03,779 INFO telethon.network.mtprotosender: Disconnection from None complete!
2026-08-09 11:45:35,999 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 11:45:36,000 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 11:45:36,001 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 11:45:36,005 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 11:45:36,009 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:45:36,013 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 11:45:36,014 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 11:45:36,020 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:45:36,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:45:36,022 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 11:45:54,835 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:45:54,835 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:45:54,836 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:45:54,838 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:45:54,839 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 11:45:54,839 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 11:45:54,839 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 11:45:54,839 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 11:45:54,840 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 11:45:54,840 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 11:45:54,840 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 11:45:54,841 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 11:45:54,846 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 11:46:15,167 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:46:35,294 INFO core: Memory RSS: 89.92 MB
2026-08-09 11:46:35,294 INFO core: Memory RSS: 89.92 MB
2026-08-09 11:46:35,295 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:46:35,295 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:46:35,298 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:46:35,300 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 11:46:35,300 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 11:46:35,300 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 11:46:35,300 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 11:46:35,301 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 11:46:35,301 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 11:46:35,301 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 11:46:49,935 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:47:06,028 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:47:06,032 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 11:47:06,032 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 11:47:06,033 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 11:47:06,034 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 11:47:20,146 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:49:07,295 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:49:07,299 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:49:07,300 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:49:20,391 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 11:49:50,845 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 11:49:50,846 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 11:50:07,545 INFO core: Watchdog: connecting missing account 1
2026-08-09 11:50:07,545 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:50:07,548 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:50:07,550 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:50:07,550 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 11:50:07,551 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 11:50:07,556 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:50:07,557 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 11:50:07,558 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 11:50:07,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:50:07,564 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 11:50:07,565 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 11:50:51,595 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:51:08,491 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:52:08,725 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:53:09,519 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:54:42,474 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:54:42,474 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:54:42,474 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:54:42,475 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:54:42,475 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 11:54:42,475 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 11:54:42,475 ERROR core: Watchdog error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 611, in _watchdog_loop
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 11:54:42,481 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 11:55:04,601 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 11:55:24,599 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 11:55:31,031 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 11:55:31,033 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:55:31,037 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 11:55:31,041 INFO core: Watchdog: connecting missing account 1
2026-08-09 11:55:31,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 11:55:54,751 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 11:55:54,752 WARNING core: Account 1: connect timed out after 35s
2026-08-09 11:56:24,756 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 11:56:24,758 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 11:57:55,899 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:57:55,899 INFO core: Memory RSS: 89.84 MB
2026-08-09 11:57:55,899 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 11:59:27,061 ERROR core: Watchdog error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 617, in _watchdog_loop
    await self._start_account_client(acct_id)
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:00:15,632 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 12:00:15,632 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 12:00:15,633 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 12:00:15,633 INFO core: Memory RSS: 89.85 MB
2026-08-09 12:00:15,633 INFO core: Memory RSS: 89.85 MB
2026-08-09 12:00:15,634 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 12:00:15,635 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 12:00:15,635 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 12:00:15,636 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 12:00:32,207 ERROR core: pairs sync error: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 12:00:32,207 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:00:32,208 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:00:32,208 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:00:32,211 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 12:00:32,212 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 12:00:32,213 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 12:00:32,213 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 12:00:32,215 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:00:47,915 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:00:47,915 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:00:47,916 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:00:47,920 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:00:47,924 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 12:00:47,924 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 12:00:47,924 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 12:00:47,924 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 12:00:47,925 INFO core: Watchdog: connecting missing account 1
2026-08-09 12:00:47,925 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 12:00:47,926 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 12:00:47,926 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 12:00:47,927 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 12:00:47,933 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 12:00:47,933 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 12:01:28,912 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:01:28,912 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:01:28,913 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:01:47,203 INFO core: Memory RSS: 89.86 MB
2026-08-09 12:01:47,203 INFO core: Memory RSS: 89.86 MB
2026-08-09 12:01:47,204 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:01:47,206 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:01:47,208 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:01:59,601 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 12:02:17,787 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 12:02:17,788 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 12:02:17,789 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 12:02:17,789 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 12:02:17,789 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 12:02:29,980 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:02:48,309 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 12:02:48,311 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 12:03:30,608 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 12:03:49,282 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 12:04:53,789 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 12:05:31,113 INFO core: Event loop thread started, running loop forever
2026-08-09 12:05:31,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 12:05:47,001 INFO core: _init_accounts coroutine started
2026-08-09 12:05:47,001 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:05:47,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:07:33,043 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:10:05,251 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:10:05,252 INFO core: _init_accounts coroutine started
2026-08-09 12:10:05,252 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:10:05,264 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-09 12:10:05,266 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 12:10:05,909 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:10:25,787 INFO core: _init_accounts coroutine started
2026-08-09 12:10:36,568 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:15:23,787 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:15:23,802 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:15:29,294 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:16:00,231 INFO core: _init_accounts coroutine started
2026-08-09 12:16:11,723 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:19:01,569 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:20:14,997 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:20:36,159 INFO core: _init_accounts coroutine started
2026-08-09 12:20:36,160 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:20:36,171 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:20:36,172 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 12:20:36,172 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 12:21:46,757 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 12:25:07,293 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 12:25:07,311 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 12:25:07,311 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 12:25:07,321 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 12:25:07,322 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:25:07,325 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 12:27:54,473 WARNING core: Account 1: connect timed out after 35s
2026-08-09 12:29:00,816 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 12:29:00,816 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 12:29:00,817 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 12:29:00,818 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 12:29:00,818 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 12:29:56,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:30:05,412 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:30:05,425 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 12:30:05,425 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 12:30:05,426 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 12:30:05,426 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 12:30:05,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:30:33,953 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:30:33,954 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:31:28,284 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 12:31:34,604 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 12:31:58,579 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 12:32:29,610 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 12:33:05,613 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:33:05,614 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:33:05,615 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 12:33:05,616 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 12:33:05,616 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 12:33:05,617 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 12:33:36,266 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:34:05,609 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 12:35:02,365 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 12:35:02,365 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 12:35:02,366 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 12:35:06,841 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 12:35:06,841 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 12:35:06,843 INFO core: Memory RSS: 89.19 MB
2026-08-09 12:35:06,844 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:35:06,956 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:35:36,965 INFO core: _init_accounts coroutine started
2026-08-09 12:36:07,781 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:36:33,355 INFO core: Event loop thread started, running loop forever
2026-08-09 12:36:33,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 12:36:33,660 INFO core: _init_accounts coroutine started
2026-08-09 12:36:38,627 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:38:40,400 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:39:05,198 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:39:34,429 INFO core: _init_accounts coroutine started
2026-08-09 12:39:40,604 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:40:26,606 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-09 12:40:26,607 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 12:40:37,757 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:41:05,458 INFO core: _init_accounts coroutine started
2026-08-09 12:41:14,443 INFO core: Memory RSS: 89.20 MB
2026-08-09 12:41:14,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 12:41:14,450 INFO core: Watchdog: connecting missing account 1
2026-08-09 12:41:14,450 ERROR core: Watchdog error: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 617, in _watchdog_loop
    await self._start_account_client(acct_id)
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 12:41:35,518 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:45:14,783 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 12:45:15,245 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:45:38,481 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:45:38,482 INFO core: _init_accounts coroutine started
2026-08-09 12:45:45,176 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:46:46,154 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 12:46:46,154 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 12:46:46,155 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 12:46:46,156 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 12:46:46,167 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 12:47:09,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 12:49:41,370 ERROR core: _init_accounts failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 682, in connect
    sock = socket.create_connection(
        (self.host, self.port), self.connect_timeout, **kwargs
    )
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 868, in create_connection
    raise exceptions[0]
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 853, in create_connection
    sock.connect(sa)
    ~~~~~~~~~~~~^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 744, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 12:50:15,475 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:50:19,906 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 12:50:50,551 INFO core: _init_accounts coroutine started
2026-08-09 12:50:50,553 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 12:54:25,663 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 12:54:44,728 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 12:55:45,732 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 12:55:45,736 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 12:55:56,829 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 12:57:16,740 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 12:57:16,740 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 12:59:18,194 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 12:59:29,716 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 12:59:59,849 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 12:59:59,849 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 13:00:06,867 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 13:00:06,867 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 13:00:06,869 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 13:00:06,870 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 13:00:21,195 INFO core: Event loop thread started, running loop forever
2026-08-09 13:00:21,201 INFO core: Event loop thread started, running loop forever
2026-08-09 13:00:21,496 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 13:00:21,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 13:00:21,506 INFO core: _init_accounts coroutine started
2026-08-09 13:00:21,506 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:00:21,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:01:00,113 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:02:50,848 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:03:21,782 INFO core: _init_accounts coroutine started
2026-08-09 13:04:03,748 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:05:24,342 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:05:24,374 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:05:28,395 INFO core: _init_accounts coroutine started
2026-08-09 13:05:28,396 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:05:28,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 13:05:34,737 INFO core: Event loop thread started, running loop forever
2026-08-09 13:05:35,038 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 13:05:45,570 INFO core: _init_accounts coroutine started
2026-08-09 13:05:45,572 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:05:45,580 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:06:55,287 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:09:26,589 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:09:36,874 INFO core: _init_accounts coroutine started
2026-08-09 13:10:12,079 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:10:12,093 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 13:10:12,093 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 13:10:12,094 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 13:10:12,098 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:10:12,098 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 13:10:30,342 INFO core: _init_accounts coroutine started
2026-08-09 13:10:30,343 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:14:12,681 WARNING core: LLM config load failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 13:14:42,994 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 13:15:32,849 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:15:50,774 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:16:02,743 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:16:33,327 INFO core: _init_accounts coroutine started
2026-08-09 13:16:33,328 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:18:47,695 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:18:47,717 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:18:47,717 INFO core: _init_accounts coroutine started
2026-08-09 13:18:47,718 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:20:04,603 ERROR core: _init_accounts failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 682, in connect
    sock = socket.create_connection(
        (self.host, self.port), self.connect_timeout, **kwargs
    )
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 868, in create_connection
    raise exceptions[0]
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 853, in create_connection
    sock.connect(sa)
    ~~~~~~~~~~~~^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 744, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 13:20:04,624 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:20:18,162 INFO core: _init_accounts coroutine started
2026-08-09 13:20:18,162 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:20:52,983 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:20:52,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:21:06,726 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:21:19,170 INFO core: _init_accounts coroutine started
2026-08-09 13:21:19,170 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:25:15,259 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 13:25:15,260 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 13:25:15,263 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 13:25:15,268 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 13:25:15,269 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:29:42,351 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:29:56,099 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 13:30:18,521 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 13:30:18,523 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 13:30:18,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:30:43,098 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:30:43,099 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 13:33:28,864 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 13:33:28,864 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 13:33:28,866 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 13:33:28,867 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 13:33:44,939 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:33:44,939 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 13:33:44,941 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 13:33:44,942 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 13:33:44,942 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 13:33:44,942 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 13:34:14,656 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:34:31,242 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 13:34:31,245 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 13:34:31,245 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 13:34:31,245 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 13:34:31,246 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 13:35:07,328 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:35:15,833 WARNING core: Account 1: connect timed out after 35s
2026-08-09 13:35:37,853 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 13:35:37,855 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 13:35:37,855 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 13:35:37,856 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 13:35:37,856 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 13:35:37,860 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:36:00,229 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-09 13:36:47,150 WARNING core: Account 1: connect timed out after 35s
2026-08-09 13:37:17,468 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-09 13:37:31,188 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 13:37:47,675 WARNING core: Account 1: disconnect timed out after 10s
2026-08-09 13:37:47,676 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 13:39:17,971 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 13:39:17,971 INFO telethon.network.mtprotosender: Disconnection from None complete!
2026-08-09 13:39:34,654 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 13:40:20,675 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:40:20,677 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 13:40:20,677 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-09 13:40:35,670 INFO core: Memory RSS: 89.43 MB
2026-08-09 13:40:35,674 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 13:40:35,675 INFO core: _init_accounts coroutine started
2026-08-09 13:40:35,676 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:41:39,459 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 13:41:50,449 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 13:42:21,042 INFO core: Memory RSS: 89.47 MB
2026-08-09 13:44:53,768 INFO core: Memory RSS: 89.50 MB
2026-08-09 13:45:10,554 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:45:41,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 13:45:41,405 INFO core: Watchdog: connecting missing account 1
2026-08-09 13:45:52,858 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 13:45:52,861 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 13:45:52,863 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 13:45:52,864 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 13:45:52,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:47:12,120 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:47:56,896 INFO core: Memory RSS: 89.57 MB
2026-08-09 13:47:56,898 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 13:48:57,598 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 13:48:57,600 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 13:49:28,018 INFO core: Memory RSS: 89.57 MB
2026-08-09 13:49:44,098 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 13:49:44,099 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 13:50:09,097 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:50:09,098 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 13:50:09,110 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:50:59,608 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 13:50:59,609 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 13:51:29,949 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:51:46,193 WARNING core: Account 1: connect timed out after 35s
2026-08-09 13:51:46,193 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 13:52:17,673 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 13:52:17,673 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 13:52:17,674 INFO core: Memory RSS: 89.46 MB
2026-08-09 13:52:47,610 WARNING core: Account 1: connect timed out after 35s
2026-08-09 13:53:01,598 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 13:53:32,115 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 13:53:32,117 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 13:53:32,117 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 13:54:02,917 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 13:54:02,918 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 13:54:02,918 ERROR core: pairs sync error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 13:54:02,919 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 13:54:02,920 INFO core: Memory RSS: 89.46 MB
2026-08-09 13:54:02,920 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 13:55:20,980 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:55:33,608 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:55:33,609 WARNING core: Account 1: connect timed out after 35s
2026-08-09 13:55:33,609 WARNING core: Account 1: connect timed out after 35s
2026-08-09 13:55:33,610 INFO core: Memory RSS: 89.46 MB
2026-08-09 13:55:33,610 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 13:55:33,611 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 13:55:33,611 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 13:55:33,611 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 13:55:33,611 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 13:55:33,611 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-09 13:55:33,612 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 13:55:33,612 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 13:55:33,613 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 13:55:33,613 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 13:55:33,623 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 13:55:33,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 13:56:04,887 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:56:22,494 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 13:57:37,954 INFO core: Event loop thread started, running loop forever
2026-08-09 13:57:38,255 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 13:57:52,895 INFO core: _init_accounts coroutine started
2026-08-09 13:57:52,895 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:00:25,587 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 14:00:50,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:00:57,550 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:01:26,434 INFO core: _init_accounts coroutine started
2026-08-09 14:01:39,646 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 13:57:09,278 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 14:02:43,387 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 14:02:43,388 INFO core: Memory RSS: 89.56 MB
2026-08-09 14:02:43,389 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 14:02:43,389 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 14:02:43,389 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 14:02:43,389 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 14:02:43,390 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 14:02:43,390 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 14:02:43,390 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 14:02:43,391 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 14:02:43,396 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-09 14:05:14,206 ERROR core: _init_accounts failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 682, in connect
    sock = socket.create_connection(
        (self.host, self.port), self.connect_timeout, **kwargs
    )
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 868, in create_connection
    raise exceptions[0]
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 853, in create_connection
    sock.connect(sa)
    ~~~~~~~~~~~~^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 744, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 14:05:14,233 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:05:30,554 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:05:43,093 INFO core: Event loop thread started, running loop forever
2026-08-09 14:05:43,394 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 14:05:43,398 INFO core: _init_accounts coroutine started
2026-08-09 14:06:01,033 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:10:37,208 INFO core: _init_accounts coroutine started
2026-08-09 14:10:37,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:10:37,214 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 14:08:15,396 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 14:10:41,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:11:04,860 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:11:04,861 INFO core: _init_accounts coroutine started
2026-08-09 14:11:18,467 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:15:08,834 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 14:15:08,834 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 14:15:12,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 14:15:12,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:15:51,861 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 14:20:15,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:25:19,336 WARNING core: LLM config load failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 14:25:19,337 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 14:25:19,343 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:25:19,352 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 14:25:19,354 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 14:25:50,985 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 14:25:50,985 ERROR core: Account 1 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 14:26:21,483 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 14:26:21,483 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 14:26:52,490 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-09 14:26:52,490 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-09 14:27:02,757 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 14:27:32,068 ERROR core: Account 1 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 14:28:23,673 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-09 14:28:23,673 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-09 14:28:23,674 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-09 14:28:23,674 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-09 14:29:03,715 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 14:29:03,715 ERROR core: Account 1 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 14:29:03,718 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-09 14:29:03,718 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-09 14:29:03,719 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-09 14:29:03,719 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-09 14:29:33,895 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 14:30:04,171 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 14:30:35,899 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-09 14:30:35,899 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-09 14:30:35,900 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-09 14:30:35,900 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-09 14:30:35,905 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:30:59,246 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 14:30:59,247 ERROR core: Account 1 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-09 14:30:59,249 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-09 14:30:59,249 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-09 14:30:59,250 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-09 14:32:27,501 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 182, in _init_accounts_inner
    await self._load_pairs()
  File "/home/wovewbge/quill.nx.kg/core.py", line 420, in _load_pairs
    rows = await self._run_db(self.db.get_pairs, only_enabled=True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 212, in get_pairs
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 14:33:28,756 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:33:59,574 INFO core: _init_accounts coroutine started
2026-08-09 14:34:29,712 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:35:27,443 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 14:35:27,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:35:30,570 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:35:39,935 INFO core: Event loop thread started, running loop forever
2026-08-09 14:35:40,236 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 14:36:00,708 INFO core: _init_accounts coroutine started
2026-08-09 14:36:00,709 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:36:40,575 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 14:39:32,850 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:40:05,367 INFO core: _init_accounts coroutine started
2026-08-09 14:40:36,836 INFO core: _init_accounts coroutine started
2026-08-09 14:40:36,837 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:40:44,091 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:40:50,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:45:25,572 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:45:49,135 ERROR core: _init_accounts failed: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 682, in connect
    sock = socket.create_connection(
        (self.host, self.port), self.connect_timeout, **kwargs
    )
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 868, in create_connection
    raise exceptions[0]
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 853, in create_connection
    sock.connect(sa)
    ~~~~~~~~~~~~^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 744, in connect
    raise exc
pymysql.err.OperationalError: (2003, "Can't connect to MySQL server on 'localhost' ([Errno 104] Connection reset by peer)")
2026-08-09 14:46:20,021 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:47:10,649 INFO core: _init_accounts coroutine started
2026-08-09 14:47:20,968 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:50:24,590 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 14:50:33,723 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 14:50:44,464 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 14:50:55,595 INFO core: _init_accounts coroutine started
2026-08-09 14:51:15,378 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 14:55:33,952 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:00:19,561 INFO core: Event loop thread started, running loop forever
2026-08-09 15:00:19,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 15:00:19,868 INFO core: _init_accounts coroutine started
2026-08-09 15:00:19,870 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 15:00:19,879 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:00:19,885 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-09 15:05:07,864 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 15:10:48,350 INFO core: Event loop thread started, running loop forever
2026-08-09 15:10:48,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 15:10:48,656 INFO core: _init_accounts coroutine started
2026-08-09 15:10:48,657 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 15:10:48,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:15:06,344 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-09 15:15:43,176 INFO core: Event loop thread started, running loop forever
2026-08-09 15:15:43,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 15:15:43,482 INFO core: _init_accounts coroutine started
2026-08-09 15:15:43,486 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 15:15:43,488 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:20:35,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:25:39,824 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 15:25:39,825 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 15:25:39,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:30:34,683 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 15:30:34,684 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 15:30:34,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:35:07,525 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:40:14,130 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 15:40:14,130 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 15:40:14,131 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-09 15:40:14,132 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 15:40:14,132 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 15:40:29,198 INFO core: Event loop thread started, running loop forever
2026-08-09 15:40:29,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 15:40:29,510 INFO core: _init_accounts coroutine started
2026-08-09 15:40:29,511 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 15:40:29,522 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:45:09,871 INFO core: Event loop thread started, running loop forever
2026-08-09 15:45:10,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 15:45:10,177 INFO core: _init_accounts coroutine started
2026-08-09 15:45:10,179 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 15:45:10,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:45:35,919 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 15:50:45,481 INFO core: Event loop thread started, running loop forever
2026-08-09 15:50:45,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 15:50:45,787 INFO core: _init_accounts coroutine started
2026-08-09 15:50:45,788 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 15:50:45,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 15:55:50,321 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:00:12,951 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 16:00:12,953 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 16:00:12,954 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 16:00:12,955 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:05:46,931 INFO core: Event loop thread started, running loop forever
2026-08-09 16:05:47,233 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 16:05:47,237 INFO core: _init_accounts coroutine started
2026-08-09 16:05:47,238 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 16:05:47,249 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:10:47,044 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 16:10:47,045 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 16:10:47,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:15:41,916 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 16:15:41,923 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 16:15:41,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:20:49,635 INFO core: Event loop thread started, running loop forever
2026-08-09 16:20:49,936 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 16:20:49,940 INFO core: _init_accounts coroutine started
2026-08-09 16:20:49,942 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 16:20:49,953 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:25:48,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 16:25:48,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 16:25:48,407 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:30:07,951 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 16:30:07,960 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 16:30:07,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:35:09,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:40:35,738 INFO core: Event loop thread started, running loop forever
2026-08-09 16:40:36,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 16:40:36,044 INFO core: _init_accounts coroutine started
2026-08-09 16:40:36,044 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 16:40:36,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:45:42,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 16:45:42,367 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 16:45:42,367 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-09 16:45:42,368 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 16:45:42,368 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 16:45:42,368 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 16:45:42,368 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-09 16:45:42,368 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 16:45:42,368 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 16:45:53,540 INFO core: Event loop thread started, running loop forever
2026-08-09 16:45:53,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 16:45:53,845 INFO core: _init_accounts coroutine started
2026-08-09 16:45:53,846 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 16:45:53,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:45:53,860 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 16:45:53,860 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 16:50:31,186 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 16:50:31,191 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 16:50:31,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 16:55:33,704 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:00:45,239 INFO core: Event loop thread started, running loop forever
2026-08-09 17:00:45,540 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 17:00:45,545 INFO core: _init_accounts coroutine started
2026-08-09 17:00:45,547 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 17:00:45,557 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:05:23,470 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:05:23,472 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 17:05:23,472 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 17:10:31,859 INFO core: Event loop thread started, running loop forever
2026-08-09 17:10:32,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 17:10:32,164 INFO core: _init_accounts coroutine started
2026-08-09 17:10:32,165 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 17:10:32,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:15:16,818 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:20:22,404 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 17:20:39,053 INFO core: Event loop thread started, running loop forever
2026-08-09 17:20:39,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 17:20:39,360 INFO core: _init_accounts coroutine started
2026-08-09 17:20:39,361 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 17:20:39,371 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:25:07,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:30:05,347 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 17:30:05,348 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 17:30:05,348 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-09 17:30:05,349 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 17:30:05,349 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 17:30:05,349 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 17:30:05,349 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-09 17:30:05,349 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 17:30:05,350 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 17:30:24,591 INFO core: Event loop thread started, running loop forever
2026-08-09 17:30:24,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 17:30:24,896 INFO core: _init_accounts coroutine started
2026-08-09 17:30:24,897 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 17:30:24,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:30:24,908 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 17:30:24,911 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 17:35:27,328 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 17:35:27,347 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:40:34,411 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 17:40:37,730 INFO core: Event loop thread started, running loop forever
2026-08-09 17:40:38,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 17:40:38,036 INFO core: _init_accounts coroutine started
2026-08-09 17:40:38,036 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 17:40:38,054 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:45:40,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:45:40,802 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 17:50:23,265 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 17:50:23,269 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 17:50:23,273 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 17:50:23,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 17:50:23,286 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 17:50:23,286 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 17:55:37,846 INFO core: Event loop thread started, running loop forever
2026-08-09 17:55:38,147 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 17:55:38,152 INFO core: _init_accounts coroutine started
2026-08-09 17:55:38,152 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 17:55:38,161 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:00:11,029 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 18:00:11,032 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 18:00:11,034 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:05:18,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 18:05:18,434 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 18:05:25,493 INFO core: Event loop thread started, running loop forever
2026-08-09 18:05:25,794 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 18:05:25,798 INFO core: _init_accounts coroutine started
2026-08-09 18:05:25,799 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 18:05:25,811 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:10:49,509 INFO core: Event loop thread started, running loop forever
2026-08-09 18:10:49,810 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 18:10:49,814 INFO core: _init_accounts coroutine started
2026-08-09 18:10:49,816 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 18:10:49,826 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:15:42,220 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 18:15:42,221 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 18:15:42,221 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:15:42,229 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 18:20:49,383 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 18:20:51,523 INFO core: Event loop thread started, running loop forever
2026-08-09 18:20:51,825 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 18:20:51,828 INFO core: _init_accounts coroutine started
2026-08-09 18:20:51,830 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 18:20:51,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:25:29,683 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 18:25:29,684 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 18:25:29,686 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:30:08,449 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 18:30:08,460 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 18:30:08,472 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:35:15,411 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 18:35:15,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 18:35:38,046 INFO core: Event loop thread started, running loop forever
2026-08-09 18:35:38,347 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 18:35:38,354 INFO core: _init_accounts coroutine started
2026-08-09 18:35:38,355 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 18:35:38,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:40:10,137 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:45:12,788 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 18:45:12,788 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 18:45:12,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:50:52,694 INFO core: Event loop thread started, running loop forever
2026-08-09 18:50:52,995 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 18:50:53,003 INFO core: _init_accounts coroutine started
2026-08-09 18:50:53,004 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 18:50:53,017 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 18:55:20,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:00:10,571 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 19:00:10,572 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 19:00:10,576 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 19:00:10,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:00:10,579 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 19:05:15,818 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:10:21,413 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 19:10:35,359 INFO core: Event loop thread started, running loop forever
2026-08-09 19:10:35,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 19:10:35,664 INFO core: _init_accounts coroutine started
2026-08-09 19:10:35,664 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 19:10:35,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:15:07,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:20:14,356 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 19:20:23,239 INFO core: Event loop thread started, running loop forever
2026-08-09 19:20:23,544 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 19:20:23,551 INFO core: _init_accounts coroutine started
2026-08-09 19:20:23,552 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 19:20:23,555 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:25:33,663 INFO core: Event loop thread started, running loop forever
2026-08-09 19:25:33,964 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 19:25:33,971 INFO core: _init_accounts coroutine started
2026-08-09 19:25:33,972 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 19:25:33,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:30:12,966 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 19:30:12,968 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 19:30:12,977 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 19:30:12,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:35:16,933 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 19:35:16,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:40:23,053 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 19:40:23,055 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 19:40:23,055 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 19:40:31,858 INFO core: Event loop thread started, running loop forever
2026-08-09 19:40:32,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 19:40:32,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:40:32,174 INFO core: _init_accounts coroutine started
2026-08-09 19:45:05,334 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 19:45:38,989 INFO core: Event loop thread started, running loop forever
2026-08-09 19:45:39,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 19:45:39,296 INFO core: _init_accounts coroutine started
2026-08-09 19:45:39,297 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 19:45:39,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:50:26,277 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 19:50:26,295 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 19:55:07,905 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:00:09,732 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 20:00:09,733 INFO core: _init_accounts coroutine started
2026-08-09 20:00:09,733 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 20:00:09,740 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:05:08,129 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:10:28,300 INFO core: Event loop thread started, running loop forever
2026-08-09 20:10:28,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 20:10:28,605 INFO core: _init_accounts coroutine started
2026-08-09 20:10:28,608 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 20:10:28,621 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:15:20,410 INFO core: Event loop thread started, running loop forever
2026-08-09 20:15:20,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 20:15:20,718 INFO core: _init_accounts coroutine started
2026-08-09 20:15:20,718 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 20:15:20,727 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:15:20,729 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-09 20:20:04,863 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 20:25:21,163 INFO core: Event loop thread started, running loop forever
2026-08-09 20:25:21,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 20:25:21,467 INFO core: _init_accounts coroutine started
2026-08-09 20:25:21,468 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 20:25:21,482 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:30:28,379 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-09 20:30:48,747 INFO core: Event loop thread started, running loop forever
2026-08-09 20:30:49,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 20:30:49,055 INFO core: _init_accounts coroutine started
2026-08-09 20:30:49,056 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 20:30:49,064 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 20:30:49,064 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 20:30:49,070 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 20:30:49,072 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 20:30:49,077 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:35:11,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:35:11,267 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 20:35:11,268 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 20:40:16,641 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 20:40:16,643 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 20:40:16,649 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:45:22,399 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 20:45:30,691 INFO core: Event loop thread started, running loop forever
2026-08-09 20:45:30,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 20:45:30,996 INFO core: _init_accounts coroutine started
2026-08-09 20:45:30,997 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 20:45:31,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:50:37,421 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-09 20:50:45,446 INFO core: Event loop thread started, running loop forever
2026-08-09 20:50:45,749 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 20:50:45,754 INFO core: _init_accounts coroutine started
2026-08-09 20:50:45,754 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 20:50:45,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:55:32,664 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 20:55:32,665 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 20:55:32,665 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 21:00:38,416 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 21:00:38,417 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 21:00:38,418 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 21:00:50,001 INFO core: Event loop thread started, running loop forever
2026-08-09 21:00:50,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 21:00:50,306 INFO core: _init_accounts coroutine started
2026-08-09 21:00:50,307 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 21:00:50,316 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:05:38,807 INFO core: Event loop thread started, running loop forever
2026-08-09 21:05:39,108 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 21:05:39,112 INFO core: _init_accounts coroutine started
2026-08-09 21:05:39,113 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 21:05:39,123 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:05:57,825 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 21:10:43,303 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-09 21:10:43,312 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-09 21:15:23,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:20:03,994 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-09 21:20:03,996 INFO core: _init_accounts coroutine started
2026-08-09 21:20:03,996 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 21:20:04,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:25:39,079 INFO core: Event loop thread started, running loop forever
2026-08-09 21:25:39,380 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 21:25:39,384 INFO core: _init_accounts coroutine started
2026-08-09 21:25:39,385 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 21:25:39,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:30:17,549 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 21:30:17,549 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 21:30:17,555 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 21:30:17,561 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 21:30:17,578 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 21:30:17,578 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-09 21:30:17,590 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-09 21:30:17,592 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-09 21:30:17,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:35:24,373 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-09 21:35:24,373 WARNING core: Account 1: connect timed out after 35s
2026-08-09 21:35:24,374 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-09 21:35:24,375 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-09 21:35:41,382 INFO core: Event loop thread started, running loop forever
2026-08-09 21:35:41,683 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 21:35:41,690 INFO core: _init_accounts coroutine started
2026-08-09 21:35:41,690 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 21:35:41,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:40:18,687 INFO core: Event loop thread started, running loop forever
2026-08-09 21:40:18,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 21:40:18,994 INFO core: _init_accounts coroutine started
2026-08-09 21:40:18,994 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 21:40:19,002 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:45:26,500 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-09 21:45:42,858 INFO core: Event loop thread started, running loop forever
2026-08-09 21:45:43,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 21:45:43,165 INFO core: _init_accounts coroutine started
2026-08-09 21:45:43,166 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 21:45:43,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:50:48,920 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 21:50:48,921 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 21:50:48,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 21:55:10,084 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 21:55:10,088 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:00:48,872 INFO core: Event loop thread started, running loop forever
2026-08-09 22:00:49,173 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 22:00:49,177 INFO core: _init_accounts coroutine started
2026-08-09 22:00:49,177 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 22:00:49,185 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:05:18,296 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 22:05:18,296 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 22:05:18,299 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 22:05:18,301 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 22:05:18,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:10:51,979 INFO core: Event loop thread started, running loop forever
2026-08-09 22:10:52,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 22:10:52,286 INFO core: _init_accounts coroutine started
2026-08-09 22:10:52,286 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 22:10:52,293 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:15:47,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:20:47,405 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 22:20:47,414 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:25:20,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:30:47,157 INFO core: Event loop thread started, running loop forever
2026-08-09 22:30:47,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 22:30:47,464 INFO core: _init_accounts coroutine started
2026-08-09 22:30:47,465 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 22:30:47,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:35:17,839 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 22:35:17,839 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 22:35:17,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:40:23,757 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 22:40:27,039 INFO core: Event loop thread started, running loop forever
2026-08-09 22:40:27,340 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 22:40:27,345 INFO core: _init_accounts coroutine started
2026-08-09 22:40:27,346 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 22:40:27,359 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 22:40:27,359 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 22:40:27,361 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 22:40:27,362 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 22:40:27,364 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:45:51,553 INFO core: Event loop thread started, running loop forever
2026-08-09 22:45:51,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 22:45:51,859 INFO core: _init_accounts coroutine started
2026-08-09 22:45:51,860 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 22:45:51,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:50:38,035 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:55:18,284 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 22:55:18,284 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 22:55:18,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 22:55:18,289 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 23:00:25,417 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-09 23:00:30,817 INFO core: Event loop thread started, running loop forever
2026-08-09 23:00:31,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 23:00:31,130 INFO core: _init_accounts coroutine started
2026-08-09 23:00:31,131 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 23:00:31,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:05:08,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:10:15,160 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 23:10:21,705 INFO core: Event loop thread started, running loop forever
2026-08-09 23:10:22,006 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 23:10:22,010 INFO core: _init_accounts coroutine started
2026-08-09 23:10:22,011 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 23:10:22,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:15:13,042 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 23:15:13,043 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 23:15:13,045 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 23:15:13,048 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 23:15:13,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:20:20,407 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 23:20:41,713 INFO core: Event loop thread started, running loop forever
2026-08-09 23:20:42,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 23:20:42,018 INFO core: _init_accounts coroutine started
2026-08-09 23:20:42,019 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 23:20:42,032 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:25:17,813 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 23:25:17,820 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:30:46,087 INFO core: Event loop thread started, running loop forever
2026-08-09 23:30:46,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 23:30:46,392 INFO core: _init_accounts coroutine started
2026-08-09 23:30:46,392 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 23:30:46,401 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:35:29,837 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-09 23:35:29,837 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-09 23:35:29,841 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-09 23:35:29,843 INFO core: _init_accounts_inner: reloading LLM config
2026-08-09 23:35:29,852 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:40:35,369 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-09 23:40:42,247 INFO core: Event loop thread started, running loop forever
2026-08-09 23:40:42,548 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 23:40:42,553 INFO core: _init_accounts coroutine started
2026-08-09 23:40:42,553 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 23:40:42,565 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:45:21,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:50:28,365 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 23:50:49,950 INFO core: Event loop thread started, running loop forever
2026-08-09 23:50:50,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-09 23:50:50,256 INFO core: _init_accounts coroutine started
2026-08-09 23:50:50,257 INFO core: _init_accounts_inner: starting DB migrations
2026-08-09 23:50:50,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-09 23:55:20,033 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-09 23:55:20,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:00:16,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:05:04,461 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-10 00:05:04,475 INFO core: _init_accounts coroutine started
2026-08-10 00:05:04,475 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:05:04,570 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:10:40,750 INFO core: Event loop thread started, running loop forever
2026-08-10 00:10:41,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 00:10:41,057 INFO core: _init_accounts coroutine started
2026-08-10 00:10:41,058 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:10:41,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:15:05,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 00:15:19,041 INFO core: Event loop thread started, running loop forever
2026-08-10 00:15:19,342 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 00:15:19,348 INFO core: _init_accounts coroutine started
2026-08-10 00:15:19,348 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:15:19,354 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:20:35,854 INFO core: Event loop thread started, running loop forever
2026-08-10 00:20:36,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 00:20:36,160 INFO core: _init_accounts coroutine started
2026-08-10 00:20:36,161 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:20:36,175 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:25:49,536 INFO core: Event loop thread started, running loop forever
2026-08-10 00:25:49,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 00:25:49,844 INFO core: _init_accounts coroutine started
2026-08-10 00:25:49,844 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:25:49,859 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 00:25:49,860 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 00:25:49,861 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 00:25:49,864 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 00:25:49,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:30:05,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:35:17,839 INFO core: Event loop thread started, running loop forever
2026-08-10 00:35:18,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 00:35:18,145 INFO core: _init_accounts coroutine started
2026-08-10 00:35:18,146 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:35:18,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:40:45,827 INFO core: Event loop thread started, running loop forever
2026-08-10 00:40:46,128 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 00:40:46,135 INFO core: _init_accounts coroutine started
2026-08-10 00:40:46,135 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:40:46,142 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:45:51,464 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 00:45:51,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:50:06,547 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 00:55:15,605 INFO core: Event loop thread started, running loop forever
2026-08-10 00:55:15,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 00:55:15,911 INFO core: _init_accounts coroutine started
2026-08-10 00:55:15,912 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 00:55:15,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:00:13,672 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 01:00:13,672 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 01:00:13,673 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:05:29,189 INFO core: Event loop thread started, running loop forever
2026-08-10 01:05:29,490 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 01:05:29,496 INFO core: _init_accounts coroutine started
2026-08-10 01:05:29,497 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 01:05:29,507 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:10:33,017 INFO core: Event loop thread started, running loop forever
2026-08-10 01:10:33,318 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 01:10:33,324 INFO core: _init_accounts coroutine started
2026-08-10 01:10:33,325 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 01:10:33,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:15:16,594 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 01:15:16,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:20:05,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:25:10,384 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-10 01:25:10,386 INFO core: _init_accounts coroutine started
2026-08-10 01:25:10,386 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 01:25:10,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 01:25:10,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 01:25:10,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 01:25:10,409 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 01:25:10,412 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:30:19,201 INFO core: Event loop thread started, running loop forever
2026-08-10 01:30:19,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 01:30:19,515 INFO core: _init_accounts coroutine started
2026-08-10 01:30:19,515 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 01:30:19,555 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 01:30:19,555 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 01:30:19,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:35:26,396 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 01:35:26,397 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-10 01:35:26,398 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 01:35:26,398 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 01:35:26,398 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 01:35:26,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 01:35:39,692 INFO core: Event loop thread started, running loop forever
2026-08-10 01:35:39,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 01:35:39,997 INFO core: _init_accounts coroutine started
2026-08-10 01:35:39,998 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 01:35:40,008 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:40:04,587 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 01:40:04,587 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 01:40:04,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:45:11,447 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 01:45:11,448 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-10 01:45:11,449 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 01:45:11,449 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 01:45:11,449 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 01:45:11,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 01:45:34,534 INFO core: Event loop thread started, running loop forever
2026-08-10 01:45:34,835 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 01:45:34,840 INFO core: _init_accounts coroutine started
2026-08-10 01:45:34,840 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 01:45:34,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:50:03,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 01:55:15,794 INFO core: Event loop thread started, running loop forever
2026-08-10 01:55:16,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 01:55:16,100 INFO core: _init_accounts coroutine started
2026-08-10 01:55:16,102 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 01:55:16,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:00:12,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:05:17,722 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 02:05:17,722 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 02:05:17,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:10:24,075 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 02:10:31,957 INFO core: Event loop thread started, running loop forever
2026-08-10 02:10:32,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 02:10:32,263 INFO core: _init_accounts coroutine started
2026-08-10 02:10:32,264 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 02:10:32,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:15:05,070 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:20:12,399 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-10 02:20:32,311 INFO core: Event loop thread started, running loop forever
2026-08-10 02:20:32,613 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 02:20:32,617 INFO core: _init_accounts coroutine started
2026-08-10 02:20:32,617 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 02:20:32,625 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:25:28,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:30:05,398 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 02:30:09,203 INFO core: Event loop thread started, running loop forever
2026-08-10 02:30:09,506 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 02:30:09,520 INFO core: _init_accounts coroutine started
2026-08-10 02:30:09,520 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 02:30:09,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:35:05,935 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:40:11,368 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 02:40:11,368 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 02:40:35,757 INFO core: Event loop thread started, running loop forever
2026-08-10 02:40:36,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 02:40:36,063 INFO core: _init_accounts coroutine started
2026-08-10 02:40:36,064 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 02:40:36,070 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:45:08,668 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 02:45:08,703 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:50:17,815 INFO core: Event loop thread started, running loop forever
2026-08-10 02:50:18,116 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 02:50:18,121 INFO core: _init_accounts coroutine started
2026-08-10 02:50:18,121 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 02:50:18,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 02:55:18,885 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 02:55:18,886 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 02:55:18,890 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 02:55:18,893 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 02:55:18,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:00:28,503 INFO core: Event loop thread started, running loop forever
2026-08-10 03:00:28,804 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:00:28,811 INFO core: _init_accounts coroutine started
2026-08-10 03:00:28,811 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:00:28,840 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 03:00:28,840 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 03:00:28,844 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 03:00:28,846 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:05:35,424 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 03:05:50,174 INFO core: Event loop thread started, running loop forever
2026-08-10 03:05:50,474 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:05:50,479 INFO core: _init_accounts coroutine started
2026-08-10 03:05:50,480 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:05:50,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:10:19,117 INFO core: Event loop thread started, running loop forever
2026-08-10 03:10:19,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:10:19,422 INFO core: _init_accounts coroutine started
2026-08-10 03:10:19,423 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:10:19,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:15:27,985 INFO core: Event loop thread started, running loop forever
2026-08-10 03:15:28,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:15:28,292 INFO core: _init_accounts coroutine started
2026-08-10 03:15:28,292 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:15:28,299 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:20:13,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:25:51,346 INFO core: Event loop thread started, running loop forever
2026-08-10 03:25:51,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:25:51,650 INFO core: _init_accounts coroutine started
2026-08-10 03:25:51,651 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:25:51,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:30:13,126 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:35:39,422 INFO core: Event loop thread started, running loop forever
2026-08-10 03:35:39,726 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:35:39,733 INFO core: _init_accounts coroutine started
2026-08-10 03:35:39,734 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:35:39,738 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:40:07,972 INFO core: Event loop thread started, running loop forever
2026-08-10 03:40:08,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:40:08,278 INFO core: _init_accounts coroutine started
2026-08-10 03:40:08,278 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:40:08,285 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:45:26,092 INFO core: Event loop thread started, running loop forever
2026-08-10 03:45:26,394 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 03:45:26,400 INFO core: _init_accounts coroutine started
2026-08-10 03:45:26,400 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 03:45:26,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 03:45:26,411 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 03:45:26,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 03:45:26,414 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 03:45:26,424 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:50:21,505 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 03:55:05,857 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 03:55:05,857 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 03:55:05,866 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 03:55:05,867 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 03:55:05,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:00:11,381 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 04:00:11,383 WARNING core: Account 1: connect timed out after 35s
2026-08-10 04:00:11,383 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 04:00:11,384 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 04:00:11,385 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 04:00:11,386 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-10 04:00:11,387 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-10 04:00:37,486 INFO core: Event loop thread started, running loop forever
2026-08-10 04:00:37,787 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 04:00:37,791 INFO core: _init_accounts coroutine started
2026-08-10 04:00:37,791 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 04:00:37,800 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:05:49,833 INFO core: Event loop thread started, running loop forever
2026-08-10 04:05:50,134 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 04:05:50,138 INFO core: _init_accounts coroutine started
2026-08-10 04:05:50,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 04:05:50,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:10:26,262 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 04:10:26,276 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:15:38,507 INFO core: Event loop thread started, running loop forever
2026-08-10 04:15:38,808 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 04:15:38,812 INFO core: _init_accounts coroutine started
2026-08-10 04:15:38,813 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 04:15:38,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:20:34,836 INFO core: Event loop thread started, running loop forever
2026-08-10 04:20:35,137 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 04:20:35,144 INFO core: _init_accounts coroutine started
2026-08-10 04:20:35,145 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 04:20:35,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:25:42,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 04:25:42,460 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 04:25:46,253 INFO core: Event loop thread started, running loop forever
2026-08-10 04:25:46,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 04:25:46,559 INFO core: _init_accounts coroutine started
2026-08-10 04:25:46,560 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 04:25:46,572 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:30:45,548 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:30:45,549 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 04:30:45,550 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 04:35:38,084 INFO core: Event loop thread started, running loop forever
2026-08-10 04:35:38,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 04:35:38,388 INFO core: _init_accounts coroutine started
2026-08-10 04:35:38,389 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 04:35:38,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:40:14,431 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:45:44,412 INFO core: Event loop thread started, running loop forever
2026-08-10 04:45:44,713 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 04:45:44,717 INFO core: _init_accounts coroutine started
2026-08-10 04:45:44,718 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 04:45:44,729 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:50:43,563 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 04:50:43,576 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 04:55:06,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:00:29,071 INFO core: Event loop thread started, running loop forever
2026-08-10 05:00:29,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 05:00:29,377 INFO core: _init_accounts coroutine started
2026-08-10 05:00:29,378 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 05:00:29,388 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:05:14,946 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:10:21,905 INFO core: Event loop thread started, running loop forever
2026-08-10 05:10:22,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 05:10:22,212 INFO core: _init_accounts coroutine started
2026-08-10 05:10:22,212 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 05:10:22,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:15:33,776 INFO core: Event loop thread started, running loop forever
2026-08-10 05:15:34,078 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 05:15:34,082 INFO core: _init_accounts coroutine started
2026-08-10 05:15:34,083 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 05:15:34,090 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:20:31,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 05:20:31,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 05:20:31,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:20:31,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 05:25:38,422 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 05:25:49,316 INFO core: Event loop thread started, running loop forever
2026-08-10 05:25:49,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 05:25:49,623 INFO core: _init_accounts coroutine started
2026-08-10 05:25:49,624 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 05:25:49,636 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:30:26,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:35:34,441 INFO core: Event loop thread started, running loop forever
2026-08-10 05:35:34,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 05:35:34,748 INFO core: _init_accounts coroutine started
2026-08-10 05:35:34,748 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 05:35:34,755 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:30:26,516 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 05:40:45,868 INFO core: Event loop thread started, running loop forever
2026-08-10 05:40:46,169 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 05:40:46,174 INFO core: _init_accounts coroutine started
2026-08-10 05:40:46,175 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 05:40:46,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:45:44,496 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:50:53,157 INFO core: Event loop thread started, running loop forever
2026-08-10 05:50:53,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 05:50:53,469 INFO core: _init_accounts coroutine started
2026-08-10 05:50:53,470 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 05:50:53,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 05:55:07,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:00:14,436 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 06:00:43,938 INFO core: Event loop thread started, running loop forever
2026-08-10 06:00:44,239 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 06:00:44,244 INFO core: _init_accounts coroutine started
2026-08-10 06:00:44,245 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 06:00:44,254 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 06:00:44,254 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 06:00:44,256 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 06:00:44,258 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 06:00:44,265 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:05:31,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:05:31,236 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 06:05:31,243 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 06:10:26,917 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 06:10:26,918 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 06:10:26,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:15:19,225 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 06:15:19,229 WARNING core: Account 1: connect timed out after 35s
2026-08-10 06:15:19,230 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 06:15:19,230 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 06:15:19,231 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 06:15:19,233 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-10 06:15:19,233 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-10 06:15:19,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:20:06,312 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 06:20:06,313 WARNING core: Account 1: connect timed out after 35s
2026-08-10 06:20:06,314 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-10 06:20:06,314 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-10 06:20:06,315 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 06:20:06,317 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-10 06:20:06,318 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-10 06:20:06,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:25:13,405 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 06:25:31,310 INFO core: Event loop thread started, running loop forever
2026-08-10 06:25:31,612 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 06:25:31,617 INFO core: _init_accounts coroutine started
2026-08-10 06:25:31,618 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 06:25:31,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:30:24,598 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 06:30:24,598 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 06:30:24,600 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 06:30:24,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:35:15,643 INFO core: Event loop thread started, running loop forever
2026-08-10 06:35:15,944 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 06:35:15,949 INFO core: _init_accounts coroutine started
2026-08-10 06:35:15,950 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 06:35:15,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:35:31,659 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 06:35:31,679 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 06:40:22,391 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-10 06:40:33,016 INFO core: Event loop thread started, running loop forever
2026-08-10 06:40:33,317 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 06:40:33,321 INFO core: _init_accounts coroutine started
2026-08-10 06:40:33,322 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 06:40:33,337 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:45:09,424 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:45:09,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 06:45:09,426 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 06:50:25,493 INFO core: Event loop thread started, running loop forever
2026-08-10 06:50:25,794 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 06:50:25,798 INFO core: _init_accounts coroutine started
2026-08-10 06:50:25,799 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 06:50:25,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 06:55:32,416 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 06:55:44,508 INFO core: Event loop thread started, running loop forever
2026-08-10 06:55:44,809 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 06:55:44,814 INFO core: _init_accounts coroutine started
2026-08-10 06:55:44,814 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 06:55:44,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:00:43,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:00:43,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 07:00:43,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 07:05:29,811 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 07:05:29,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:10:21,646 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 07:10:21,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:15:27,472 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 07:15:27,473 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 07:15:27,473 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 07:15:52,585 INFO core: Event loop thread started, running loop forever
2026-08-10 07:15:52,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 07:15:52,900 INFO core: _init_accounts coroutine started
2026-08-10 07:15:52,901 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 07:15:52,913 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 07:15:52,913 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 07:15:52,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:15:52,915 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 07:20:12,516 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 07:20:12,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:25:13,204 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:30:12,201 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 07:30:12,202 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 07:30:12,207 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 07:30:12,208 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 07:30:12,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:35:17,056 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 07:35:17,058 WARNING core: Account 1: connect timed out after 35s
2026-08-10 07:35:17,058 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 07:35:17,058 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 07:35:17,059 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 07:35:17,060 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-10 07:35:17,060 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-10 07:35:17,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:40:31,578 INFO core: Event loop thread started, running loop forever
2026-08-10 07:40:31,879 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 07:40:31,887 INFO core: _init_accounts coroutine started
2026-08-10 07:40:31,888 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 07:40:31,898 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:45:17,004 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 07:45:17,005 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 07:45:17,006 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 07:45:17,007 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 07:45:17,024 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:50:04,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 07:55:11,006 INFO core: Event loop thread started, running loop forever
2026-08-10 07:55:11,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 07:55:11,311 INFO core: _init_accounts coroutine started
2026-08-10 07:55:11,311 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 07:55:11,324 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-10 07:55:11,327 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-10 08:00:38,732 INFO core: Event loop thread started, running loop forever
2026-08-10 08:00:39,034 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 08:00:39,040 INFO core: _init_accounts coroutine started
2026-08-10 08:00:39,040 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 08:00:39,049 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:05:03,287 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 08:05:03,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:10:41,248 INFO core: Event loop thread started, running loop forever
2026-08-10 08:10:41,548 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 08:10:41,553 INFO core: _init_accounts coroutine started
2026-08-10 08:10:41,554 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 08:10:41,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:15:04,567 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 08:15:04,568 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 08:15:04,576 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:20:44,613 INFO core: Event loop thread started, running loop forever
2026-08-10 08:20:44,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 08:20:44,923 INFO core: _init_accounts coroutine started
2026-08-10 08:20:44,923 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 08:20:44,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:25:43,922 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 08:25:43,927 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 08:25:43,930 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 08:25:43,932 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 08:25:43,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:30:40,279 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:35:13,526 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 08:35:13,526 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 08:35:13,543 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:40:19,565 INFO core: Event loop thread started, running loop forever
2026-08-10 08:40:19,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 08:40:19,873 INFO core: _init_accounts coroutine started
2026-08-10 08:40:19,874 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 08:40:19,884 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:45:26,403 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-10 08:45:52,795 INFO core: Event loop thread started, running loop forever
2026-08-10 08:45:53,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 08:45:53,101 INFO core: _init_accounts coroutine started
2026-08-10 08:45:53,101 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 08:45:53,113 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:50:04,490 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 08:50:04,500 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 08:55:25,095 INFO core: Event loop thread started, running loop forever
2026-08-10 08:55:25,396 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 08:55:25,400 INFO core: _init_accounts coroutine started
2026-08-10 08:55:25,401 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 08:55:25,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:00:31,058 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 09:00:31,059 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 09:00:31,060 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 09:00:31,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:00:31,064 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 09:05:19,837 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:10:51,053 INFO core: Event loop thread started, running loop forever
2026-08-10 09:10:51,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 09:10:51,360 INFO core: _init_accounts coroutine started
2026-08-10 09:10:51,360 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 09:10:51,367 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:15:11,355 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 09:15:20,273 INFO core: Event loop thread started, running loop forever
2026-08-10 09:15:20,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 09:15:20,578 INFO core: _init_accounts coroutine started
2026-08-10 09:15:20,578 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 09:15:20,583 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:20:14,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:25:21,347 INFO core: Event loop thread started, running loop forever
2026-08-10 09:25:21,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 09:25:21,654 INFO core: _init_accounts coroutine started
2026-08-10 09:25:21,655 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 09:25:21,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:30:28,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 09:30:28,425 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 09:30:28,425 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-10 09:30:28,426 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 09:30:28,426 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-10 09:30:28,426 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 09:30:28,426 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 09:30:28,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 09:30:28,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 09:30:50,466 INFO core: Event loop thread started, running loop forever
2026-08-10 09:30:50,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 09:30:50,773 INFO core: _init_accounts coroutine started
2026-08-10 09:30:50,774 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 09:30:50,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:35:40,393 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 09:35:40,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:40:18,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:45:44,887 INFO core: Event loop thread started, running loop forever
2026-08-10 09:45:45,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 09:45:45,194 INFO core: _init_accounts coroutine started
2026-08-10 09:45:45,194 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 09:45:45,208 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:45:45,208 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 09:45:45,209 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 09:45:45,211 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 09:50:45,768 INFO core: Event loop thread started, running loop forever
2026-08-10 09:50:46,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 09:50:46,073 INFO core: _init_accounts coroutine started
2026-08-10 09:50:46,074 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 09:50:46,084 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 09:50:52,779 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 09:50:52,779 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 09:50:52,781 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 09:50:52,782 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 09:55:52,359 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 09:55:52,360 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 09:55:52,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:00:40,186 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 10:00:40,189 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:05:31,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:10:52,178 INFO core: Event loop thread started, running loop forever
2026-08-10 10:10:52,479 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 10:10:52,484 INFO core: _init_accounts coroutine started
2026-08-10 10:10:52,485 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 10:10:52,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:15:50,174 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 10:15:50,174 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 10:15:50,175 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:20:43,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 10:20:43,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 10:20:43,424 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:25:18,321 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:30:08,573 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 10:30:08,573 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 10:30:08,585 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 10:30:08,586 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 10:30:08,589 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:35:15,348 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 10:35:15,349 WARNING core: Account 1: connect timed out after 35s
2026-08-10 10:35:15,350 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 10:35:15,351 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 10:35:15,352 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 10:35:15,354 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-10 10:35:15,354 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-10 10:35:16,906 INFO core: Event loop thread started, running loop forever
2026-08-10 10:35:17,207 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 10:35:17,212 INFO core: _init_accounts coroutine started
2026-08-10 10:35:17,214 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 10:35:17,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:40:14,897 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 10:40:14,897 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 10:40:14,899 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:40:14,900 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 10:45:20,444 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 10:45:20,444 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 10:45:20,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 10:45:20,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 10:45:44,874 INFO core: Event loop thread started, running loop forever
2026-08-10 10:45:45,175 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 10:45:45,179 INFO core: _init_accounts coroutine started
2026-08-10 10:45:45,180 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 10:45:45,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:50:06,960 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 10:55:33,575 INFO core: Event loop thread started, running loop forever
2026-08-10 10:55:33,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 10:55:33,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:00:14,676 INFO core: _init_accounts coroutine started
2026-08-10 11:00:14,680 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 11:00:14,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:05:20,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 11:05:20,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 11:05:33,903 INFO core: Event loop thread started, running loop forever
2026-08-10 11:05:34,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 11:05:34,208 INFO core: _init_accounts coroutine started
2026-08-10 11:05:34,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 11:05:34,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:10:11,730 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 11:10:11,731 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 11:10:11,732 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 11:10:11,735 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 11:10:11,736 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:15:17,397 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 11:15:17,409 INFO core: Event loop thread started, running loop forever
2026-08-10 11:15:17,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 11:15:17,716 INFO core: _init_accounts coroutine started
2026-08-10 11:15:17,716 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 11:15:17,723 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:20:46,140 INFO core: Event loop thread started, running loop forever
2026-08-10 11:20:46,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 11:20:46,446 INFO core: _init_accounts coroutine started
2026-08-10 11:20:46,447 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 11:20:46,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:25:13,325 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:25:13,325 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 11:25:13,326 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 11:25:13,328 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 11:30:16,448 INFO core: Event loop thread started, running loop forever
2026-08-10 11:30:16,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 11:30:16,756 INFO core: _init_accounts coroutine started
2026-08-10 11:30:16,756 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 11:30:16,765 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:35:23,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 11:35:32,395 INFO core: Event loop thread started, running loop forever
2026-08-10 11:35:32,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 11:35:32,703 INFO core: _init_accounts coroutine started
2026-08-10 11:35:32,704 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 11:35:32,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:40:21,538 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 11:40:21,539 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 11:40:21,540 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 11:40:21,542 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 11:40:21,545 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:45:34,845 INFO core: Event loop thread started, running loop forever
2026-08-10 11:45:35,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 11:45:35,150 INFO core: _init_accounts coroutine started
2026-08-10 11:45:35,151 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 11:45:35,161 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:50:09,973 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 11:50:09,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:55:30,071 INFO core: Event loop thread started, running loop forever
2026-08-10 11:55:30,372 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 11:55:30,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 11:55:30,383 INFO core: _init_accounts coroutine started
2026-08-10 11:55:30,383 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 12:00:22,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:05:28,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:10:34,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:15:40,425 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 12:15:53,936 INFO core: Event loop thread started, running loop forever
2026-08-10 12:15:54,237 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 12:15:54,246 INFO core: _init_accounts coroutine started
2026-08-10 12:15:54,246 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 12:15:54,250 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:15:54,255 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 12:15:54,255 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 12:15:54,256 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 12:15:54,257 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 12:20:25,233 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:25:05,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:30:11,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 12:30:11,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 12:30:11,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 12:30:15,130 INFO core: Event loop thread started, running loop forever
2026-08-10 12:30:15,431 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 12:30:15,437 INFO core: _init_accounts coroutine started
2026-08-10 12:30:15,438 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 12:30:15,448 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:35:05,501 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 12:35:05,502 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 12:35:05,504 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 12:35:05,507 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 12:35:05,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:35:05,520 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 12:35:05,522 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 12:40:12,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 12:40:31,453 INFO core: Event loop thread started, running loop forever
2026-08-10 12:40:31,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 12:40:31,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:45:26,847 INFO core: _init_accounts coroutine started
2026-08-10 12:45:26,852 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 12:45:26,858 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:50:08,820 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 12:50:08,820 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 12:50:08,822 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 12:55:14,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 12:55:19,786 INFO core: Event loop thread started, running loop forever
2026-08-10 12:55:20,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 12:55:20,096 INFO core: _init_accounts coroutine started
2026-08-10 12:55:20,097 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 12:55:20,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:00:04,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:05:23,567 INFO core: Event loop thread started, running loop forever
2026-08-10 13:05:23,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 13:05:23,875 INFO core: _init_accounts coroutine started
2026-08-10 13:05:23,875 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 13:05:23,886 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 13:05:23,887 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 13:05:23,888 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 13:05:23,889 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 13:05:23,898 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:10:20,840 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 13:10:20,841 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 13:10:20,850 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 13:10:20,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:10:20,855 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 13:15:09,976 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 13:15:09,976 WARNING core: Account 1: connect timed out after 35s
2026-08-10 13:15:09,977 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 13:15:09,977 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 13:15:09,978 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 13:15:09,979 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-10 13:15:09,980 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-10 13:15:10,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:20:17,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 13:20:17,395 WARNING core: Account 1: connect timed out after 35s
2026-08-10 13:20:32,480 INFO core: Event loop thread started, running loop forever
2026-08-10 13:20:32,781 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 13:20:32,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:25:36,119 INFO core: _init_accounts coroutine started
2026-08-10 13:25:36,120 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 13:25:36,130 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:30:47,350 INFO core: Event loop thread started, running loop forever
2026-08-10 13:30:47,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 13:30:47,656 INFO core: _init_accounts coroutine started
2026-08-10 13:30:47,657 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 13:30:47,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:35:15,474 INFO core: Event loop thread started, running loop forever
2026-08-10 13:35:15,775 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 13:35:15,781 INFO core: _init_accounts coroutine started
2026-08-10 13:35:15,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 13:35:15,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:35:53,514 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 13:40:19,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:45:07,361 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 13:45:13,295 INFO core: Event loop thread started, running loop forever
2026-08-10 13:45:13,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 13:45:13,603 INFO core: _init_accounts coroutine started
2026-08-10 13:45:13,603 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 13:45:13,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:50:23,224 INFO core: Event loop thread started, running loop forever
2026-08-10 13:50:23,525 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 13:50:23,529 INFO core: _init_accounts coroutine started
2026-08-10 13:50:23,529 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 13:50:23,542 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 13:55:30,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 13:55:46,633 INFO core: Event loop thread started, running loop forever
2026-08-10 13:55:46,935 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 13:55:46,942 INFO core: _init_accounts coroutine started
2026-08-10 13:55:46,942 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 13:55:46,950 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:00:49,626 INFO core: Event loop thread started, running loop forever
2026-08-10 14:00:49,928 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 14:00:49,935 INFO core: _init_accounts coroutine started
2026-08-10 14:00:49,935 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 14:00:49,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:05:13,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:10:19,349 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 14:10:19,350 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 14:10:19,350 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-10 14:10:19,351 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 14:10:19,351 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-10 14:10:19,351 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 14:10:19,351 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 14:10:19,351 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 14:10:19,352 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 14:10:23,270 INFO core: Event loop thread started, running loop forever
2026-08-10 14:10:23,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 14:10:23,577 INFO core: _init_accounts coroutine started
2026-08-10 14:10:23,577 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 14:10:23,588 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:15:21,338 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:20:07,735 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 14:20:07,735 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 14:20:07,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:25:13,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 14:25:13,405 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-10 14:25:13,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 14:25:13,406 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 14:25:13,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 14:25:13,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 14:25:29,318 INFO core: Event loop thread started, running loop forever
2026-08-10 14:25:29,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 14:25:29,625 INFO core: _init_accounts coroutine started
2026-08-10 14:25:29,625 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 14:25:29,635 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 14:25:29,635 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 14:25:29,640 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 14:25:29,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:25:29,643 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 14:30:32,427 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:35:44,655 INFO core: Event loop thread started, running loop forever
2026-08-10 14:35:44,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 14:35:44,960 INFO core: _init_accounts coroutine started
2026-08-10 14:35:44,961 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 14:35:44,974 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:40:34,863 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 14:40:34,863 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 14:40:34,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:40:34,869 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 14:45:21,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:50:28,880 INFO core: Event loop thread started, running loop forever
2026-08-10 14:50:29,181 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 14:50:29,188 INFO core: _init_accounts coroutine started
2026-08-10 14:50:29,188 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 14:50:29,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:55:17,195 INFO core: Event loop thread started, running loop forever
2026-08-10 14:55:17,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 14:55:17,502 INFO core: _init_accounts coroutine started
2026-08-10 14:55:17,504 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 14:55:17,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 14:55:36,204 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 15:00:23,388 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-10 15:00:51,915 INFO core: Event loop thread started, running loop forever
2026-08-10 15:00:52,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 15:00:52,222 INFO core: _init_accounts coroutine started
2026-08-10 15:00:52,222 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 15:00:52,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:05:17,462 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 15:05:17,464 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:05:17,465 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 15:10:24,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 15:10:48,374 INFO core: Event loop thread started, running loop forever
2026-08-10 15:10:48,675 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 15:10:48,681 INFO core: _init_accounts coroutine started
2026-08-10 15:10:48,683 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 15:10:48,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:15:15,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:20:22,400 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 15:20:47,995 INFO core: Event loop thread started, running loop forever
2026-08-10 15:20:48,296 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 15:20:48,301 INFO core: _init_accounts coroutine started
2026-08-10 15:20:48,302 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 15:20:48,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:25:03,446 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 15:25:03,447 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 15:25:03,450 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 15:25:03,466 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 15:25:03,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:30:15,567 INFO core: Event loop thread started, running loop forever
2026-08-10 15:30:15,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 15:30:15,873 INFO core: _init_accounts coroutine started
2026-08-10 15:30:15,874 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 15:30:15,886 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:35:19,606 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 15:35:34,431 INFO core: Event loop thread started, running loop forever
2026-08-10 15:35:34,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 15:35:34,743 INFO core: _init_accounts coroutine started
2026-08-10 15:35:34,744 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 15:35:34,755 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:40:29,825 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 15:40:29,862 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:45:47,223 INFO core: Event loop thread started, running loop forever
2026-08-10 15:45:47,524 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 15:45:47,531 INFO core: _init_accounts coroutine started
2026-08-10 15:45:47,533 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 15:45:47,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:50:07,188 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 15:50:07,189 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 15:50:07,190 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 15:50:07,192 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 15:50:07,203 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 15:50:07,205 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 15:50:07,206 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 15:55:14,412 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 15:55:14,413 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 15:55:28,114 INFO core: Event loop thread started, running loop forever
2026-08-10 15:55:28,415 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 15:55:28,418 INFO core: _init_accounts coroutine started
2026-08-10 15:55:28,419 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 15:55:28,433 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:00:07,371 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 16:00:12,810 INFO core: Event loop thread started, running loop forever
2026-08-10 16:00:13,111 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 16:00:13,115 INFO core: _init_accounts coroutine started
2026-08-10 16:00:13,116 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 16:00:13,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:05:44,724 INFO core: Event loop thread started, running loop forever
2026-08-10 16:05:45,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 16:05:45,032 INFO core: _init_accounts coroutine started
2026-08-10 16:05:45,032 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 16:05:45,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:10:48,096 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:15:26,196 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 16:15:26,198 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 16:15:26,204 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 16:15:26,206 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:20:33,385 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 16:20:33,386 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 16:20:33,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 16:20:33,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 16:20:37,158 INFO core: Event loop thread started, running loop forever
2026-08-10 16:20:37,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 16:20:37,473 INFO core: _init_accounts coroutine started
2026-08-10 16:20:37,473 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 16:20:37,475 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:25:33,346 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 16:25:33,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:30:06,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:35:14,213 INFO core: Event loop thread started, running loop forever
2026-08-10 16:35:14,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 16:35:14,520 INFO core: _init_accounts coroutine started
2026-08-10 16:35:14,523 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 16:35:14,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:40:34,627 INFO core: Event loop thread started, running loop forever
2026-08-10 16:40:34,928 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 16:40:34,933 INFO core: _init_accounts coroutine started
2026-08-10 16:40:34,935 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 16:40:34,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:45:25,879 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 16:45:25,879 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 16:45:25,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 16:45:25,882 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 16:45:25,889 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 16:45:25,889 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 16:45:25,894 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 16:45:25,895 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 16:45:25,904 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:50:04,884 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 16:50:04,885 WARNING core: Account 1: connect timed out after 35s
2026-08-10 16:50:04,886 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 16:50:04,887 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 16:50:04,888 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 16:50:04,890 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-10 16:50:04,890 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-10 16:50:04,895 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 16:55:02,969 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 16:55:02,970 WARNING core: Account 1: connect timed out after 35s
2026-08-10 16:55:02,971 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-10 16:55:02,972 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-10 16:55:02,976 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 16:55:02,978 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-10 16:55:02,978 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-10 16:55:02,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:00:48,996 INFO core: Event loop thread started, running loop forever
2026-08-10 17:00:49,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 17:00:49,302 INFO core: _init_accounts coroutine started
2026-08-10 17:00:49,303 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 17:00:49,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:05:20,506 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:10:19,534 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 17:10:19,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:15:13,119 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:20:04,397 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-10 17:20:04,398 INFO core: _init_accounts coroutine started
2026-08-10 17:20:04,398 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 17:20:04,404 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:25:20,981 INFO core: Event loop thread started, running loop forever
2026-08-10 17:25:21,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 17:25:21,291 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:25:21,292 INFO core: _init_accounts coroutine started
2026-08-10 17:25:21,293 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 17:30:15,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:35:11,111 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 17:35:11,112 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 17:35:11,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:40:18,375 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 17:40:18,375 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-10 17:40:18,376 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 17:40:18,376 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 17:40:18,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 17:40:18,377 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 17:40:30,737 INFO core: Event loop thread started, running loop forever
2026-08-10 17:40:31,038 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 17:40:31,043 INFO core: _init_accounts coroutine started
2026-08-10 17:40:31,044 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 17:40:31,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:45:37,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 17:45:45,437 INFO core: Event loop thread started, running loop forever
2026-08-10 17:45:45,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 17:45:45,750 INFO core: _init_accounts coroutine started
2026-08-10 17:45:45,750 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 17:45:45,754 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:50:17,067 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 17:55:13,511 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:00:20,432 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 18:00:22,386 INFO core: Event loop thread started, running loop forever
2026-08-10 18:00:22,687 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 18:00:22,694 INFO core: _init_accounts coroutine started
2026-08-10 18:00:22,695 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 18:00:22,705 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:05:29,385 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 18:05:36,192 INFO core: Event loop thread started, running loop forever
2026-08-10 18:05:36,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 18:05:36,497 INFO core: _init_accounts coroutine started
2026-08-10 18:05:36,499 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 18:05:36,507 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:10:20,556 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 18:10:20,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:10:20,557 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 18:15:09,045 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 18:15:09,048 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:20:15,360 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 18:20:15,361 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 18:20:15,361 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-10 18:20:15,361 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 18:20:15,362 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 18:20:29,269 INFO core: Event loop thread started, running loop forever
2026-08-10 18:20:29,569 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 18:20:29,575 INFO core: _init_accounts coroutine started
2026-08-10 18:20:29,577 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 18:20:29,589 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:25:23,452 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 18:25:23,453 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 18:25:23,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 18:25:23,457 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 18:25:23,460 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:30:24,443 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:35:08,511 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:40:46,889 INFO core: Event loop thread started, running loop forever
2026-08-10 18:40:47,190 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 18:40:47,196 INFO core: _init_accounts coroutine started
2026-08-10 18:40:47,196 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 18:40:47,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:45:08,694 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 18:45:08,703 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:50:33,299 INFO core: Event loop thread started, running loop forever
2026-08-10 18:50:33,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 18:50:33,605 INFO core: _init_accounts coroutine started
2026-08-10 18:50:33,606 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 18:50:33,618 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 18:55:23,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:00:28,955 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 19:00:28,966 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:05:31,140 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:10:42,557 INFO core: Event loop thread started, running loop forever
2026-08-10 19:10:42,858 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 19:10:42,863 INFO core: _init_accounts coroutine started
2026-08-10 19:10:42,863 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 19:10:42,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:15:11,001 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 19:15:11,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:20:43,120 INFO core: Event loop thread started, running loop forever
2026-08-10 19:20:43,421 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 19:20:43,426 INFO core: _init_accounts coroutine started
2026-08-10 19:20:43,426 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 19:20:43,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:25:30,850 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 19:25:30,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:30:31,589 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:35:12,133 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-10 19:35:12,135 INFO core: _init_accounts coroutine started
2026-08-10 19:35:12,135 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 19:35:12,152 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:40:42,727 INFO core: Event loop thread started, running loop forever
2026-08-10 19:40:43,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 19:40:43,034 INFO core: _init_accounts coroutine started
2026-08-10 19:40:43,035 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 19:40:43,050 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:45:26,084 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 19:45:26,084 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 19:45:26,085 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 19:45:26,087 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 19:45:26,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:50:40,213 INFO core: Event loop thread started, running loop forever
2026-08-10 19:50:40,516 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 19:50:40,521 INFO core: _init_accounts coroutine started
2026-08-10 19:50:40,522 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 19:50:40,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 19:55:44,966 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 19:55:44,966 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 19:55:44,971 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 19:55:44,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:00:45,767 INFO core: Event loop thread started, running loop forever
2026-08-10 20:00:46,068 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 20:00:46,072 INFO core: _init_accounts coroutine started
2026-08-10 20:00:46,074 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 20:00:46,079 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:05:17,312 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:05:17,312 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 20:05:17,313 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 20:10:27,040 INFO core: Event loop thread started, running loop forever
2026-08-10 20:10:27,342 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 20:10:27,350 INFO core: _init_accounts coroutine started
2026-08-10 20:10:27,350 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 20:10:27,353 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:15:47,050 INFO core: Event loop thread started, running loop forever
2026-08-10 20:15:47,353 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 20:15:47,358 INFO core: _init_accounts coroutine started
2026-08-10 20:15:47,360 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 20:15:47,370 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:20:12,189 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:25:35,636 INFO core: Event loop thread started, running loop forever
2026-08-10 20:25:35,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 20:25:35,941 INFO core: _init_accounts coroutine started
2026-08-10 20:25:35,942 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 20:25:35,952 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:30:08,403 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:35:33,562 INFO core: Event loop thread started, running loop forever
2026-08-10 20:35:33,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 20:35:33,869 INFO core: _init_accounts coroutine started
2026-08-10 20:35:33,869 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 20:35:33,880 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:40:21,674 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:45:27,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 20:45:42,476 INFO core: Event loop thread started, running loop forever
2026-08-10 20:45:42,777 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 20:45:42,783 INFO core: _init_accounts coroutine started
2026-08-10 20:45:42,784 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 20:45:42,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:50:27,660 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 20:50:27,661 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 20:50:27,664 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 20:50:27,668 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 20:50:27,673 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:55:26,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 20:55:26,674 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 20:55:26,674 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 21:00:19,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:00:19,812 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 21:00:19,815 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 21:05:13,228 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 21:05:13,229 WARNING core: Account 1: connect timed out after 35s
2026-08-10 21:05:13,229 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 21:05:13,230 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 21:05:13,231 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-10 21:05:13,231 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-10 21:05:13,232 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-10 21:05:13,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:10:20,392 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 21:10:20,393 WARNING core: Account 1: connect timed out after 35s
2026-08-10 21:10:49,252 INFO core: Event loop thread started, running loop forever
2026-08-10 21:10:49,553 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 21:10:49,559 INFO core: _init_accounts coroutine started
2026-08-10 21:10:49,559 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 21:10:49,574 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:15:25,969 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 21:15:25,969 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 21:15:25,972 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 21:15:25,974 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 21:15:25,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:20:39,696 INFO core: Event loop thread started, running loop forever
2026-08-10 21:20:39,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 21:20:40,001 INFO core: _init_accounts coroutine started
2026-08-10 21:20:40,002 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 21:20:40,009 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:25:37,250 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:30:27,495 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 21:30:27,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:35:23,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:40:48,642 INFO core: Event loop thread started, running loop forever
2026-08-10 21:40:48,946 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 21:40:48,952 INFO core: _init_accounts coroutine started
2026-08-10 21:40:48,953 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 21:40:48,961 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:45:27,200 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:50:11,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 21:55:22,497 INFO core: Event loop thread started, running loop forever
2026-08-10 21:55:22,798 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 21:55:22,802 INFO core: _init_accounts coroutine started
2026-08-10 21:55:22,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 21:55:22,817 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:00:27,180 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 22:00:27,189 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:05:03,957 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:10:18,508 INFO core: Event loop thread started, running loop forever
2026-08-10 22:10:18,808 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 22:10:18,812 INFO core: _init_accounts coroutine started
2026-08-10 22:10:18,814 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 22:10:18,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:15:40,346 INFO core: Event loop thread started, running loop forever
2026-08-10 22:15:40,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 22:15:40,651 INFO core: _init_accounts coroutine started
2026-08-10 22:15:40,651 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 22:15:40,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:20:35,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:25:41,352 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 22:25:41,353 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 22:25:41,353 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-10 22:25:44,605 INFO core: Event loop thread started, running loop forever
2026-08-10 22:25:44,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 22:25:44,914 INFO core: _init_accounts coroutine started
2026-08-10 22:25:44,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 22:25:44,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:30:30,159 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:35:10,063 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 22:35:10,064 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 22:35:10,066 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 22:35:10,067 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 22:35:10,080 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 22:35:10,081 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 22:35:10,087 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 22:35:10,088 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-10 22:35:10,090 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:40:17,390 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-10 22:40:17,391 WARNING core: Account 1: connect timed out after 35s
2026-08-10 22:40:17,391 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-10 22:40:17,392 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-10 22:40:49,248 INFO core: Event loop thread started, running loop forever
2026-08-10 22:40:49,549 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 22:40:49,557 INFO core: _init_accounts coroutine started
2026-08-10 22:40:49,557 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 22:40:49,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:45:26,011 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:50:09,450 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 22:50:09,454 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 22:50:09,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 22:55:03,040 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 22:55:03,053 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 22:55:03,057 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:00:09,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 23:00:09,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 23:00:09,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-10 23:00:17,048 INFO core: Event loop thread started, running loop forever
2026-08-10 23:00:17,349 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 23:00:17,354 INFO core: _init_accounts coroutine started
2026-08-10 23:00:17,356 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 23:00:17,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 23:00:17,371 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 23:00:17,372 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 23:00:17,373 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 23:00:17,379 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:05:46,259 INFO core: Event loop thread started, running loop forever
2026-08-10 23:05:46,560 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 23:05:46,564 INFO core: _init_accounts coroutine started
2026-08-10 23:05:46,564 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 23:05:46,583 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:10:47,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 23:10:47,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 23:10:47,442 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:10:47,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-10 23:15:24,907 INFO core: _init_accounts_inner: reloading LLM config
2026-08-10 23:15:24,909 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:20:21,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:25:24,776 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-10 23:25:24,776 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-10 23:25:24,779 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:30:30,410 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-10 23:30:50,199 INFO core: Event loop thread started, running loop forever
2026-08-10 23:30:50,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 23:30:50,506 INFO core: _init_accounts coroutine started
2026-08-10 23:30:50,507 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 23:30:50,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:35:35,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:40:42,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-10 23:40:42,456 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-10 23:40:46,351 INFO core: Event loop thread started, running loop forever
2026-08-10 23:40:46,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 23:40:46,657 INFO core: _init_accounts coroutine started
2026-08-10 23:40:46,657 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 23:40:46,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:45:19,402 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-10 23:45:19,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:50:15,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-10 23:55:51,774 INFO core: Event loop thread started, running loop forever
2026-08-10 23:55:52,075 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-10 23:55:52,079 INFO core: _init_accounts coroutine started
2026-08-10 23:55:52,080 INFO core: _init_accounts_inner: starting DB migrations
2026-08-10 23:55:52,088 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:00:30,821 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:05:03,395 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 00:05:03,441 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:10:25,958 INFO core: Event loop thread started, running loop forever
2026-08-11 00:10:26,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 00:10:26,264 INFO core: _init_accounts coroutine started
2026-08-11 00:10:26,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 00:10:26,274 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:15:07,262 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:20:16,285 INFO core: Event loop thread started, running loop forever
2026-08-11 00:20:16,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 00:20:16,590 INFO core: _init_accounts coroutine started
2026-08-11 00:20:16,590 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 00:20:16,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:25:05,137 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:30:10,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 00:30:10,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 00:30:46,379 INFO core: Event loop thread started, running loop forever
2026-08-11 00:30:46,680 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 00:30:46,684 INFO core: _init_accounts coroutine started
2026-08-11 00:30:46,684 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 00:30:46,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:35:37,934 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 00:35:37,935 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 00:35:37,937 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 00:35:37,938 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:40:17,669 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 00:40:17,677 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:45:43,943 INFO core: Event loop thread started, running loop forever
2026-08-11 00:45:44,244 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 00:45:44,253 INFO core: _init_accounts coroutine started
2026-08-11 00:45:44,253 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 00:45:44,257 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:50:08,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 00:50:08,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 00:50:08,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 00:50:08,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 00:55:08,928 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 00:55:08,939 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:00:46,535 INFO core: Event loop thread started, running loop forever
2026-08-11 01:00:46,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 01:00:46,840 INFO core: _init_accounts coroutine started
2026-08-11 01:00:46,841 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 01:00:46,856 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:05:46,004 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:10:28,543 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:10:28,544 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 01:10:28,544 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 01:15:35,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 01:15:35,442 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-11 01:15:40,492 INFO core: Event loop thread started, running loop forever
2026-08-11 01:15:40,793 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 01:15:40,799 INFO core: _init_accounts coroutine started
2026-08-11 01:15:40,799 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 01:15:40,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:20:16,971 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 01:20:16,971 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 01:20:16,974 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 01:20:16,977 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 01:20:16,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:20:16,986 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 01:20:16,987 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 01:20:16,991 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 01:20:16,992 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 01:25:22,389 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 01:25:22,390 WARNING core: Account 1: connect timed out after 35s
2026-08-11 01:25:22,391 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-11 01:25:22,391 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-11 01:25:22,392 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-11 01:25:22,393 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-11 01:25:22,393 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-11 01:25:34,695 INFO core: Event loop thread started, running loop forever
2026-08-11 01:25:34,996 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 01:25:35,003 INFO core: _init_accounts coroutine started
2026-08-11 01:25:35,003 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 01:25:35,014 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:30:13,754 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 01:30:13,754 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 01:30:13,756 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 01:30:13,759 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 01:30:13,760 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:35:25,198 INFO core: Event loop thread started, running loop forever
2026-08-11 01:35:25,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 01:35:25,503 INFO core: _init_accounts coroutine started
2026-08-11 01:35:25,504 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 01:35:25,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:40:25,410 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 01:40:25,418 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:45:49,391 INFO core: Event loop thread started, running loop forever
2026-08-11 01:45:49,692 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 01:45:49,696 INFO core: _init_accounts coroutine started
2026-08-11 01:45:49,697 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 01:45:49,706 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:50:12,791 INFO core: Event loop thread started, running loop forever
2026-08-11 01:50:13,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 01:50:13,098 INFO core: _init_accounts coroutine started
2026-08-11 01:50:13,098 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 01:50:13,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 01:50:55,850 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 01:55:13,995 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-11 01:55:14,005 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-11 02:00:19,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:05:15,570 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-11 02:05:15,572 INFO core: _init_accounts coroutine started
2026-08-11 02:05:15,572 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 02:05:15,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:10:22,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 02:10:22,407 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 02:10:49,639 INFO core: Event loop thread started, running loop forever
2026-08-11 02:10:49,940 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 02:10:49,945 INFO core: _init_accounts coroutine started
2026-08-11 02:10:49,946 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 02:10:49,956 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:15:15,792 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 02:15:15,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 02:15:15,798 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:20:19,184 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 02:20:19,191 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 02:20:19,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:25:26,376 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 02:25:26,378 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 02:25:26,378 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 02:25:32,967 INFO core: Event loop thread started, running loop forever
2026-08-11 02:25:33,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 02:25:33,273 INFO core: _init_accounts coroutine started
2026-08-11 02:25:33,273 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 02:25:33,284 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:30:04,249 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 02:30:04,250 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 02:30:04,259 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 02:30:04,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:35:11,430 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 02:35:44,209 INFO core: Event loop thread started, running loop forever
2026-08-11 02:35:44,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 02:35:44,515 INFO core: _init_accounts coroutine started
2026-08-11 02:35:44,515 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 02:35:44,529 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:40:33,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:45:08,363 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 02:45:38,902 INFO core: Event loop thread started, running loop forever
2026-08-11 02:45:39,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 02:45:39,207 INFO core: _init_accounts coroutine started
2026-08-11 02:45:39,208 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 02:45:39,214 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:50:12,476 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 02:50:12,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 02:55:27,004 INFO core: Event loop thread started, running loop forever
2026-08-11 02:55:27,305 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 02:55:27,310 INFO core: _init_accounts coroutine started
2026-08-11 02:55:27,311 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 02:55:27,326 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:00:22,598 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 03:00:22,598 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 03:00:22,602 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 03:00:22,604 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 03:00:22,612 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:10:23,834 INFO core: Event loop thread started, running loop forever
2026-08-11 03:10:24,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:10:24,139 INFO core: _init_accounts coroutine started
2026-08-11 03:10:24,141 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:10:24,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:15:08,712 INFO core: Event loop thread started, running loop forever
2026-08-11 03:15:09,013 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:15:09,018 INFO core: _init_accounts coroutine started
2026-08-11 03:15:09,018 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:15:09,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:20:15,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 03:20:43,822 INFO core: Event loop thread started, running loop forever
2026-08-11 03:20:44,123 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:20:44,129 INFO core: _init_accounts coroutine started
2026-08-11 03:20:44,129 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:20:44,140 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:25:11,568 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 03:25:11,621 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:30:24,837 INFO core: Event loop thread started, running loop forever
2026-08-11 03:30:25,138 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:30:25,144 INFO core: _init_accounts coroutine started
2026-08-11 03:30:25,144 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:30:25,158 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:35:44,269 INFO core: Event loop thread started, running loop forever
2026-08-11 03:35:44,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:35:44,574 INFO core: _init_accounts coroutine started
2026-08-11 03:35:44,574 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:35:44,595 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 03:35:44,595 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 03:35:44,596 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 03:35:44,598 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:40:14,279 INFO core: Event loop thread started, running loop forever
2026-08-11 03:40:14,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:40:14,586 INFO core: _init_accounts coroutine started
2026-08-11 03:40:14,587 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:40:14,595 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:45:10,959 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 03:45:10,960 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 03:45:10,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:45:10,963 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 03:50:38,957 INFO core: Event loop thread started, running loop forever
2026-08-11 03:50:39,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:50:39,262 INFO core: _init_accounts coroutine started
2026-08-11 03:50:39,263 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:50:39,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:55:19,690 INFO core: Event loop thread started, running loop forever
2026-08-11 03:55:19,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 03:55:19,995 INFO core: _init_accounts coroutine started
2026-08-11 03:55:19,996 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 03:55:20,013 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 03:55:46,723 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 04:00:27,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 04:00:27,987 INFO core: Event loop thread started, running loop forever
2026-08-11 04:00:28,288 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 04:00:28,293 INFO core: _init_accounts coroutine started
2026-08-11 04:00:28,293 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 04:00:28,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:05:42,955 INFO core: Event loop thread started, running loop forever
2026-08-11 04:05:43,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 04:05:43,263 INFO core: _init_accounts coroutine started
2026-08-11 04:05:43,264 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 04:05:43,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:10:49,180 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 04:10:49,180 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 04:10:49,182 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:10:49,183 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 04:15:25,754 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 04:15:25,759 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:20:06,603 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:25:43,592 INFO core: Event loop thread started, running loop forever
2026-08-11 04:25:43,893 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 04:25:43,900 INFO core: _init_accounts coroutine started
2026-08-11 04:25:43,901 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 04:25:43,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:30:29,488 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 04:30:29,490 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 04:30:29,492 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 04:30:29,494 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 04:30:29,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:35:28,102 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 04:35:28,103 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 04:35:28,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:40:10,115 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 04:40:10,116 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 04:40:10,166 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:45:17,456 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 04:45:17,461 WARNING core: Account 1: connect timed out after 35s
2026-08-11 04:45:32,090 INFO core: Event loop thread started, running loop forever
2026-08-11 04:45:32,391 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 04:45:32,395 INFO core: _init_accounts coroutine started
2026-08-11 04:45:32,396 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 04:45:32,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:50:39,371 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 04:50:39,501 INFO core: Event loop thread started, running loop forever
2026-08-11 04:50:39,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 04:50:39,811 INFO core: _init_accounts coroutine started
2026-08-11 04:50:39,811 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 04:50:39,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 04:55:51,230 INFO core: Event loop thread started, running loop forever
2026-08-11 04:55:51,532 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 04:55:51,539 INFO core: _init_accounts coroutine started
2026-08-11 04:55:51,539 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 04:55:51,550 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:00:10,229 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 05:00:10,250 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:05:42,260 INFO core: Event loop thread started, running loop forever
2026-08-11 05:05:42,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 05:05:42,566 INFO core: _init_accounts coroutine started
2026-08-11 05:05:42,568 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 05:05:42,575 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 05:05:42,575 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 05:05:42,577 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 05:05:42,580 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 05:05:42,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:05:42,591 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 05:05:42,592 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 05:10:09,180 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:15:35,796 INFO core: Event loop thread started, running loop forever
2026-08-11 05:15:36,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 05:15:36,101 INFO core: _init_accounts coroutine started
2026-08-11 05:15:36,102 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 05:15:36,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:20:25,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:25:09,495 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 05:25:09,496 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 05:25:09,500 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:30:13,843 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 05:30:13,846 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:35:23,577 INFO core: Event loop thread started, running loop forever
2026-08-11 05:35:23,878 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 05:35:23,884 INFO core: _init_accounts coroutine started
2026-08-11 05:35:23,885 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 05:35:23,894 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:40:12,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:45:09,001 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 05:45:09,002 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 05:45:09,005 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:50:16,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 05:50:27,754 INFO core: Event loop thread started, running loop forever
2026-08-11 05:50:28,055 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 05:50:28,062 INFO core: _init_accounts coroutine started
2026-08-11 05:50:28,062 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 05:50:28,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 05:55:08,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:00:15,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 06:00:15,457 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 06:00:29,627 INFO core: Event loop thread started, running loop forever
2026-08-11 06:00:29,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 06:00:29,933 INFO core: _init_accounts coroutine started
2026-08-11 06:00:29,933 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 06:00:29,943 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:05:04,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:10:14,282 INFO core: Event loop thread started, running loop forever
2026-08-11 06:10:14,583 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 06:10:14,587 INFO core: _init_accounts coroutine started
2026-08-11 06:10:14,588 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 06:10:14,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:15:12,484 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 06:15:25,779 INFO core: Event loop thread started, running loop forever
2026-08-11 06:15:26,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 06:15:26,085 INFO core: _init_accounts coroutine started
2026-08-11 06:15:26,085 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 06:15:26,102 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 06:15:26,103 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 06:15:26,106 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 06:15:26,115 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:20:29,333 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 06:20:29,340 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:25:14,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:30:26,982 INFO core: Event loop thread started, running loop forever
2026-08-11 06:30:27,283 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 06:30:27,287 INFO core: _init_accounts coroutine started
2026-08-11 06:30:27,288 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 06:30:27,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:35:14,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:40:47,099 INFO core: Event loop thread started, running loop forever
2026-08-11 06:40:47,400 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 06:40:47,406 INFO core: _init_accounts coroutine started
2026-08-11 06:40:47,406 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 06:40:47,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:45:04,955 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 06:45:04,957 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 06:45:04,959 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 06:45:04,959 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:50:44,873 INFO core: Event loop thread started, running loop forever
2026-08-11 06:50:45,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 06:50:45,178 INFO core: _init_accounts coroutine started
2026-08-11 06:50:45,179 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 06:50:45,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:55:18,822 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 06:55:18,823 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 06:55:18,823 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 07:00:12,240 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:05:09,695 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 07:05:09,695 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 07:05:09,722 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:10:15,409 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 07:10:52,348 INFO core: Event loop thread started, running loop forever
2026-08-11 07:10:52,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 07:10:52,653 INFO core: _init_accounts coroutine started
2026-08-11 07:10:52,653 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 07:10:52,664 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:15:13,962 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 07:15:13,962 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 07:15:13,968 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:20:19,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 07:20:46,736 INFO core: Event loop thread started, running loop forever
2026-08-11 07:20:47,037 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 07:20:47,043 INFO core: _init_accounts coroutine started
2026-08-11 07:20:47,044 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 07:20:47,053 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:25:35,268 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 07:25:35,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:30:09,353 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:35:36,250 INFO core: Event loop thread started, running loop forever
2026-08-11 07:35:36,551 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 07:35:36,556 INFO core: _init_accounts coroutine started
2026-08-11 07:35:36,558 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 07:35:36,569 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:40:24,372 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 07:40:24,373 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 07:40:24,376 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 07:40:24,378 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 07:40:24,379 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:45:37,382 INFO core: Event loop thread started, running loop forever
2026-08-11 07:45:37,683 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 07:45:37,688 INFO core: _init_accounts coroutine started
2026-08-11 07:45:37,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 07:45:37,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:50:31,103 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 07:50:31,104 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 07:50:31,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 07:50:31,108 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 07:50:31,118 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 07:55:33,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:00:31,089 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 08:00:31,090 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 08:00:31,098 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:05:38,395 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 08:05:41,684 INFO core: Event loop thread started, running loop forever
2026-08-11 08:05:41,985 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 08:05:41,990 INFO core: _init_accounts coroutine started
2026-08-11 08:05:41,990 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 08:05:42,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:10:18,952 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 08:10:18,954 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:10:18,954 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 08:15:37,768 INFO core: Event loop thread started, running loop forever
2026-08-11 08:15:38,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 08:15:38,074 INFO core: _init_accounts coroutine started
2026-08-11 08:15:38,075 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 08:15:38,090 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:20:15,111 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 08:20:15,111 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 08:20:15,115 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 08:20:15,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:20:15,121 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 08:25:03,575 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:30:10,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 08:30:10,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 08:30:20,397 INFO core: Event loop thread started, running loop forever
2026-08-11 08:30:20,699 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 08:30:20,706 INFO core: _init_accounts coroutine started
2026-08-11 08:30:20,707 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 08:30:20,713 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:35:21,698 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 08:35:21,698 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 08:35:21,699 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 08:35:21,703 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:35:21,704 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 08:40:06,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:45:37,550 INFO core: Event loop thread started, running loop forever
2026-08-11 08:45:37,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 08:45:37,854 INFO core: _init_accounts coroutine started
2026-08-11 08:45:37,855 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 08:45:37,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:50:44,394 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 08:50:46,831 INFO core: Event loop thread started, running loop forever
2026-08-11 08:50:47,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 08:50:47,141 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 08:55:47,119 INFO core: _init_accounts coroutine started
2026-08-11 08:55:47,120 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 08:55:47,127 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:00:35,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:05:36,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:10:51,490 INFO core: Event loop thread started, running loop forever
2026-08-11 09:10:51,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 09:10:51,798 INFO core: _init_accounts coroutine started
2026-08-11 09:10:51,798 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 09:10:51,818 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 09:10:51,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 09:10:51,823 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 09:10:51,827 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 09:10:51,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:15:18,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:20:45,531 INFO core: Event loop thread started, running loop forever
2026-08-11 09:20:45,832 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 09:20:45,837 INFO core: _init_accounts coroutine started
2026-08-11 09:20:45,838 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 09:20:45,848 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:25:32,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:30:38,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 09:30:38,411 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 09:30:38,412 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-11 09:30:38,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 09:30:38,413 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-11 09:30:38,413 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 09:30:38,413 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-11 09:30:38,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 09:30:38,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 09:30:48,137 INFO core: Event loop thread started, running loop forever
2026-08-11 09:30:48,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 09:30:48,442 INFO core: _init_accounts coroutine started
2026-08-11 09:30:48,443 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 09:30:48,453 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:35:29,963 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 09:35:29,964 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 09:35:29,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:40:36,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 09:40:36,393 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-11 09:40:41,124 INFO core: Event loop thread started, running loop forever
2026-08-11 09:40:41,425 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 09:40:41,428 INFO core: _init_accounts coroutine started
2026-08-11 09:40:41,431 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 09:40:41,441 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:45:11,091 INFO core: Event loop thread started, running loop forever
2026-08-11 09:45:11,392 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 09:45:11,396 INFO core: _init_accounts coroutine started
2026-08-11 09:45:11,397 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 09:45:11,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:45:47,166 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 09:50:17,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 09:50:20,277 INFO core: Event loop thread started, running loop forever
2026-08-11 09:50:20,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 09:50:20,582 INFO core: _init_accounts coroutine started
2026-08-11 09:50:20,582 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 09:50:20,595 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 09:55:41,329 INFO core: Event loop thread started, running loop forever
2026-08-11 09:55:41,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 09:55:41,636 INFO core: _init_accounts coroutine started
2026-08-11 09:55:41,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 09:55:41,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:00:37,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:05:06,463 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 10:05:06,475 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:10:52,232 INFO core: Event loop thread started, running loop forever
2026-08-11 10:10:52,533 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 10:10:52,537 INFO core: _init_accounts coroutine started
2026-08-11 10:10:52,538 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 10:10:52,551 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:15:17,820 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 10:15:17,822 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 10:15:17,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:20:23,406 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 10:20:23,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 10:20:35,933 INFO core: Event loop thread started, running loop forever
2026-08-11 10:20:36,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 10:20:36,242 INFO core: _init_accounts coroutine started
2026-08-11 10:20:36,243 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 10:20:36,253 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:25:27,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 10:25:27,574 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 10:25:27,580 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 10:25:27,581 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:30:15,683 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 10:30:15,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:35:03,757 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 10:35:03,758 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 10:35:03,771 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 10:35:03,772 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 10:35:03,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:40:09,448 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 10:40:40,882 INFO core: Event loop thread started, running loop forever
2026-08-11 10:40:41,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 10:40:41,188 INFO core: _init_accounts coroutine started
2026-08-11 10:40:41,189 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 10:40:41,199 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:45:47,375 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-11 10:45:49,587 INFO core: Event loop thread started, running loop forever
2026-08-11 10:45:49,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 10:45:49,892 INFO core: _init_accounts coroutine started
2026-08-11 10:45:49,892 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 10:45:49,903 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:50:32,547 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 10:50:32,547 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 10:50:32,549 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 10:50:32,551 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 10:55:32,247 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 10:55:32,250 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:00:04,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:05:27,368 INFO core: Event loop thread started, running loop forever
2026-08-11 11:05:27,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 11:05:27,673 INFO core: _init_accounts coroutine started
2026-08-11 11:05:27,674 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 11:05:27,683 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:10:25,031 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 11:10:25,044 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:15:06,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:20:24,706 INFO core: Event loop thread started, running loop forever
2026-08-11 11:20:25,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 11:20:25,011 INFO core: _init_accounts coroutine started
2026-08-11 11:20:25,012 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 11:20:25,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:25:47,307 INFO core: Event loop thread started, running loop forever
2026-08-11 11:25:47,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 11:25:47,612 INFO core: _init_accounts coroutine started
2026-08-11 11:25:47,612 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 11:25:47,621 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:30:04,185 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 11:30:04,186 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 11:30:04,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:30:04,195 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 11:35:10,428 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 11:35:10,429 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-11 11:35:10,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 11:35:10,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 11:35:26,329 INFO core: Event loop thread started, running loop forever
2026-08-11 11:35:26,635 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 11:35:26,640 INFO core: _init_accounts coroutine started
2026-08-11 11:35:26,640 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 11:35:26,649 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:40:33,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 11:40:40,857 INFO core: Event loop thread started, running loop forever
2026-08-11 11:40:41,158 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 11:40:41,164 INFO core: _init_accounts coroutine started
2026-08-11 11:40:41,164 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 11:40:41,170 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:45:04,117 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:45:10,143 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 11:50:44,497 INFO core: Event loop thread started, running loop forever
2026-08-11 11:50:44,798 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 11:50:44,803 INFO core: _init_accounts coroutine started
2026-08-11 11:50:44,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 11:50:44,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 11:55:09,418 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 11:55:09,464 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:00:11,136 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:05:18,742 INFO core: Event loop thread started, running loop forever
2026-08-11 12:05:19,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 12:05:19,048 INFO core: _init_accounts coroutine started
2026-08-11 12:05:19,049 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 12:05:19,060 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 12:05:19,060 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 12:05:19,062 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 12:05:19,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:10:35,549 INFO core: Event loop thread started, running loop forever
2026-08-11 12:10:35,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 12:10:35,859 INFO core: _init_accounts coroutine started
2026-08-11 12:10:35,860 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 12:10:35,873 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:15:49,854 INFO core: Event loop thread started, running loop forever
2026-08-11 12:15:50,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 12:15:50,161 INFO core: _init_accounts coroutine started
2026-08-11 12:15:50,161 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 12:15:50,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:20:13,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:25:23,293 INFO core: Event loop thread started, running loop forever
2026-08-11 12:25:23,593 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 12:25:23,597 INFO core: _init_accounts coroutine started
2026-08-11 12:25:23,599 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 12:25:23,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:30:26,654 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 12:30:26,655 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 12:30:26,668 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 12:30:26,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:35:43,477 INFO core: Event loop thread started, running loop forever
2026-08-11 12:35:43,778 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 12:35:43,783 INFO core: _init_accounts coroutine started
2026-08-11 12:35:43,784 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 12:35:43,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:40:50,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 12:40:52,898 INFO core: Event loop thread started, running loop forever
2026-08-11 12:40:53,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 12:40:53,206 INFO core: _init_accounts coroutine started
2026-08-11 12:40:53,207 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 12:40:53,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:45:48,496 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:50:30,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 12:55:32,515 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 12:55:32,517 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 12:55:32,525 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:00:11,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:05:07,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:10:09,688 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 13:10:09,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:15:04,420 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:20:10,428 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 13:20:51,483 INFO core: Event loop thread started, running loop forever
2026-08-11 13:20:51,784 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 13:20:51,791 INFO core: _init_accounts coroutine started
2026-08-11 13:20:51,792 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 13:20:51,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:25:49,312 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:30:44,446 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:35:37,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:40:09,456 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 13:40:09,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:45:39,514 INFO core: Event loop thread started, running loop forever
2026-08-11 13:45:39,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 13:45:39,820 INFO core: _init_accounts coroutine started
2026-08-11 13:45:39,821 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 13:45:39,833 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:50:16,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 13:55:23,374 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 13:55:23,885 INFO core: Event loop thread started, running loop forever
2026-08-11 13:55:24,186 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 13:55:24,191 INFO core: _init_accounts coroutine started
2026-08-11 13:55:24,191 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 13:55:24,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:00:10,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 14:00:35,010 INFO core: Event loop thread started, running loop forever
2026-08-11 14:00:35,311 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 14:00:35,316 INFO core: _init_accounts coroutine started
2026-08-11 14:00:35,317 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 14:00:35,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:05:16,326 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 14:05:16,326 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 14:05:16,328 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 14:05:16,332 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 14:05:16,345 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:10:32,840 INFO core: Event loop thread started, running loop forever
2026-08-11 14:10:33,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 14:10:33,147 INFO core: _init_accounts coroutine started
2026-08-11 14:10:33,147 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 14:10:33,153 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:15:09,085 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 14:15:09,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 14:15:09,092 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 14:15:09,096 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 14:15:09,112 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 14:15:09,113 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 14:15:09,120 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 14:15:09,121 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 14:15:09,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:20:12,938 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 14:20:12,939 WARNING core: Account 1: connect timed out after 35s
2026-08-11 14:20:12,939 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-11 14:20:12,940 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-11 14:20:12,941 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-11 14:20:12,942 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-11 14:20:12,943 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-11 14:20:12,954 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:25:49,099 INFO core: Event loop thread started, running loop forever
2026-08-11 14:25:49,400 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 14:25:49,406 INFO core: _init_accounts coroutine started
2026-08-11 14:25:49,408 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 14:25:49,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:30:09,964 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 14:30:09,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 14:30:09,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:35:16,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 14:35:16,398 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-11 14:35:41,369 INFO core: Event loop thread started, running loop forever
2026-08-11 14:35:41,670 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 14:35:41,678 INFO core: _init_accounts coroutine started
2026-08-11 14:35:41,679 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 14:35:41,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:40:48,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 14:40:51,282 INFO core: Event loop thread started, running loop forever
2026-08-11 14:40:51,583 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 14:40:51,591 INFO core: _init_accounts coroutine started
2026-08-11 14:40:51,593 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 14:40:51,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:45:23,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:50:25,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 14:50:25,693 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 14:50:25,699 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 14:50:25,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 14:55:31,443 INFO core: Event loop thread started, running loop forever
2026-08-11 14:55:31,744 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 14:55:31,754 INFO core: _init_accounts coroutine started
2026-08-11 14:55:31,754 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 14:55:31,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:00:45,491 INFO core: Event loop thread started, running loop forever
2026-08-11 15:00:45,792 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 15:00:45,796 INFO core: _init_accounts coroutine started
2026-08-11 15:00:45,797 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 15:00:45,811 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:05:42,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:10:34,745 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 15:10:34,745 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 15:10:34,753 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:15:06,333 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 15:15:06,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:20:43,221 INFO core: Event loop thread started, running loop forever
2026-08-11 15:20:43,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 15:20:43,527 INFO core: _init_accounts coroutine started
2026-08-11 15:20:43,527 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 15:20:43,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:25:17,764 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:30:23,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 15:30:23,407 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 15:30:23,407 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-11 15:30:23,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 15:30:23,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-11 15:30:23,408 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 15:30:23,409 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-11 15:30:23,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 15:30:23,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 15:30:43,300 INFO core: Event loop thread started, running loop forever
2026-08-11 15:30:43,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 15:30:43,611 INFO core: _init_accounts coroutine started
2026-08-11 15:30:43,611 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 15:30:43,621 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:35:22,053 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 15:35:22,054 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 15:35:22,057 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 15:35:22,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:40:28,444 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 15:40:28,444 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-11 15:40:28,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 15:40:28,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 15:40:40,073 INFO core: Event loop thread started, running loop forever
2026-08-11 15:40:40,374 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 15:40:40,379 INFO core: _init_accounts coroutine started
2026-08-11 15:40:40,379 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 15:40:40,391 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:45:47,192 INFO core: Event loop thread started, running loop forever
2026-08-11 15:45:47,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 15:45:47,499 INFO core: _init_accounts coroutine started
2026-08-11 15:45:47,499 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 15:45:47,505 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:50:20,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:50:44,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 15:50:44,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 15:50:44,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 15:50:44,397 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 15:50:52,013 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 15:50:53,379 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 15:50:53,379 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 15:50:53,389 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 15:50:53,390 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 15:50:54,189 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-11 15:54:13,290 WARNING core: Account 1: connect timed out after 35s
2026-08-11 15:54:13,293 INFO core: Account 1 connected and authorized via 91.108.56.178
2026-08-11 15:54:13,319 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-11 15:54:13,320 INFO core: Handlers installed for account 1
2026-08-11 15:54:13,321 INFO core: Initialized 1 account(s), 1 pair(s)
2026-08-11 15:54:13,322 INFO core: Memory RSS: 90.25 MB
2026-08-11 15:54:31,492 INFO telethon.network.mtprotosender: Connecting to 149.154.167.51:443/TcpAbridged...
2026-08-11 15:54:32,686 INFO core: Saved 344 dialog(s) to cache (account 1)
2026-08-11 15:54:34,494 INFO telethon.network.mtprotosender: Connection to 149.154.167.51:443/TcpAbridged complete!
2026-08-11 15:54:35,111 INFO telethon.client.users: Phone migrated to 5
2026-08-11 15:54:35,264 INFO telethon.client.telegrambaseclient: Reconnecting to new data center 5
2026-08-11 15:54:35,417 INFO telethon.network.mtprotosender: Disconnecting from 149.154.167.51:443/TcpAbridged...
2026-08-11 15:54:35,418 INFO telethon.network.mtprotosender: Disconnection from 149.154.167.51:443/TcpAbridged complete!
2026-08-11 15:54:35,418 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 15:54:38,081 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-11 15:55:07,376 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-11 15:55:07,382 INFO core: status() clients=1 connected=True forwarding=True
2026-08-11 15:55:09,986 INFO core: Signed in as user_id=7141276568 (account_id=2)
2026-08-11 15:55:10,001 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-11 15:55:13,936 INFO core: Memory RSS: 95.55 MB
2026-08-11 15:55:14,863 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-11 15:55:19,045 INFO core: Saved 237 dialog(s) to cache (account 2)
2026-08-11 16:00:26,420 INFO core: Memory RSS: 96.84 MB
2026-08-11 16:00:26,421 WARNING telethon.network.mtprotostate: Server sent a very old message with ID 7672865115632514049, ignoring (see FAQ for details)
2026-08-11 16:00:26,450 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-11 16:00:30,821 INFO core: Event loop thread started, running loop forever
2026-08-11 16:00:31,122 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 16:00:31,126 INFO core: _init_accounts coroutine started
2026-08-11 16:00:31,136 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 16:00:31,141 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:02:28,414 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 16:02:28,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:05:41,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:10:46,856 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-11 16:10:46,856 INFO core: _init_accounts coroutine started
2026-08-11 16:10:46,857 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 16:10:46,861 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 16:10:46,861 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 16:10:46,863 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 16:10:46,865 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 16:10:46,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:15:49,901 INFO core: Event loop thread started, running loop forever
2026-08-11 16:15:50,202 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 16:15:50,215 INFO core: _init_accounts coroutine started
2026-08-11 16:15:50,216 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 16:15:50,220 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:20:21,613 INFO core: Event loop thread started, running loop forever
2026-08-11 16:20:21,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 16:20:21,918 INFO core: _init_accounts coroutine started
2026-08-11 16:20:21,919 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 16:20:21,932 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 16:20:21,932 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 16:20:21,933 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 16:20:21,937 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 16:20:21,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:25:04,351 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 16:25:04,351 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 16:25:04,358 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 16:25:04,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:25:04,361 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 16:30:11,402 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 16:30:11,403 WARNING core: Account 1: connect timed out after 35s
2026-08-11 16:30:11,404 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-11 16:30:11,404 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-11 16:30:11,406 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-11 16:30:11,407 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-11 16:30:11,408 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-11 16:30:47,398 INFO core: Event loop thread started, running loop forever
2026-08-11 16:30:47,699 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 16:30:47,703 INFO core: _init_accounts coroutine started
2026-08-11 16:30:47,705 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 16:30:47,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:35:29,722 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 16:35:29,723 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 16:35:29,728 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 16:35:29,729 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:40:05,839 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 16:40:05,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:45:21,308 INFO core: Event loop thread started, running loop forever
2026-08-11 16:45:21,609 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 16:45:21,614 INFO core: _init_accounts coroutine started
2026-08-11 16:45:21,615 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 16:45:21,621 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:50:13,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 16:55:13,781 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 16:55:13,782 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 16:55:13,786 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:00:24,654 INFO core: Event loop thread started, running loop forever
2026-08-11 17:00:24,955 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 17:00:24,960 INFO core: _init_accounts coroutine started
2026-08-11 17:00:24,961 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 17:00:24,976 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 17:00:24,976 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 17:00:24,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:00:24,979 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 17:05:16,702 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 17:05:16,708 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:10:22,453 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 17:10:22,453 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 17:10:22,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 17:10:37,469 INFO core: Event loop thread started, running loop forever
2026-08-11 17:10:37,770 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 17:10:37,775 INFO core: _init_accounts coroutine started
2026-08-11 17:10:37,776 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 17:10:37,784 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:15:22,727 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:20:15,347 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 17:20:15,347 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 17:20:15,355 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 17:20:15,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:25:19,576 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 17:25:19,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:30:50,719 INFO core: Event loop thread started, running loop forever
2026-08-11 17:30:51,020 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 17:30:51,026 INFO core: _init_accounts coroutine started
2026-08-11 17:30:51,027 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 17:30:51,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:35:29,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:40:36,463 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 17:40:36,464 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 17:40:46,265 INFO core: Event loop thread started, running loop forever
2026-08-11 17:40:46,566 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 17:40:46,570 INFO core: _init_accounts coroutine started
2026-08-11 17:40:46,571 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 17:40:46,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:45:10,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 17:45:13,424 INFO core: Event loop thread started, running loop forever
2026-08-11 17:45:13,728 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 17:45:13,733 INFO core: _init_accounts coroutine started
2026-08-11 17:45:13,733 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 17:45:13,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:50:33,095 INFO core: Event loop thread started, running loop forever
2026-08-11 17:50:33,396 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 17:50:33,400 INFO core: _init_accounts coroutine started
2026-08-11 17:50:33,400 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 17:50:33,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 17:50:33,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 17:50:33,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 17:50:33,422 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 17:55:17,523 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 17:55:17,555 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:00:24,737 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 18:00:24,738 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 18:00:32,139 INFO core: Event loop thread started, running loop forever
2026-08-11 18:00:32,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 18:00:32,445 INFO core: _init_accounts coroutine started
2026-08-11 18:00:32,446 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 18:00:32,455 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:05:03,798 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 18:05:03,798 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 18:05:03,809 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 18:05:03,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:10:04,209 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 18:10:04,228 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 18:10:04,228 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 18:10:04,238 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:10:04,244 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 18:10:04,245 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 18:15:11,467 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 18:15:11,468 WARNING core: Account 1: connect timed out after 35s
2026-08-11 18:15:11,469 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-11 18:15:11,469 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-11 18:15:11,470 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-11 18:15:11,471 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-11 18:15:11,472 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-11 18:15:25,477 INFO core: Event loop thread started, running loop forever
2026-08-11 18:15:25,778 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 18:15:25,784 INFO core: _init_accounts coroutine started
2026-08-11 18:15:25,785 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 18:15:25,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:20:49,800 INFO core: Event loop thread started, running loop forever
2026-08-11 18:20:50,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 18:20:50,105 INFO core: _init_accounts coroutine started
2026-08-11 18:20:50,106 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 18:20:50,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:25:18,894 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:30:44,778 INFO core: Event loop thread started, running loop forever
2026-08-11 18:30:45,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 18:30:45,084 INFO core: _init_accounts coroutine started
2026-08-11 18:30:45,085 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 18:30:45,093 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:35:12,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:40:52,182 INFO core: Event loop thread started, running loop forever
2026-08-11 18:40:52,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 18:40:52,486 INFO core: _init_accounts coroutine started
2026-08-11 18:40:52,486 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 18:40:52,500 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 18:40:52,501 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 18:40:52,502 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 18:40:52,505 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 18:40:52,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:45:05,079 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:50:36,174 INFO core: Event loop thread started, running loop forever
2026-08-11 18:50:36,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 18:50:36,480 INFO core: _init_accounts coroutine started
2026-08-11 18:50:36,482 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 18:50:36,491 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 18:55:36,289 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 18:55:36,290 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 18:55:36,291 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 18:55:36,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:00:39,959 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 19:00:39,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:05:21,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:10:28,419 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 19:10:28,419 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 19:10:28,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 19:10:51,006 INFO core: Event loop thread started, running loop forever
2026-08-11 19:10:51,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 19:10:51,313 INFO core: _init_accounts coroutine started
2026-08-11 19:10:51,314 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 19:10:51,323 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:15:11,962 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 19:15:11,963 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:15:11,964 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 19:20:42,952 INFO core: Event loop thread started, running loop forever
2026-08-11 19:20:43,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 19:20:43,257 INFO core: _init_accounts coroutine started
2026-08-11 19:20:43,258 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 19:20:43,266 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 19:20:43,267 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 19:20:43,270 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 19:20:43,272 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 19:20:43,273 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:25:25,722 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:30:41,565 INFO core: Event loop thread started, running loop forever
2026-08-11 19:30:41,866 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 19:30:41,870 INFO core: _init_accounts coroutine started
2026-08-11 19:30:41,872 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 19:30:41,883 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:35:30,415 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 19:35:30,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:40:45,726 INFO core: Event loop thread started, running loop forever
2026-08-11 19:40:46,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 19:40:46,034 INFO core: _init_accounts coroutine started
2026-08-11 19:40:46,034 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 19:40:46,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:45:49,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:50:05,130 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 19:55:45,644 INFO core: Event loop thread started, running loop forever
2026-08-11 19:55:45,945 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 19:55:45,950 INFO core: _init_accounts coroutine started
2026-08-11 19:55:45,951 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 19:55:45,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:00:07,523 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 20:00:16,747 INFO core: Event loop thread started, running loop forever
2026-08-11 20:00:17,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 20:00:17,053 INFO core: _init_accounts coroutine started
2026-08-11 20:00:17,053 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 20:00:17,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:05:18,071 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 20:05:18,078 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:10:17,733 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:15:05,593 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-11 20:15:05,597 INFO core: _init_accounts coroutine started
2026-08-11 20:15:05,598 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 20:15:05,614 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 20:15:05,615 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 20:15:05,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:15:05,618 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 20:20:04,345 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 20:20:04,359 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:25:11,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 20:25:21,839 INFO core: Event loop thread started, running loop forever
2026-08-11 20:25:22,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 20:25:22,147 INFO core: _init_accounts coroutine started
2026-08-11 20:25:22,147 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 20:25:22,157 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:30:28,405 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 20:30:38,545 INFO core: Event loop thread started, running loop forever
2026-08-11 20:30:38,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 20:30:38,851 INFO core: _init_accounts coroutine started
2026-08-11 20:30:38,851 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 20:30:38,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:35:13,204 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:35:13,207 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 20:40:20,379 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 20:40:20,379 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-11 20:40:20,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 20:40:27,196 INFO core: Event loop thread started, running loop forever
2026-08-11 20:40:27,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 20:40:27,526 INFO core: _init_accounts coroutine started
2026-08-11 20:40:27,526 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 20:40:27,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:45:48,760 INFO core: Event loop thread started, running loop forever
2026-08-11 20:45:49,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 20:45:49,066 INFO core: _init_accounts coroutine started
2026-08-11 20:45:49,067 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 20:45:49,074 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:50:45,074 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 20:50:45,078 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 20:50:45,078 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 20:50:45,079 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 20:55:51,352 INFO core: Event loop thread started, running loop forever
2026-08-11 20:55:51,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 20:55:51,658 INFO core: _init_accounts coroutine started
2026-08-11 20:55:51,658 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 20:55:51,669 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:00:14,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:00:14,598 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 21:05:21,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 21:05:21,399 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 21:05:21,399 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-11 21:05:21,400 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 21:05:21,400 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-11 21:05:21,400 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 21:05:21,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 21:05:39,851 INFO core: Event loop thread started, running loop forever
2026-08-11 21:05:40,152 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 21:05:40,159 INFO core: _init_accounts coroutine started
2026-08-11 21:05:40,159 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 21:05:40,168 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:10:47,099 INFO core: Event loop thread started, running loop forever
2026-08-11 21:10:47,400 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 21:10:47,405 INFO core: _init_accounts coroutine started
2026-08-11 21:10:47,408 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 21:10:47,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:15:25,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:20:08,328 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 21:20:08,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:25:14,798 INFO core: Event loop thread started, running loop forever
2026-08-11 21:25:15,099 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 21:25:15,107 INFO core: _init_accounts coroutine started
2026-08-11 21:25:15,107 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 21:25:15,115 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:30:22,363 INFO core: Event loop thread started, running loop forever
2026-08-11 21:30:22,668 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 21:30:22,671 INFO core: _init_accounts coroutine started
2026-08-11 21:30:22,672 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 21:30:22,682 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:35:26,769 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:40:11,626 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 21:40:11,627 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 21:40:11,636 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 21:40:11,639 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 21:40:11,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:45:06,079 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 21:45:06,079 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 21:45:06,086 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-11 21:45:06,088 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-11 21:45:06,091 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:50:04,522 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 21:50:04,522 WARNING core: Account 1: connect timed out after 35s
2026-08-11 21:50:04,523 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-11 21:50:04,523 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-11 21:50:04,525 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-11 21:50:04,526 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-11 21:50:04,526 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-11 21:50:04,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 21:55:11,351 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-11 21:55:26,729 INFO core: Event loop thread started, running loop forever
2026-08-11 21:55:27,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 21:55:27,036 INFO core: _init_accounts coroutine started
2026-08-11 21:55:27,037 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 21:55:27,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:00:16,312 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 22:00:16,312 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 22:00:16,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:05:21,839 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 22:05:21,847 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 22:05:21,848 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:10:23,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:15:30,418 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 22:15:32,623 INFO core: Event loop thread started, running loop forever
2026-08-11 22:15:32,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 22:15:32,932 INFO core: _init_accounts coroutine started
2026-08-11 22:15:32,934 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:15:32,940 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 22:20:32,428 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:25:12,324 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 22:25:12,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:30:15,582 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:35:13,140 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-11 22:35:13,141 INFO core: _init_accounts coroutine started
2026-08-11 22:35:13,142 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 22:35:13,147 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:40:11,871 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 22:40:11,871 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 22:40:11,874 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 22:40:11,876 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 22:40:11,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:40:11,885 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 22:45:17,351 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-11 22:45:17,353 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-11 22:45:44,724 INFO core: Event loop thread started, running loop forever
2026-08-11 22:45:45,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 22:45:45,030 INFO core: _init_accounts coroutine started
2026-08-11 22:45:45,031 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 22:45:45,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:50:15,196 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 22:50:15,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 22:50:15,197 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 22:55:21,532 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 22:55:21,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:00:11,177 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:05:07,251 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 23:05:07,259 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:10:14,440 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 23:10:51,305 INFO core: Event loop thread started, running loop forever
2026-08-11 23:10:51,606 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 23:10:51,612 INFO core: _init_accounts coroutine started
2026-08-11 23:10:51,612 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 23:10:51,618 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:15:41,842 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:20:03,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 23:20:03,370 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 23:20:03,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 23:20:03,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:25:50,600 INFO core: Event loop thread started, running loop forever
2026-08-11 23:25:50,901 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 23:25:50,907 INFO core: _init_accounts coroutine started
2026-08-11 23:25:50,916 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 23:25:50,938 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 23:25:50,939 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 23:25:50,941 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 23:25:50,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:25:50,946 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 23:30:34,817 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:35:04,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:40:18,542 INFO core: Event loop thread started, running loop forever
2026-08-11 23:40:18,843 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 23:40:18,847 INFO core: _init_accounts coroutine started
2026-08-11 23:40:18,848 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 23:40:18,882 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:45:07,375 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-11 23:45:47,840 INFO core: Event loop thread started, running loop forever
2026-08-11 23:45:48,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 23:45:48,146 INFO core: _init_accounts coroutine started
2026-08-11 23:45:48,147 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 23:45:48,157 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-11 23:45:48,157 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-11 23:45:48,159 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-11 23:45:48,161 INFO core: _init_accounts_inner: reloading LLM config
2026-08-11 23:45:48,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:50:05,192 INFO core: status() clients=0 connected=False forwarding=False
2026-08-11 23:55:12,332 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-11 23:55:51,818 INFO core: Event loop thread started, running loop forever
2026-08-11 23:55:52,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-11 23:55:52,126 INFO core: _init_accounts coroutine started
2026-08-11 23:55:52,133 INFO core: _init_accounts_inner: starting DB migrations
2026-08-11 23:55:52,140 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:00:36,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:05:18,348 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:10:24,287 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 00:10:24,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:15:48,519 INFO core: Event loop thread started, running loop forever
2026-08-12 00:15:48,820 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 00:15:48,825 INFO core: _init_accounts coroutine started
2026-08-12 00:15:48,825 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 00:15:48,837 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:20:11,236 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 00:20:11,253 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:25:53,572 INFO core: Event loop thread started, running loop forever
2026-08-12 00:25:53,873 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 00:25:53,877 INFO core: _init_accounts coroutine started
2026-08-12 00:25:53,878 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 00:25:53,887 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:30:45,587 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 00:30:45,603 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:35:08,622 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:40:52,475 INFO core: Event loop thread started, running loop forever
2026-08-12 00:40:52,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 00:40:52,781 INFO core: _init_accounts coroutine started
2026-08-12 00:40:52,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 00:40:52,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:45:21,757 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 00:45:21,758 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 00:45:21,758 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:45:21,760 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 00:50:27,392 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 00:50:31,585 INFO core: Event loop thread started, running loop forever
2026-08-12 00:50:31,886 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 00:50:31,896 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 00:50:31,897 INFO core: _init_accounts coroutine started
2026-08-12 00:55:17,088 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 00:55:17,100 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 00:55:17,100 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 00:55:17,101 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 00:55:17,103 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 00:55:17,117 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:00:21,493 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-12 01:00:21,494 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 01:00:21,504 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-12 01:00:21,505 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 01:00:21,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:05:21,118 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 01:05:21,119 WARNING core: Account 1: connect timed out after 35s
2026-08-12 01:05:21,120 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 01:05:21,120 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 01:05:21,122 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 01:05:21,123 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-12 01:05:21,124 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 01:05:21,131 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:10:27,432 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 01:10:27,434 WARNING core: Account 1: connect timed out after 35s
2026-08-12 01:10:40,127 INFO core: Event loop thread started, running loop forever
2026-08-12 01:10:40,428 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 01:10:40,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:15:38,736 INFO core: _init_accounts coroutine started
2026-08-12 01:15:38,736 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 01:15:38,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:20:44,869 INFO core: Event loop thread started, running loop forever
2026-08-12 01:20:45,170 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 01:20:45,173 INFO core: _init_accounts coroutine started
2026-08-12 01:20:45,175 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 01:20:45,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:25:42,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 01:25:42,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:25:42,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 01:30:49,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 01:30:49,934 INFO core: Event loop thread started, running loop forever
2026-08-12 01:30:50,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 01:30:50,239 INFO core: _init_accounts coroutine started
2026-08-12 01:30:50,240 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 01:30:50,249 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:35:40,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:40:51,094 INFO core: Event loop thread started, running loop forever
2026-08-12 01:40:51,396 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 01:40:51,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:45:25,267 INFO core: _init_accounts coroutine started
2026-08-12 01:45:25,271 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 01:45:25,290 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:50:16,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 01:55:11,360 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 01:55:11,361 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 01:55:11,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:00:18,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 02:00:29,538 INFO core: Event loop thread started, running loop forever
2026-08-12 02:00:29,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 02:00:29,843 INFO core: _init_accounts coroutine started
2026-08-12 02:00:29,843 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 02:00:29,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:05:22,070 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:10:49,303 INFO core: Event loop thread started, running loop forever
2026-08-12 02:10:49,604 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 02:10:49,612 INFO core: _init_accounts coroutine started
2026-08-12 02:10:49,613 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 02:10:49,622 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:15:35,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:20:07,723 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 02:20:07,724 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 02:20:07,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:25:13,503 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 02:25:52,450 INFO core: Event loop thread started, running loop forever
2026-08-12 02:25:52,757 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 02:25:52,763 INFO core: _init_accounts coroutine started
2026-08-12 02:25:52,764 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 02:25:52,775 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:30:13,395 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 02:30:21,363 INFO core: Event loop thread started, running loop forever
2026-08-12 02:30:21,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 02:30:21,670 INFO core: _init_accounts coroutine started
2026-08-12 02:30:21,674 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 02:30:21,680 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:35:28,516 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 02:35:38,387 INFO core: Event loop thread started, running loop forever
2026-08-12 02:35:38,688 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 02:35:38,702 INFO core: _init_accounts coroutine started
2026-08-12 02:35:38,707 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 02:35:38,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:40:18,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:45:24,526 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 02:45:32,169 INFO core: Event loop thread started, running loop forever
2026-08-12 02:45:32,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 02:45:32,475 INFO core: _init_accounts coroutine started
2026-08-12 02:45:32,475 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 02:45:32,488 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:50:26,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:55:07,962 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 02:55:07,962 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 02:55:07,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 02:55:07,968 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 03:00:28,291 INFO core: Event loop thread started, running loop forever
2026-08-12 03:00:28,593 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 03:00:28,599 INFO core: _init_accounts coroutine started
2026-08-12 03:00:28,600 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 03:00:28,612 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:05:21,093 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:10:52,305 INFO core: Event loop thread started, running loop forever
2026-08-12 03:10:52,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 03:10:52,618 INFO core: _init_accounts coroutine started
2026-08-12 03:10:52,619 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 03:10:52,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:15:39,927 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 03:15:39,930 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 03:15:39,934 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 03:15:39,938 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 03:15:39,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:20:12,287 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:25:19,550 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-12 03:25:19,558 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 03:25:19,558 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 03:25:19,586 INFO core: Event loop thread started, running loop forever
2026-08-12 03:25:19,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 03:25:19,893 INFO core: _init_accounts coroutine started
2026-08-12 03:25:19,894 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 03:25:19,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:30:10,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:35:12,436 INFO core: Event loop thread started, running loop forever
2026-08-12 03:35:12,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 03:35:12,741 INFO core: _init_accounts coroutine started
2026-08-12 03:35:12,741 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 03:35:12,768 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:40:16,737 INFO core: Event loop thread started, running loop forever
2026-08-12 03:40:17,045 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 03:40:17,057 INFO core: _init_accounts coroutine started
2026-08-12 03:40:17,067 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:40:17,068 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 03:45:23,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 03:45:42,183 INFO core: Event loop thread started, running loop forever
2026-08-12 03:45:42,484 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 03:45:42,489 INFO core: _init_accounts coroutine started
2026-08-12 03:45:42,489 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 03:45:42,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:50:38,106 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 03:50:38,109 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 03:50:38,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 03:55:45,406 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 03:55:45,407 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-12 03:55:45,407 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 03:55:45,407 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 03:55:45,407 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 03:55:45,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 03:55:49,601 INFO core: Event loop thread started, running loop forever
2026-08-12 03:55:49,903 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 03:55:49,907 INFO core: _init_accounts coroutine started
2026-08-12 03:55:49,907 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 03:55:49,919 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:00:12,626 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:05:46,207 INFO core: Event loop thread started, running loop forever
2026-08-12 04:05:46,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 04:05:46,512 INFO core: _init_accounts coroutine started
2026-08-12 04:05:46,512 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 04:05:46,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:10:46,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:15:21,606 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 04:15:21,608 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 04:15:21,610 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 04:15:21,612 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 04:15:21,613 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:20:14,695 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:25:20,456 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-12 04:25:46,437 INFO core: Event loop thread started, running loop forever
2026-08-12 04:25:46,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 04:25:46,742 INFO core: _init_accounts coroutine started
2026-08-12 04:25:46,745 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 04:25:46,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:30:39,077 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 04:30:39,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:35:32,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:40:18,186 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 04:40:18,194 INFO core: _init_accounts coroutine started
2026-08-12 04:40:18,195 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 04:40:18,206 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:40:18,214 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 04:40:18,214 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 04:45:11,130 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 04:45:11,134 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 04:45:11,142 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:50:49,340 INFO core: Event loop thread started, running loop forever
2026-08-12 04:50:49,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 04:50:49,646 INFO core: _init_accounts coroutine started
2026-08-12 04:50:49,646 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 04:50:49,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 04:55:11,984 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 04:55:11,986 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 04:55:11,990 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 04:55:11,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:00:18,398 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 05:00:18,399 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 05:00:18,400 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 05:00:18,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 05:00:47,102 INFO core: Event loop thread started, running loop forever
2026-08-12 05:00:47,403 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:00:47,409 INFO core: _init_accounts coroutine started
2026-08-12 05:00:47,410 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:00:47,425 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:05:24,289 INFO core: Event loop thread started, running loop forever
2026-08-12 05:05:24,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:05:24,595 INFO core: _init_accounts coroutine started
2026-08-12 05:05:24,596 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:05:24,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:05:53,335 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 05:10:31,275 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 05:10:40,602 INFO core: Event loop thread started, running loop forever
2026-08-12 05:10:40,903 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:10:40,909 INFO core: _init_accounts coroutine started
2026-08-12 05:10:40,910 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:10:40,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:15:05,200 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 05:15:05,201 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 05:15:05,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:15:05,212 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 05:20:28,266 INFO core: Event loop thread started, running loop forever
2026-08-12 05:20:28,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:20:28,581 INFO core: _init_accounts coroutine started
2026-08-12 05:20:28,583 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:20:28,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:25:27,682 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:25:27,684 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 05:25:27,684 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 05:30:33,473 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 05:30:33,487 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-12 05:30:48,012 INFO core: Event loop thread started, running loop forever
2026-08-12 05:30:48,314 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:30:48,320 INFO core: _init_accounts coroutine started
2026-08-12 05:30:48,321 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:30:48,326 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:35:55,096 INFO core: Event loop thread started, running loop forever
2026-08-12 05:35:55,398 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:35:55,404 INFO core: _init_accounts coroutine started
2026-08-12 05:35:55,405 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:35:55,412 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:40:35,067 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 05:40:35,067 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 05:40:35,068 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:40:35,070 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 05:45:10,920 INFO core: Event loop thread started, running loop forever
2026-08-12 05:45:11,222 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:45:11,227 INFO core: _init_accounts coroutine started
2026-08-12 05:45:11,228 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:45:11,318 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-12 05:45:11,335 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 05:50:48,166 INFO core: Event loop thread started, running loop forever
2026-08-12 05:50:48,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 05:50:48,475 INFO core: _init_accounts coroutine started
2026-08-12 05:50:48,475 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 05:50:48,482 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 05:55:35,081 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:00:25,284 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:05:43,018 INFO core: Event loop thread started, running loop forever
2026-08-12 06:05:43,319 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 06:05:43,323 INFO core: _init_accounts coroutine started
2026-08-12 06:05:43,324 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 06:05:43,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:10:42,348 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:10:42,349 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 06:10:42,351 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 06:15:37,120 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 06:15:37,128 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 06:15:37,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:20:35,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:25:25,545 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:30:26,100 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:35:10,295 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 06:35:10,295 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 06:35:10,303 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-12 06:35:10,304 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 06:35:10,323 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:40:17,424 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 06:40:29,105 INFO core: Event loop thread started, running loop forever
2026-08-12 06:40:29,407 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 06:40:29,413 INFO core: _init_accounts coroutine started
2026-08-12 06:40:29,414 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 06:40:29,423 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:45:15,618 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 06:45:15,619 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 06:45:15,624 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:50:28,768 INFO core: Event loop thread started, running loop forever
2026-08-12 06:50:29,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 06:50:29,075 INFO core: _init_accounts coroutine started
2026-08-12 06:50:29,076 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 06:50:29,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 06:55:22,835 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 06:55:22,835 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 06:55:22,841 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:00:05,762 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:05:12,422 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 07:05:12,423 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-12 07:05:12,424 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 07:05:12,424 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 07:05:12,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 07:05:12,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 07:05:48,138 INFO core: Event loop thread started, running loop forever
2026-08-12 07:05:48,439 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:05:48,443 INFO core: _init_accounts coroutine started
2026-08-12 07:05:48,443 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:05:48,456 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:10:07,774 INFO core: Event loop thread started, running loop forever
2026-08-12 07:10:08,075 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:10:08,080 INFO core: _init_accounts coroutine started
2026-08-12 07:10:08,081 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:10:08,089 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:15:15,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 07:15:36,949 INFO core: Event loop thread started, running loop forever
2026-08-12 07:15:37,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:15:37,255 INFO core: _init_accounts coroutine started
2026-08-12 07:15:37,258 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:15:37,265 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:20:08,982 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:25:15,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 07:25:27,832 INFO core: Event loop thread started, running loop forever
2026-08-12 07:25:28,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:25:28,137 INFO core: _init_accounts coroutine started
2026-08-12 07:25:28,138 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:25:28,146 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:30:34,352 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 07:30:41,050 INFO core: Event loop thread started, running loop forever
2026-08-12 07:30:41,352 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:30:41,359 INFO core: _init_accounts coroutine started
2026-08-12 07:30:41,360 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:30:41,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:35:48,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 07:35:51,918 INFO core: Event loop thread started, running loop forever
2026-08-12 07:35:52,222 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:35:52,228 INFO core: _init_accounts coroutine started
2026-08-12 07:35:52,228 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:35:52,248 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:40:11,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:40:11,319 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 07:40:11,319 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 07:45:28,748 INFO core: Event loop thread started, running loop forever
2026-08-12 07:45:29,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:45:29,058 INFO core: _init_accounts coroutine started
2026-08-12 07:45:29,058 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:45:29,074 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:50:35,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 07:50:42,596 INFO core: Event loop thread started, running loop forever
2026-08-12 07:50:42,897 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 07:50:42,901 INFO core: _init_accounts coroutine started
2026-08-12 07:50:42,902 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 07:50:42,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 07:50:42,917 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 07:50:42,923 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 07:55:22,779 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 07:55:22,787 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 07:55:22,790 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:00:07,211 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-12 08:00:07,212 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 08:00:07,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:00:07,220 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-12 08:05:05,216 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 08:05:05,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:10:11,516 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 08:10:11,518 WARNING core: Account 1: connect timed out after 35s
2026-08-12 08:10:11,519 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 08:10:11,520 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 08:10:11,522 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 08:10:11,524 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-12 08:10:11,524 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 08:10:16,213 INFO core: Event loop thread started, running loop forever
2026-08-12 08:10:16,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 08:10:16,521 INFO core: _init_accounts coroutine started
2026-08-12 08:10:16,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 08:10:16,536 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 08:10:16,536 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 08:10:16,537 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 08:10:16,538 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 08:10:16,540 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:15:55,700 INFO core: Event loop thread started, running loop forever
2026-08-12 08:15:56,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 08:15:56,008 INFO core: _init_accounts coroutine started
2026-08-12 08:15:56,009 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 08:15:56,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:20:42,712 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 08:20:42,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:25:05,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:30:51,995 INFO core: Event loop thread started, running loop forever
2026-08-12 08:30:52,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 08:30:52,306 INFO core: _init_accounts coroutine started
2026-08-12 08:30:52,307 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 08:30:52,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:30:52,328 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 08:30:52,328 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 08:35:16,814 INFO core: Event loop thread started, running loop forever
2026-08-12 08:35:17,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 08:35:17,119 INFO core: _init_accounts coroutine started
2026-08-12 08:35:17,121 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 08:35:17,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:35:58,866 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 08:35:58,866 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-12 08:35:58,867 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 08:35:58,867 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 08:35:58,867 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 08:35:58,868 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 08:40:05,612 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 08:40:05,616 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 08:40:05,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:45:10,067 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 08:45:10,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:50:21,624 INFO core: Event loop thread started, running loop forever
2026-08-12 08:50:21,925 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 08:50:21,930 INFO core: _init_accounts coroutine started
2026-08-12 08:50:21,932 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 08:50:21,967 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 08:50:21,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 08:50:21,967 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 08:55:27,390 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-12 08:55:52,746 INFO core: Event loop thread started, running loop forever
2026-08-12 08:55:53,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 08:55:53,052 INFO core: _init_accounts coroutine started
2026-08-12 08:55:53,062 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 08:55:53,066 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:00:32,416 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:05:39,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 09:05:39,484 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 09:05:39,484 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-12 09:05:40,596 INFO core: Event loop thread started, running loop forever
2026-08-12 09:05:40,897 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 09:05:40,903 INFO core: _init_accounts coroutine started
2026-08-12 09:05:40,903 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 09:05:40,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:10:26,136 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:15:04,710 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 09:15:04,711 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 09:15:04,723 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 09:15:04,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:20:11,456 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 09:20:11,456 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 09:20:11,458 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 09:20:23,315 INFO core: Event loop thread started, running loop forever
2026-08-12 09:20:23,616 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 09:20:23,620 INFO core: _init_accounts coroutine started
2026-08-12 09:20:23,622 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 09:20:23,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:25:15,108 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:30:13,553 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 09:30:13,555 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 09:30:13,553 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:35:08,957 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 09:35:08,964 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:40:49,558 INFO core: Event loop thread started, running loop forever
2026-08-12 09:40:49,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 09:40:49,864 INFO core: _init_accounts coroutine started
2026-08-12 09:40:49,865 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 09:40:49,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 09:40:49,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 09:40:49,879 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 09:40:49,881 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 09:40:49,884 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:45:07,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:50:18,585 INFO core: Event loop thread started, running loop forever
2026-08-12 09:50:18,886 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 09:50:18,892 INFO core: _init_accounts coroutine started
2026-08-12 09:50:18,892 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 09:50:18,896 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 09:55:25,386 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 09:55:47,183 INFO core: Event loop thread started, running loop forever
2026-08-12 09:55:47,485 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 09:55:47,491 INFO core: _init_accounts coroutine started
2026-08-12 09:55:47,491 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 09:55:47,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:00:13,780 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 10:00:13,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:05:11,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:10:52,811 INFO core: Event loop thread started, running loop forever
2026-08-12 10:10:53,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 10:10:53,120 INFO core: _init_accounts coroutine started
2026-08-12 10:10:53,121 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 10:10:53,131 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:15:21,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:20:11,078 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 10:20:11,079 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 10:20:11,082 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:25:18,402 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 10:25:18,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 10:25:26,202 INFO core: Event loop thread started, running loop forever
2026-08-12 10:25:26,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 10:25:26,508 INFO core: _init_accounts coroutine started
2026-08-12 10:25:26,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 10:25:26,523 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:25:26,528 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 10:25:26,528 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 10:30:07,299 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 10:30:07,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:30:11,325 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 10:30:11,326 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 10:35:54,957 INFO core: Event loop thread started, running loop forever
2026-08-12 10:35:55,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 10:35:55,262 INFO core: _init_accounts coroutine started
2026-08-12 10:35:55,263 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 10:35:55,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:35:55,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 10:35:55,281 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 10:35:55,282 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 10:35:55,285 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 10:40:35,565 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-12 10:40:35,566 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 10:40:35,571 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-12 10:40:35,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:40:35,573 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 10:45:25,943 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 10:45:25,946 WARNING core: Account 1: connect timed out after 35s
2026-08-12 10:45:25,947 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 10:45:25,948 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 10:45:25,950 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 10:45:25,952 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-12 10:45:25,952 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 10:45:25,956 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:50:31,375 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 10:50:31,375 WARNING core: Account 1: connect timed out after 35s
2026-08-12 10:50:31,376 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-12 10:50:31,376 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-12 10:50:31,376 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 10:50:31,377 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-12 10:50:31,377 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-12 10:50:43,799 INFO core: Event loop thread started, running loop forever
2026-08-12 10:50:44,100 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 10:50:44,110 INFO core: _init_accounts coroutine started
2026-08-12 10:50:44,111 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 10:50:44,115 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:55:21,049 INFO core: Event loop thread started, running loop forever
2026-08-12 10:55:21,350 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 10:55:21,356 INFO core: _init_accounts coroutine started
2026-08-12 10:55:21,357 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 10:55:21,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 10:55:51,086 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 11:00:26,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:05:30,514 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 11:05:30,550 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:10:08,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:15:11,489 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 11:15:11,490 INFO core: _init_accounts coroutine started
2026-08-12 11:15:11,491 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 11:15:11,497 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:20:08,959 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:25:14,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 11:25:14,370 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 11:25:14,376 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 11:25:14,376 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-12 11:25:14,377 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 11:25:14,377 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 11:25:14,377 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 11:25:14,377 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 11:25:33,064 INFO core: Event loop thread started, running loop forever
2026-08-12 11:25:33,366 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 11:25:33,371 INFO core: _init_accounts coroutine started
2026-08-12 11:25:33,372 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 11:25:33,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:30:44,099 INFO core: Event loop thread started, running loop forever
2026-08-12 11:30:44,400 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 11:30:44,403 INFO core: _init_accounts coroutine started
2026-08-12 11:30:44,405 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 11:30:44,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:35:45,761 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 11:35:45,762 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 11:35:45,765 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 11:35:45,766 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:35:45,768 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 11:40:42,254 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:45:50,979 INFO core: Event loop thread started, running loop forever
2026-08-12 11:45:51,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 11:45:51,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:50:15,087 INFO core: _init_accounts coroutine started
2026-08-12 11:50:15,103 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 11:50:15,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 11:55:36,879 INFO core: Event loop thread started, running loop forever
2026-08-12 11:55:37,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 11:55:37,197 INFO core: _init_accounts coroutine started
2026-08-12 11:55:37,198 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 11:55:37,208 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:00:27,153 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:05:26,168 INFO core: Event loop thread started, running loop forever
2026-08-12 12:05:26,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 12:05:26,474 INFO core: _init_accounts coroutine started
2026-08-12 12:05:26,475 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 12:05:26,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:10:43,145 INFO core: Event loop thread started, running loop forever
2026-08-12 12:10:43,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 12:10:43,453 INFO core: _init_accounts coroutine started
2026-08-12 12:10:43,453 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 12:10:43,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:15:25,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:20:07,873 INFO core: Event loop thread started, running loop forever
2026-08-12 12:20:08,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 12:20:08,180 INFO core: _init_accounts coroutine started
2026-08-12 12:20:08,180 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 12:20:08,190 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:25:08,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:30:15,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 12:30:45,709 INFO core: Event loop thread started, running loop forever
2026-08-12 12:30:46,010 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 12:30:46,016 INFO core: _init_accounts coroutine started
2026-08-12 12:30:46,016 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 12:30:46,034 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 12:30:46,034 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 12:30:46,044 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 12:30:46,048 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 12:30:46,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:35:45,747 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:40:31,201 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 12:40:31,203 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 12:40:31,209 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:45:07,443 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-12 12:45:07,446 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 12:45:42,183 INFO core: Event loop thread started, running loop forever
2026-08-12 12:45:42,485 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 12:45:42,489 INFO core: _init_accounts coroutine started
2026-08-12 12:45:42,489 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 12:45:42,497 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:50:15,985 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 12:55:03,554 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 12:55:03,554 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 12:55:03,572 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:00:51,951 INFO core: Event loop thread started, running loop forever
2026-08-12 13:00:52,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 13:00:52,258 INFO core: _init_accounts coroutine started
2026-08-12 13:00:52,259 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:00:52,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:05:52,775 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:10:27,842 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 13:10:27,842 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 13:10:27,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:10:27,855 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 13:15:35,452 INFO core: Event loop thread started, running loop forever
2026-08-12 13:15:35,753 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 13:15:35,758 INFO core: _init_accounts coroutine started
2026-08-12 13:15:35,759 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:15:35,770 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:20:19,187 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:20:57,202 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:21:08,074 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 13:21:08,075 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 13:21:08,078 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 13:21:08,082 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 13:21:08,093 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:21:18,630 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:21:18,634 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'llama3.1-8b', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': False, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 120}
2026-08-12 13:21:18,634 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 13:21:18,638 INFO core: Account 1: connecting to Telegram via 91.108.56.178...
2026-08-12 13:21:18,638 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 13:24:36,763 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 13:24:36,764 WARNING core: Account 1: connect timed out after 35s
2026-08-12 13:24:36,765 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 13:24:36,766 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 13:24:36,766 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 13:24:36,767 INFO core: Account 1: connecting to Telegram via 91.108.56.181...
2026-08-12 13:24:36,768 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 13:24:45,468 INFO telethon.network.mtprotosender: Connection to 91.108.56.181:443/TcpAbridged complete!
2026-08-12 13:25:03,221 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:25:06,126 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:25:45,178 WARNING core: Account 1: connect timed out after 35s
2026-08-12 13:25:45,180 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:27:08,801 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-12 13:27:08,803 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-12 13:27:08,807 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-12 13:27:08,808 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 13:27:08,810 INFO core: Account 1: connecting to Telegram via 91.108.56.182...
2026-08-12 13:27:08,810 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-12 13:27:08,819 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:27:12,570 INFO telethon.network.mtprotosender: Connection to 91.108.56.182:443/TcpAbridged complete!
2026-08-12 13:27:14,546 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:27:19,439 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:27:56,244 WARNING core: Account 1: connect timed out after 35s
2026-08-12 13:27:56,246 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:27:56,249 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:29:42,752 WARNING core: Account 1: is_user_authorized timed out after 15s
2026-08-12 13:29:42,754 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-12 13:29:42,755 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-12 13:29:42,755 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 13:29:42,756 INFO core: Account 1: connecting to Telegram via 91.108.56.186...
2026-08-12 13:29:42,756 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-12 13:29:42,758 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:29:42,768 INFO core: Loaded 2 enabled pair(s) across 2 account(s)
2026-08-12 13:29:42,776 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:29:54,201 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 13:29:54,201 ERROR core: Account 1 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-12 13:29:54,223 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-12 13:29:54,224 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-12 13:29:54,224 INFO core: Account 1: connecting to Telegram via 91.108.56.187...
2026-08-12 13:29:54,225 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-12 13:29:54,229 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:29:54,241 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:30:40,202 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 13:30:40,202 WARNING core: Account 1: connect timed out after 35s
2026-08-12 13:30:40,203 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-12 13:30:40,203 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-12 13:30:40,203 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 13:30:40,204 WARNING core: Account 1: exhausted all Telegram server candidates
2026-08-12 13:30:40,207 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 13:30:40,207 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 13:30:40,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:31:57,422 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 13:31:57,423 WARNING core: Account 2: connect timed out after 35s
2026-08-12 13:31:57,423 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 13:31:57,424 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 13:31:57,424 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 13:31:57,425 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-12 13:31:57,426 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 13:31:57,432 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:31:57,815 INFO telethon.network.mtprotosender: Connection to 91.108.56.181:443/TcpAbridged complete!
2026-08-12 13:31:57,819 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:33:26,002 WARNING core: Account 2: connect timed out after 35s
2026-08-12 13:33:26,016 INFO core: Loaded 0 enabled pair(s) across 0 account(s)
2026-08-12 13:33:26,030 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:33:32,119 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:33:32,120 WARNING telethon.network.mtprotostate: Server sent a very new message with ID 7673199618728985605, ignoring (see FAQ for details)
2026-08-12 13:33:32,121 WARNING telethon.network.mtprotostate: Server sent a very new message with ID 7673199618766900225, ignoring (see FAQ for details)
2026-08-12 13:33:32,122 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:33:32,122 WARNING telethon.network.mtprotostate: Server sent a very new message with ID 7673199618823657473, ignoring (see FAQ for details)
2026-08-12 13:33:39,920 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:34:03,842 WARNING core: Account 2: is_user_authorized timed out after 15s
2026-08-12 13:34:03,844 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-12 13:34:03,845 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:34:03,848 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-12 13:34:03,850 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 13:34:03,851 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-12 13:34:03,851 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-12 13:34:03,856 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:34:03,865 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:34:11,421 INFO telethon.network.mtprotosender: Connection to 91.108.56.182:443/TcpAbridged complete!
2026-08-12 13:34:11,430 INFO core: Loaded 0 enabled pair(s) across 0 account(s)
2026-08-12 13:34:11,437 INFO core: Loaded 344 dialog(s) from cache (account 1)
2026-08-12 13:34:16,604 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:34:21,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:34:32,530 INFO core: Account 2 connected and authorized via 91.108.56.182
2026-08-12 13:34:32,541 INFO core: Loaded 0 enabled pair(s) across 0 account(s)
2026-08-12 13:34:32,542 INFO core: Initialized 1 account(s), 0 pair(s)
2026-08-12 13:34:32,544 INFO core: Memory RSS: 95.24 MB
2026-08-12 13:34:32,548 INFO core: Loaded 237 dialog(s) from cache (account 2)
2026-08-12 13:34:36,790 INFO core: Saved 241 dialog(s) to cache (account 2)
2026-08-12 13:34:37,184 INFO core: Saved 241 dialog(s) to cache (account 2)
2026-08-12 13:34:37,187 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 13:34:38,532 INFO core: Saved 241 dialog(s) to cache (account 2)
2026-08-12 13:34:38,533 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 13:35:16,204 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 13:35:16,207 INFO core: Loaded 0 enabled pair(s) across 0 account(s)
2026-08-12 13:35:16,217 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:35:16,217 INFO core: Signal processor started
2026-08-12 13:35:16,218 INFO core: Handlers installed for account 2
2026-08-12 13:35:16,227 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 13:35:26,331 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:35:26,349 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 13:35:31,651 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:35:36,463 INFO core: Memory RSS: 95.26 MB
2026-08-12 13:35:36,472 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:35:40,637 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:35:40,644 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:35:50,548 INFO core: Event loop thread started, running loop forever
2026-08-12 13:35:50,849 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 13:35:50,852 INFO core: _init_accounts coroutine started
2026-08-12 13:35:50,853 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:35:50,864 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:36:46,665 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:38:20,971 INFO core: Memory RSS: 95.52 MB
2026-08-12 13:38:20,972 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:38:57,459 INFO core: _init_accounts coroutine started
2026-08-12 13:38:57,459 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:38:57,470 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:39:00,835 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:39:00,836 INFO core: _init_accounts coroutine started
2026-08-12 13:39:00,837 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:39:00,853 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:39:50,493 INFO core: Memory RSS: 97.27 MB
2026-08-12 13:39:50,509 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:39:50,520 INFO core: LLM engine reloaded: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 13:40:15,180 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 13:40:20,444 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:40:36,136 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:40:36,142 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:40:51,564 INFO core: Memory RSS: 97.33 MB
2026-08-12 13:40:51,574 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:41:23,244 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:41:23,249 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:41:55,409 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:41:55,411 INFO core: _init_accounts coroutine started
2026-08-12 13:41:55,411 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:41:55,417 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:41:55,420 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:42:28,506 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:43:02,381 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:43:02,382 INFO core: _init_accounts coroutine started
2026-08-12 13:43:02,382 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:43:02,385 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:43:35,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:44:08,285 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:44:08,319 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:44:42,068 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:44:42,069 INFO core: _init_accounts coroutine started
2026-08-12 13:44:42,069 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:44:42,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:45:14,767 INFO core: Memory RSS: 97.55 MB
2026-08-12 13:45:14,777 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:45:14,781 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:45:33,719 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:45:46,753 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:45:46,768 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:46:18,843 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:46:18,846 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:46:51,358 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:46:51,359 INFO core: _init_accounts coroutine started
2026-08-12 13:46:51,359 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:46:51,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:47:24,351 INFO core: Memory RSS: 97.61 MB
2026-08-12 13:47:24,364 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:47:24,368 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 13:47:57,000 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:47:57,007 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:48:29,347 INFO core: Memory RSS: 97.61 MB
2026-08-12 13:48:29,349 INFO telethon.network.mtprotosender: Closing current connection to begin reconnect...
2026-08-12 13:48:29,351 ERROR telethon.network.mtprotosender: Automatic reconnection failed 0 time(s)
2026-08-12 13:48:29,351 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-12 13:48:29,352 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-12 13:48:29,355 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:48:29,360 INFO core: status() clients=1 connected=False forwarding=True
2026-08-12 13:49:01,727 INFO core: status() clients=1 connected=False forwarding=True
2026-08-12 13:49:34,863 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:49:34,864 INFO core: Memory RSS: 97.61 MB
2026-08-12 13:49:34,874 INFO core: status() clients=1 connected=False forwarding=True
2026-08-12 13:50:07,813 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 13:50:07,828 INFO core: status() clients=1 connected=False forwarding=True
2026-08-12 13:50:39,721 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:50:39,722 INFO core: _init_accounts coroutine started
2026-08-12 13:50:39,722 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:50:39,734 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:50:40,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 13:50:43,372 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:50:44,296 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 13:50:44,297 INFO core: _init_accounts coroutine started
2026-08-12 13:50:44,297 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:50:44,304 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 13:50:44,350 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 13:55:52,469 INFO core: Event loop thread started, running loop forever
2026-08-12 13:55:52,770 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 13:55:52,775 INFO core: _init_accounts coroutine started
2026-08-12 13:55:52,776 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 13:55:52,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:00:18,158 INFO core: Event loop thread started, running loop forever
2026-08-12 14:00:18,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 14:00:18,462 INFO core: _init_accounts coroutine started
2026-08-12 14:00:18,463 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:00:18,468 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:04:32,946 INFO core: Event loop thread started, running loop forever
2026-08-12 14:04:33,247 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 14:04:33,250 INFO core: _init_accounts coroutine started
2026-08-12 14:04:33,251 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:04:35,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:04:37,983 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 14:04:37,984 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 14:04:37,988 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 14:04:37,988 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:04:37,989 INFO core: Signal processor started
2026-08-12 14:04:37,998 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 14:04:38,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:05:09,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:05:21,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:05:40,267 INFO core: Event loop thread started, running loop forever
2026-08-12 14:05:40,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 14:05:40,574 INFO core: _init_accounts coroutine started
2026-08-12 14:05:40,575 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:05:40,578 ERROR sqlalchemy.pool.impl.QueuePool: Exception during reset or similar
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 986, in _finalize_fairy
    fairy._reset(
    ~~~~~~~~~~~~^
        pool,
        ^^^^^
    ...<2 lines>...
        asyncio_safe=can_manipulate_connection,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1441, in _reset
    pool._dialect.do_rollback(self)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 123, in do_rollback
    dbapi_connection.rollback()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 512, in rollback
    self._read_ok_packet()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 474, in _read_ok_packet
    raise err.OperationalError(
    ...<2 lines>...
    )
pymysql.err.OperationalError: (2014, 'Command Out of Sync')
2026-08-12 14:05:40,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:06:11,790 ERROR sqlalchemy.pool.impl.QueuePool: Exception during reset or similar
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/db.py", line 68, in _conn
    yield conn
  File "/home/wovewbge/quill.nx.kg/db.py", line 120, in get_config
    cur.execute(
    ~~~~~~~~~~~^
        "SELECT var_value FROM config_vars WHERE var_key=%s", (key,)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 159, in execute
    result = self._query(query)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 330, in _query
    conn.query(q)
    ~~~~~~~~~~^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 582, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 847, in _read_query_result
    result.read()
    ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 1245, in read
    first_packet = self.connection._read_packet()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet_header = self._read_bytes(4)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 826, in _read_bytes
    raise err.OperationalError(
        CR.CR_SERVER_LOST, "Lost connection to MySQL server during query"
    )
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 986, in _finalize_fairy
    fairy._reset(
    ~~~~~~~~~~~~^
        pool,
        ^^^^^
    ...<2 lines>...
        asyncio_safe=can_manipulate_connection,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1441, in _reset
    pool._dialect.do_rollback(self)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 123, in do_rollback
    dbapi_connection.rollback()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 511, in rollback
    self._execute_command(COMMAND.COM_QUERY, "ROLLBACK")
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 865, in _execute_command
    raise err.InterfaceError(0, "")
pymysql.err.InterfaceError: (0, '')
2026-08-12 14:06:11,802 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:06:11,803 WARNING core: LLM config load failed: (2013, 'Lost connection to MySQL server during query')
2026-08-12 14:06:11,803 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 14:06:42,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:07:14,170 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 14:07:14,170 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 14:07:14,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:07:45,352 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:08:12,390 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:08:13,039 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 14:08:13,039 WARNING core: Account 2: connect timed out after 35s
2026-08-12 14:08:13,040 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 14:08:13,040 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 14:08:13,041 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 14:08:13,042 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-12 14:08:13,042 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 14:08:47,918 INFO core: Event loop thread started, running loop forever
2026-08-12 14:08:47,924 INFO core: Event loop thread started, running loop forever
2026-08-12 14:08:48,219 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 14:08:48,225 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 14:08:48,226 INFO core: _init_accounts coroutine started
2026-08-12 14:08:48,226 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:08:48,233 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:08:48,233 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:08:48,234 INFO core: _init_accounts coroutine started
2026-08-12 14:08:48,235 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:08:48,250 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 14:08:48,250 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 14:08:48,252 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 14:08:48,262 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 14:09:19,379 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
2026-08-12 14:09:19,389 INFO core: status() clients=0 connected=False forwarding=False
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:09:50,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:10:10,008 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 14:10:10,009 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 14:10:10,025 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:10:21,676 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 14:10:21,677 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 14:10:21,685 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:10:52,906 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:11:24,106 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:11:24,106 INFO core: _init_accounts coroutine started
2026-08-12 14:11:24,107 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:11:24,115 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:11:55,290 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:11:55,300 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:12:26,501 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:12:26,503 INFO core: _init_accounts coroutine started
2026-08-12 14:12:26,503 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:12:26,516 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
2026-08-12 14:12:26,517 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:12:57,689 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:12:57,690 INFO core: _init_accounts coroutine started
2026-08-12 14:12:57,691 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:12:57,707 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:12:57,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:13:28,861 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 14:13:28,862 WARNING core: Account 2: connect timed out after 35s
2026-08-12 14:13:28,863 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 14:13:28,864 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 14:13:28,866 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 14:13:28,868 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-12 14:13:28,869 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 14:13:28,873 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:14:00,435 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 14:14:00,436 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-12 14:14:00,441 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-12 14:14:00,441 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-12 14:14:00,442 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-12 14:14:00,442 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-12 14:14:00,450 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:14:31,567 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:14:31,568 INFO core: _init_accounts coroutine started
2026-08-12 14:14:31,568 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:14:31,575 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:14:31,586 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:15:02,747 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 14:15:02,748 WARNING core: Account 2: connect timed out after 35s
2026-08-12 14:15:02,748 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-12 14:15:02,748 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-12 14:15:02,749 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 14:15:02,750 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-12 14:15:02,750 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-12 14:15:02,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:15:33,976 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 14:15:33,977 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-12 14:15:33,979 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-12 14:15:33,980 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-12 14:15:33,981 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-12 14:15:33,981 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-12 14:15:33,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:15:35,421 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-12 14:15:35,426 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:16:05,268 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 14:16:07,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:16:38,229 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:16:38,231 INFO core: _init_accounts coroutine started
2026-08-12 14:16:38,232 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:16:38,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:17:09,407 WARNING core: Account 2: connect timed out after 35s
2026-08-12 14:17:09,409 INFO core: Account 2 connected and authorized via 91.108.56.187
2026-08-12 14:17:09,418 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:17:09,418 INFO core: Signal processor started
2026-08-12 14:17:09,419 INFO core: Handlers installed for account 2
2026-08-12 14:17:09,421 INFO core: Initialized 1 account(s), 1 pair(s)
2026-08-12 14:17:09,423 INFO core: Memory RSS: 90.64 MB
2026-08-12 14:17:09,425 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:17:40,609 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:17:40,620 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:18:11,790 INFO core: Memory RSS: 90.70 MB
2026-08-12 14:18:11,829 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:18:11,830 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:18:42,978 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:18:42,985 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:19:14,128 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:19:14,128 INFO core: _init_accounts coroutine started
2026-08-12 14:19:14,129 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:19:14,139 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:19:14,143 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:19:45,310 INFO core: Memory RSS: 90.98 MB
2026-08-12 14:19:45,322 INFO core: Saved 241 dialog(s) to cache (account 2)
2026-08-12 14:19:45,332 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:19:45,335 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:20:06,991 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:20:16,536 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:20:16,537 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:20:47,731 INFO core: Memory RSS: 91.02 MB
2026-08-12 14:20:47,737 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:20:47,744 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:21:18,927 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:21:18,944 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:21:50,127 INFO core: Memory RSS: 91.02 MB
2026-08-12 14:21:50,130 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:21:50,138 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:22:21,286 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:22:21,288 INFO core: _init_accounts coroutine started
2026-08-12 14:22:21,288 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:22:21,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:22:52,444 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:23:23,533 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:23:23,541 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:23:54,632 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:23:54,632 INFO core: _init_accounts coroutine started
2026-08-12 14:23:54,633 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:23:54,641 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:23:54,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:24:25,743 INFO core: Memory RSS: 91.02 MB
2026-08-12 14:24:25,749 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:24:25,752 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:24:56,912 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:24:56,913 INFO core: _init_accounts coroutine started
2026-08-12 14:24:56,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:24:56,927 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:25:28,105 INFO core: Memory RSS: 91.06 MB
2026-08-12 14:25:28,119 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:25:28,122 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:25:49,871 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:25:59,314 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:26:30,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:27:01,674 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 14:27:01,687 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:27:32,860 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:27:32,861 INFO core: _init_accounts coroutine started
2026-08-12 14:27:32,862 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:27:32,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:28:03,988 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
2026-08-12 14:28:03,998 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:28:35,110 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:28:35,110 INFO core: _init_accounts coroutine started
2026-08-12 14:28:35,111 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:28:35,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:29:06,270 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:29:06,271 INFO core: Memory RSS: 91.06 MB
2026-08-12 14:29:06,278 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:29:37,404 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:29:37,407 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:30:08,566 INFO core: Memory RSS: 91.06 MB
2026-08-12 14:30:08,572 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:30:08,583 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:30:39,736 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:30:39,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:30:39,803 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:30:39,804 INFO core: _init_accounts coroutine started
2026-08-12 14:30:39,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:30:39,809 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:31:10,843 INFO core: Memory RSS: 91.06 MB
2026-08-12 14:31:10,858 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:31:10,861 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:31:41,969 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 14:31:41,979 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:32:13,062 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:32:13,063 INFO core: _init_accounts coroutine started
2026-08-12 14:32:13,063 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:32:13,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:32:44,220 INFO core: Memory RSS: 91.06 MB
2026-08-12 14:32:44,225 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:32:44,229 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:33:15,356 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:33:15,359 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:33:46,531 INFO core: Memory RSS: 91.06 MB
2026-08-12 14:33:46,540 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:33:46,542 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:34:17,699 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:34:17,710 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:34:48,880 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:35:20,024 INFO core: Memory RSS: 91.06 MB
2026-08-12 14:35:20,045 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:35:20,058 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:35:43,111 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:35:43,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:35:51,187 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:35:51,188 INFO core: _init_accounts coroutine started
2026-08-12 14:35:51,188 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:35:51,192 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:36:22,327 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:36:22,337 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:36:22,340 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:36:53,518 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:36:53,520 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:37:24,642 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:37:24,656 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:37:24,659 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:37:55,806 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:37:55,811 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:38:26,951 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:38:26,952 INFO core: _init_accounts coroutine started
2026-08-12 14:38:26,952 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:38:26,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:38:58,117 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 14:38:58,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:39:29,290 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:39:29,291 INFO core: _init_accounts coroutine started
2026-08-12 14:39:29,291 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:39:29,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:40:00,472 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:40:00,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:40:11,460 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:40:11,465 INFO core: _init_accounts coroutine started
2026-08-12 14:40:11,465 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:40:11,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:40:31,662 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
2026-08-12 14:40:31,664 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:41:02,917 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:41:02,924 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:41:02,940 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:41:34,095 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:41:34,096 INFO core: _init_accounts coroutine started
2026-08-12 14:41:34,097 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:41:34,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:42:05,231 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:42:05,241 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:42:05,242 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:42:36,352 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 14:42:36,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:43:07,518 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:43:07,529 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:43:07,534 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:43:38,730 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:43:38,731 INFO core: _init_accounts coroutine started
2026-08-12 14:43:38,731 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:43:38,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:44:09,909 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:44:09,922 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:44:41,124 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:44:41,133 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:45:12,312 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:45:12,313 INFO core: _init_accounts coroutine started
2026-08-12 14:45:12,313 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:45:12,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:45:34,103 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:45:34,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:45:43,513 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:45:43,516 INFO core: _init_accounts coroutine started
2026-08-12 14:45:43,516 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:45:43,522 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:46:14,716 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:46:14,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:46:45,894 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:46:45,894 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:46:45,906 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:47:17,090 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:47:17,091 INFO core: _init_accounts coroutine started
2026-08-12 14:47:17,092 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:47:17,096 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:47:48,240 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:47:48,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:48:19,350 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:48:19,355 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:48:19,362 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:48:50,474 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:48:50,484 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:49:21,611 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:49:21,612 INFO core: _init_accounts coroutine started
2026-08-12 14:49:21,612 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:49:21,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:49:52,734 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:49:52,743 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:49:52,746 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:50:23,904 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:50:39,804 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:50:39,815 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:50:55,101 INFO core: Memory RSS: 91.07 MB
2026-08-12 14:50:55,136 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:51:26,328 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 14:51:26,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:51:57,569 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 14:51:57,570 INFO core: _init_accounts coroutine started
2026-08-12 14:51:57,570 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 14:51:57,572 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:52:28,730 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 14:52:59,920 INFO core: Memory RSS: 91.08 MB
2026-08-12 14:52:59,935 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:52:59,936 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:53:31,062 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:53:31,087 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:54:02,231 INFO core: Memory RSS: 91.08 MB
2026-08-12 14:54:02,239 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:54:33,437 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:54:33,443 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:55:04,565 INFO core: Memory RSS: 91.08 MB
2026-08-12 14:55:04,581 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:55:04,582 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:55:24,163 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:55:35,707 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:55:35,708 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:56:06,867 INFO core: Memory RSS: 91.08 MB
2026-08-12 14:56:06,874 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:56:10,263 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:56:11,336 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 14:56:16,922 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 14:56:19,991 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:56:51,109 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:56:51,113 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:57:22,269 INFO core: Memory RSS: 91.10 MB
2026-08-12 14:57:22,276 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:57:22,276 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:57:35,283 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-12 14:57:53,418 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:57:53,421 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:58:24,522 INFO core: Memory RSS: 91.10 MB
2026-08-12 14:58:24,531 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:58:55,642 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:58:55,653 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:59:26,805 INFO core: Memory RSS: 91.10 MB
2026-08-12 14:59:26,817 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:59:26,820 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 14:59:59,300 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 14:59:59,302 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:00:31,571 INFO core: Memory RSS: 91.10 MB
2026-08-12 15:00:31,582 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:00:31,583 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:00:47,194 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:01:04,586 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:01:36,795 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:01:36,796 INFO core: Memory RSS: 91.10 MB
2026-08-12 15:01:36,807 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:02:09,454 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:02:42,303 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:02:42,305 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:02:42,311 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:03:14,811 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:03:14,814 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:03:46,043 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:03:46,051 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:03:46,065 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:04:18,637 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:04:18,647 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:04:51,227 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:04:51,235 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:04:51,236 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:05:06,480 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:05:23,528 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:05:23,544 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:05:56,057 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:05:56,068 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:05:56,070 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:06:28,591 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:06:28,592 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:07:00,841 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:07:00,846 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:07:00,873 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:07:33,770 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:07:33,773 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:08:06,423 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:08:06,437 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:08:06,442 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:08:39,278 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:09:11,753 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:09:11,757 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:09:11,759 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:09:44,336 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:09:44,351 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:10:16,811 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:10:16,822 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:10:46,021 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:10:50,477 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:10:50,483 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:11:23,054 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:11:23,062 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:11:23,063 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:11:55,419 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:11:55,422 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:12:28,171 INFO core: Memory RSS: 91.18 MB
2026-08-12 15:12:28,183 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:12:28,188 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:13:00,408 ERROR core: Watchdog error: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 611, in _watchdog_loop
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 15:13:00,425 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:13:00,428 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:13:32,816 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:13:32,826 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:13:32,827 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:14:05,696 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:14:05,698 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:14:38,420 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:14:38,429 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:14:38,432 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:15:06,458 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:15:10,812 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:15:10,815 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:15:43,427 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:15:43,435 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:15:43,437 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:16:16,001 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:16:16,002 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:16:48,510 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:16:48,517 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:16:48,520 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:17:21,982 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:17:21,986 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:17:53,987 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:17:53,994 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:17:53,996 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:18:26,754 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:18:26,757 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:18:59,384 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:18:59,399 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:18:59,400 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:19:31,754 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:19:31,759 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:20:04,596 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:20:04,611 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:20:04,612 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:20:37,992 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:20:37,994 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:20:46,663 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:21:10,622 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:21:10,631 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:21:10,635 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:21:42,980 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:21:42,986 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:22:15,597 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:22:15,608 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:22:15,610 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:22:47,891 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:22:47,900 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:23:20,837 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:23:20,846 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:23:54,019 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:23:54,029 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:24:26,536 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:24:26,546 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:24:26,549 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:24:58,947 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:24:58,949 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:25:31,636 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:25:31,645 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:25:31,654 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:25:45,645 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:26:04,850 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:26:04,865 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:26:36,838 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:26:36,846 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:26:36,848 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:27:21,195 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:27:21,195 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:27:54,160 INFO core: Memory RSS: 91.41 MB
2026-08-12 15:27:54,172 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:27:54,176 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:28:25,846 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:28:58,471 INFO core: Memory RSS: 91.42 MB
2026-08-12 15:28:58,477 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:28:58,483 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:29:31,448 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:29:31,450 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:30:03,735 INFO core: Memory RSS: 91.42 MB
2026-08-12 15:30:03,768 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:30:03,774 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:30:36,473 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:30:36,477 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:30:39,425 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:31:08,657 INFO core: Memory RSS: 91.42 MB
2026-08-12 15:31:08,669 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:31:08,672 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:31:40,981 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:31:40,983 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:32:13,419 INFO core: Memory RSS: 91.42 MB
2026-08-12 15:32:13,431 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:32:45,297 INFO core: Event loop thread started, running loop forever
2026-08-12 15:32:45,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 15:32:45,604 INFO core: _init_accounts coroutine started
2026-08-12 15:32:45,605 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 15:32:45,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:32:45,641 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-12 15:33:18,055 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 15:33:50,667 INFO core: Memory RSS: 91.42 MB
2026-08-12 15:33:50,668 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:33:50,674 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:34:23,442 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:34:56,446 INFO core: Memory RSS: 91.42 MB
2026-08-12 15:34:56,452 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:34:56,488 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:35:17,356 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:35:29,152 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 15:35:29,153 INFO core: _init_accounts coroutine started
2026-08-12 15:35:29,153 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 15:35:29,161 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-08-12 15:35:29,161 INFO core: status() clients=0 connected=False forwarding=False
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 15:36:01,934 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 15:36:01,935 INFO core: _init_accounts coroutine started
2026-08-12 15:36:01,935 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 15:36:01,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:36:34,168 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 15:36:34,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:37:06,772 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 15:37:06,774 INFO core: _init_accounts coroutine started
2026-08-12 15:37:06,775 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 15:37:06,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:37:39,358 INFO core: Memory RSS: 91.44 MB
2026-08-12 15:37:39,366 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:37:39,369 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:38:12,195 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 15:38:12,200 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:38:44,544 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:38:44,555 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:38:44,557 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:39:16,965 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-12 15:39:16,967 INFO core: _init_accounts coroutine started
2026-08-12 15:39:16,967 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 15:39:16,969 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:39:49,536 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:39:49,545 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:39:49,550 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:40:23,395 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:40:23,395 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:40:48,947 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:40:55,701 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:40:55,705 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:41:28,302 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 15:41:28,308 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 15:42:01,467 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:42:01,471 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:42:01,477 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:42:34,477 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:43:09,867 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:43:09,875 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:43:09,883 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:43:42,385 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:43:42,387 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:44:14,873 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:44:14,877 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:44:14,910 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:44:47,447 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:44:47,452 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:45:04,569 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:45:19,976 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:45:19,992 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:45:52,309 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:45:52,317 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:46:26,536 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:46:26,543 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:46:26,551 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:47:35,856 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:47:35,871 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:48:07,976 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:48:07,985 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:48:40,478 INFO core: Memory RSS: 91.50 MB
2026-08-12 15:48:40,485 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:48:40,490 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:49:12,835 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:49:12,836 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:49:45,664 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:49:45,676 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:49:45,677 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:50:18,472 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:50:18,473 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:50:30,617 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:50:51,008 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:50:51,017 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:51:23,447 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:51:23,448 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:51:55,781 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:51:55,793 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:51:55,808 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:52:28,636 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:52:28,639 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:53:01,358 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:53:01,361 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:53:01,365 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:53:33,871 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:53:33,876 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:54:06,355 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:54:06,365 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:54:06,375 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:54:38,628 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:54:38,630 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:55:11,512 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:55:11,525 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:55:11,525 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:55:43,916 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:55:45,664 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:55:45,674 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:56:16,646 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:56:16,655 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:56:48,970 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:56:48,981 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:57:22,482 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:57:22,489 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:57:22,489 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:58:00,753 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 15:59:42,758 INFO core: Memory RSS: 91.52 MB
2026-08-12 15:59:42,758 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 15:59:42,766 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 16:00:35,030 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 16:00:35,043 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 16:05:25,068 INFO core: Memory RSS: 91.52 MB
2026-08-12 16:05:25,206 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 16:05:25,210 INFO core: status() clients=1 connected=True forwarding=True
2026-08-12 16:10:08,068 INFO core: Memory RSS: 91.52 MB
2026-08-12 16:10:08,073 WARNING telethon.network.connection.connection: Server closed the connection: 0 bytes read on a total of 1 expected bytes
2026-08-12 16:10:08,076 INFO telethon.network.mtprotosender: Connection closed while receiving data: 0 bytes read on a total of 1 expected bytes
2026-08-12 16:10:08,078 INFO telethon.network.mtprotosender: Closing current connection to begin reconnect...
2026-08-12 16:10:08,084 ERROR telethon.network.mtprotosender: Automatic reconnection failed 0 time(s)
2026-08-12 16:10:08,084 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-12 16:10:08,084 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-12 16:10:08,094 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-12 16:10:08,104 INFO core: status() clients=1 connected=False forwarding=True
2026-08-12 16:15:02,408 INFO core: Memory RSS: 91.54 MB
2026-08-12 16:15:24,778 INFO core: Event loop thread started, running loop forever
2026-08-12 16:15:25,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 16:15:25,083 INFO core: _init_accounts coroutine started
2026-08-12 16:15:25,083 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 16:15:25,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:20:30,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:25:44,713 INFO core: Event loop thread started, running loop forever
2026-08-12 16:25:45,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 16:25:45,020 INFO core: _init_accounts coroutine started
2026-08-12 16:25:45,020 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 16:25:45,031 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:25:45,032 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 16:25:45,034 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 16:30:52,870 INFO core: Event loop thread started, running loop forever
2026-08-12 16:30:53,171 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 16:30:53,177 INFO core: _init_accounts coroutine started
2026-08-12 16:30:53,177 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 16:30:53,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:35:03,951 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 16:35:03,952 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 16:35:03,953 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 16:35:03,954 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 16:35:03,964 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 16:35:03,964 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 16:35:03,968 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 16:35:03,969 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 16:35:03,982 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:40:10,428 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 16:40:21,243 INFO core: Event loop thread started, running loop forever
2026-08-12 16:40:21,544 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 16:40:21,551 INFO core: _init_accounts coroutine started
2026-08-12 16:40:21,552 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 16:40:21,561 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:45:26,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:45:26,809 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 16:45:26,809 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 16:50:11,221 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 16:50:11,229 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 16:50:11,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 16:55:40,443 INFO core: Event loop thread started, running loop forever
2026-08-12 16:55:40,744 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 16:55:40,749 INFO core: _init_accounts coroutine started
2026-08-12 16:55:40,750 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 16:55:40,758 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:00:31,930 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 17:00:31,931 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 17:00:31,934 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 17:00:31,938 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 17:00:31,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:05:30,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:10:51,851 INFO core: Event loop thread started, running loop forever
2026-08-12 17:10:52,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 17:10:52,156 INFO core: _init_accounts coroutine started
2026-08-12 17:10:52,157 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 17:10:52,168 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:15:46,918 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:20:26,167 INFO core: Event loop thread started, running loop forever
2026-08-12 17:20:26,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 17:20:26,472 INFO core: _init_accounts coroutine started
2026-08-12 17:20:26,472 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 17:20:26,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:25:32,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 17:25:43,801 INFO core: Event loop thread started, running loop forever
2026-08-12 17:25:44,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 17:25:44,108 INFO core: _init_accounts coroutine started
2026-08-12 17:25:44,109 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 17:25:44,115 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:30:31,853 INFO core: Event loop thread started, running loop forever
2026-08-12 17:30:32,154 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 17:30:32,159 INFO core: _init_accounts coroutine started
2026-08-12 17:30:32,160 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 17:30:32,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:30:51,887 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 17:35:23,417 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:40:19,475 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 17:40:19,476 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 17:40:19,483 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:45:35,628 INFO core: Event loop thread started, running loop forever
2026-08-12 17:45:35,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 17:45:35,935 INFO core: _init_accounts coroutine started
2026-08-12 17:45:35,935 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 17:45:35,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:50:21,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:55:36,682 INFO core: Event loop thread started, running loop forever
2026-08-12 17:55:36,983 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 17:55:36,989 INFO core: _init_accounts coroutine started
2026-08-12 17:55:36,989 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 17:55:36,996 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 17:55:37,001 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 17:55:37,001 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 17:55:37,003 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 17:55:37,004 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 18:00:35,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:05:22,730 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:10:14,722 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 18:10:14,723 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 18:10:14,728 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:15:07,317 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 18:15:07,319 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 18:15:07,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:20:14,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 18:20:14,416 WARNING core: Account 2: connect timed out after 35s
2026-08-12 18:20:14,417 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 18:20:14,418 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 18:20:32,711 INFO core: Event loop thread started, running loop forever
2026-08-12 18:20:33,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 18:20:33,022 INFO core: _init_accounts coroutine started
2026-08-12 18:20:33,023 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 18:20:33,024 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:25:16,054 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 18:25:16,054 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 18:25:16,056 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 18:25:16,058 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 18:25:16,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:30:13,763 INFO core: Event loop thread started, running loop forever
2026-08-12 18:30:14,065 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 18:30:14,069 INFO core: _init_accounts coroutine started
2026-08-12 18:30:14,071 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 18:30:14,076 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:35:42,536 INFO core: Event loop thread started, running loop forever
2026-08-12 18:35:42,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 18:35:42,843 INFO core: _init_accounts coroutine started
2026-08-12 18:35:42,843 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 18:35:42,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:40:39,143 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:40:39,146 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 18:45:16,522 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 18:45:16,526 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 18:45:16,529 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 18:45:16,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:50:23,346 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 18:50:23,347 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 18:50:23,347 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 18:50:41,319 INFO core: Event loop thread started, running loop forever
2026-08-12 18:50:41,620 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 18:50:41,625 INFO core: _init_accounts coroutine started
2026-08-12 18:50:41,625 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 18:50:41,636 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:55:23,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 18:55:23,701 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 19:00:29,374 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 19:00:38,651 INFO core: Event loop thread started, running loop forever
2026-08-12 19:00:38,952 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 19:00:38,957 INFO core: _init_accounts coroutine started
2026-08-12 19:00:38,957 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 19:00:38,966 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:05:43,390 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:10:06,417 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 19:10:06,429 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:15:12,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:20:33,952 INFO core: Event loop thread started, running loop forever
2026-08-12 19:20:34,254 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 19:20:34,259 INFO core: _init_accounts coroutine started
2026-08-12 19:20:34,261 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 19:20:34,270 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:25:40,411 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 19:25:46,421 INFO core: Event loop thread started, running loop forever
2026-08-12 19:25:46,722 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 19:25:46,726 INFO core: _init_accounts coroutine started
2026-08-12 19:25:46,727 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 19:25:46,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:30:10,113 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 19:30:10,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:35:34,975 INFO core: Event loop thread started, running loop forever
2026-08-12 19:35:35,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 19:35:35,282 INFO core: _init_accounts coroutine started
2026-08-12 19:35:35,282 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 19:35:35,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:40:44,309 INFO core: Event loop thread started, running loop forever
2026-08-12 19:40:44,610 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 19:40:44,614 INFO core: _init_accounts coroutine started
2026-08-12 19:40:44,615 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 19:40:44,628 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 19:40:44,628 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 19:40:44,630 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 19:40:44,631 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 19:40:44,642 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 19:40:44,643 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 19:40:44,647 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 19:40:44,648 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:40:44,648 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 19:45:18,380 INFO core: Event loop thread started, running loop forever
2026-08-12 19:45:18,681 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 19:45:18,683 INFO core: _init_accounts coroutine started
2026-08-12 19:45:18,685 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 19:45:18,699 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-12 19:45:18,700 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-12 19:45:51,416 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 19:50:15,766 INFO core: Event loop thread started, running loop forever
2026-08-12 19:50:16,067 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 19:50:16,073 INFO core: _init_accounts coroutine started
2026-08-12 19:50:16,074 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 19:50:16,083 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:55:18,645 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 19:55:18,646 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 19:55:18,652 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 19:55:18,653 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 20:00:42,653 INFO core: Event loop thread started, running loop forever
2026-08-12 20:00:42,954 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 20:00:42,965 INFO core: _init_accounts coroutine started
2026-08-12 20:00:42,966 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 20:00:42,969 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:05:15,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:10:41,169 INFO core: Event loop thread started, running loop forever
2026-08-12 20:10:41,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 20:10:41,475 INFO core: _init_accounts coroutine started
2026-08-12 20:10:41,475 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 20:10:41,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:15:38,061 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 20:15:38,062 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 20:15:38,064 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 20:15:38,068 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:15:38,069 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 20:20:09,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:25:10,418 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:28:56,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:29:16,987 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 20:29:16,988 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 20:29:16,993 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 20:29:16,995 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 20:29:17,001 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-12 20:29:17,868 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-12 20:30:34,452 WARNING core: Account 2: connect timed out after 35s
2026-08-12 20:30:34,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:35:09,676 WARNING core: Account 2: is_user_authorized timed out after 15s
2026-08-12 20:35:09,678 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-12 20:35:09,680 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-12 20:35:09,681 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 20:35:09,682 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-12 20:35:09,683 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-12 20:35:09,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:40:11,617 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 20:40:11,617 WARNING core: Account 2: connect timed out after 35s
2026-08-12 20:40:11,618 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-12 20:40:11,618 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-12 20:40:11,619 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 20:40:11,620 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-12 20:40:11,621 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-12 20:40:11,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:45:03,391 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 20:45:03,392 WARNING core: Account 2: connect timed out after 35s
2026-08-12 20:45:03,393 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-12 20:45:03,393 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-12 20:45:03,394 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-12 20:45:03,395 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-12 20:45:03,396 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-12 20:45:43,437 INFO core: Event loop thread started, running loop forever
2026-08-12 20:45:43,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 20:45:43,742 INFO core: _init_accounts coroutine started
2026-08-12 20:45:43,743 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 20:45:43,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:50:21,324 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 20:50:21,324 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 20:50:21,327 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 20:50:21,329 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 20:50:21,331 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 20:55:27,403 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 20:55:37,367 INFO core: Event loop thread started, running loop forever
2026-08-12 20:55:37,668 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 20:55:37,672 INFO core: _init_accounts coroutine started
2026-08-12 20:55:37,674 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 20:55:37,685 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:00:13,238 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:05:15,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 21:05:15,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 21:05:15,438 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:10:22,076 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 21:10:26,455 INFO core: Event loop thread started, running loop forever
2026-08-12 21:10:26,756 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 21:10:26,761 INFO core: _init_accounts coroutine started
2026-08-12 21:10:26,762 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 21:10:26,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:15:33,383 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 21:15:53,391 INFO core: Event loop thread started, running loop forever
2026-08-12 21:15:53,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 21:15:53,699 INFO core: _init_accounts coroutine started
2026-08-12 21:15:53,700 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 21:15:53,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:20:36,963 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 21:20:36,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:25:05,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:30:46,132 INFO core: Event loop thread started, running loop forever
2026-08-12 21:30:46,433 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 21:30:46,439 INFO core: _init_accounts coroutine started
2026-08-12 21:30:46,440 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 21:30:46,450 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:35:08,990 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 21:35:08,991 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 21:35:08,999 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 21:35:09,001 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 21:35:09,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:40:16,358 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 21:40:16,359 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 21:40:16,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 21:40:46,778 INFO core: Event loop thread started, running loop forever
2026-08-12 21:40:47,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 21:40:47,084 INFO core: _init_accounts coroutine started
2026-08-12 21:40:47,085 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 21:40:47,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:45:14,455 INFO core: Event loop thread started, running loop forever
2026-08-12 21:45:14,756 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 21:45:14,761 INFO core: _init_accounts coroutine started
2026-08-12 21:45:14,762 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 21:45:14,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:50:12,377 INFO core: Event loop thread started, running loop forever
2026-08-12 21:50:12,679 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 21:50:12,683 INFO core: _init_accounts coroutine started
2026-08-12 21:50:12,684 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 21:50:12,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 21:55:27,817 INFO core: Event loop thread started, running loop forever
2026-08-12 21:55:28,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 21:55:28,125 INFO core: _init_accounts coroutine started
2026-08-12 21:55:28,126 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 21:55:28,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:00:34,343 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 22:00:34,344 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 22:00:34,344 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-12 22:00:34,345 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 22:00:34,345 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-12 22:00:38,377 INFO core: Event loop thread started, running loop forever
2026-08-12 22:00:38,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:00:38,682 INFO core: _init_accounts coroutine started
2026-08-12 22:00:38,684 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:00:38,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:05:04,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:10:13,606 INFO core: Event loop thread started, running loop forever
2026-08-12 22:10:13,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:10:13,912 INFO core: _init_accounts coroutine started
2026-08-12 22:10:13,912 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:10:13,924 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 22:10:13,924 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 22:10:13,925 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:15:20,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 22:15:20,381 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-12 22:15:20,382 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 22:15:22,864 INFO core: Event loop thread started, running loop forever
2026-08-12 22:15:23,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:15:23,170 INFO core: _init_accounts coroutine started
2026-08-12 22:15:23,172 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:15:23,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:20:29,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 22:20:49,217 INFO core: Event loop thread started, running loop forever
2026-08-12 22:20:49,518 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:20:49,522 INFO core: _init_accounts coroutine started
2026-08-12 22:20:49,523 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:20:49,533 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:25:09,148 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 22:25:09,148 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 22:25:09,172 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 22:25:09,175 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 22:25:09,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:30:37,310 INFO core: Event loop thread started, running loop forever
2026-08-12 22:30:37,610 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:30:37,615 INFO core: _init_accounts coroutine started
2026-08-12 22:30:37,616 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:30:37,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:35:28,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:40:33,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:45:54,032 INFO core: Event loop thread started, running loop forever
2026-08-12 22:45:54,334 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:45:54,339 INFO core: _init_accounts coroutine started
2026-08-12 22:45:54,339 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:45:54,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:50:48,906 INFO core: Event loop thread started, running loop forever
2026-08-12 22:50:49,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:50:49,212 INFO core: _init_accounts coroutine started
2026-08-12 22:50:49,213 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:50:49,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 22:55:11,757 INFO core: Event loop thread started, running loop forever
2026-08-12 22:55:12,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 22:55:12,064 INFO core: _init_accounts coroutine started
2026-08-12 22:55:12,065 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 22:55:12,076 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:00:04,337 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-12 23:00:11,659 INFO core: Event loop thread started, running loop forever
2026-08-12 23:00:11,960 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 23:00:11,966 INFO core: _init_accounts coroutine started
2026-08-12 23:00:11,967 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 23:00:11,973 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:05:17,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 23:05:23,908 INFO core: Event loop thread started, running loop forever
2026-08-12 23:05:24,209 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 23:05:24,213 INFO core: _init_accounts coroutine started
2026-08-12 23:05:24,214 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 23:05:24,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:05:24,227 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 23:05:24,227 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 23:10:31,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 23:10:31,121 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 23:10:31,121 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-12 23:10:31,122 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 23:10:31,122 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-12 23:10:49,658 INFO core: Event loop thread started, running loop forever
2026-08-12 23:10:49,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 23:10:49,962 INFO core: _init_accounts coroutine started
2026-08-12 23:10:49,963 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 23:10:49,972 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:15:16,127 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 23:15:16,128 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 23:15:16,129 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 23:15:16,131 INFO core: _init_accounts_inner: reloading LLM config
2026-08-12 23:15:16,142 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-12 23:15:16,142 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-12 23:15:16,147 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-12 23:15:16,148 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-12 23:15:16,172 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:20:22,356 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-12 23:20:47,078 INFO core: Event loop thread started, running loop forever
2026-08-12 23:20:47,379 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 23:20:47,383 INFO core: _init_accounts coroutine started
2026-08-12 23:20:47,385 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 23:20:47,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:25:16,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:30:28,061 INFO core: Event loop thread started, running loop forever
2026-08-12 23:30:28,362 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 23:30:28,372 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:35:08,991 INFO core: _init_accounts coroutine started
2026-08-12 23:35:08,991 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 23:35:09,002 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-12 23:35:09,002 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-12 23:35:09,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:40:07,072 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-12 23:40:07,076 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:45:27,981 INFO core: Event loop thread started, running loop forever
2026-08-12 23:45:28,292 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 23:45:28,311 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:50:22,973 INFO core: _init_accounts coroutine started
2026-08-12 23:50:22,974 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 23:50:22,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-12 23:55:48,239 INFO core: Event loop thread started, running loop forever
2026-08-12 23:55:48,540 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-12 23:55:48,545 INFO core: _init_accounts coroutine started
2026-08-12 23:55:48,546 INFO core: _init_accounts_inner: starting DB migrations
2026-08-12 23:55:48,557 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:00:41,379 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:00:41,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 00:00:41,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 00:05:48,416 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 00:05:52,670 INFO core: Event loop thread started, running loop forever
2026-08-13 00:05:52,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 00:05:52,975 INFO core: _init_accounts coroutine started
2026-08-13 00:05:52,976 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 00:05:52,988 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 00:05:52,988 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 00:05:52,989 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 00:05:52,993 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 00:05:52,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:10:40,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:15:07,935 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 00:15:07,935 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 00:15:07,941 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 00:15:07,941 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 00:15:07,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:20:13,388 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 00:20:13,389 WARNING core: Account 2: connect timed out after 35s
2026-08-13 00:20:13,389 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 00:20:13,390 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 00:20:32,738 INFO core: Event loop thread started, running loop forever
2026-08-13 00:20:33,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 00:20:33,045 INFO core: _init_accounts coroutine started
2026-08-13 00:20:33,046 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 00:20:33,067 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 00:20:33,067 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 00:20:33,070 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:20:33,072 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 00:25:38,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:30:11,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:35:08,323 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 00:35:08,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:40:13,652 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:45:31,827 INFO core: Event loop thread started, running loop forever
2026-08-13 00:45:32,128 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 00:45:32,135 INFO core: _init_accounts coroutine started
2026-08-13 00:45:32,135 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 00:45:32,142 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:50:42,868 INFO core: Event loop thread started, running loop forever
2026-08-13 00:50:43,173 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 00:50:43,180 INFO core: _init_accounts coroutine started
2026-08-13 00:50:43,181 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 00:50:43,190 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:55:23,177 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 00:55:23,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 00:55:23,180 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 01:00:51,086 INFO core: Event loop thread started, running loop forever
2026-08-13 01:00:51,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 01:00:51,391 INFO core: _init_accounts coroutine started
2026-08-13 01:00:51,397 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:00:51,398 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 01:05:51,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:10:44,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 01:10:44,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 01:10:44,422 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:10:44,423 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 01:15:03,349 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 01:15:03,350 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-13 01:15:03,351 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 01:15:03,351 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 01:15:52,384 INFO core: Event loop thread started, running loop forever
2026-08-13 01:15:52,685 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 01:15:52,689 INFO core: _init_accounts coroutine started
2026-08-13 01:15:52,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 01:15:52,698 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:20:33,504 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:25:30,100 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:30:41,263 INFO core: Event loop thread started, running loop forever
2026-08-13 01:30:41,566 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 01:30:41,570 INFO core: _init_accounts coroutine started
2026-08-13 01:30:41,571 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 01:30:41,580 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:35:35,970 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:40:27,557 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 01:40:27,586 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:45:32,939 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:50:48,038 INFO core: Event loop thread started, running loop forever
2026-08-13 01:50:48,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 01:50:48,343 INFO core: _init_accounts coroutine started
2026-08-13 01:50:48,345 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 01:50:48,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 01:55:10,345 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 01:55:10,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:00:39,046 INFO core: Event loop thread started, running loop forever
2026-08-13 02:00:39,347 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 02:00:39,351 INFO core: _init_accounts coroutine started
2026-08-13 02:00:39,352 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 02:00:39,364 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:05:46,421 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 02:05:47,833 INFO core: Event loop thread started, running loop forever
2026-08-13 02:05:48,134 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 02:05:48,140 INFO core: _init_accounts coroutine started
2026-08-13 02:05:48,140 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 02:05:48,159 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:10:04,338 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 02:10:04,338 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 02:10:04,340 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 02:10:04,341 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 02:10:04,354 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 02:10:04,355 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 02:10:04,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:10:04,361 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 02:10:04,362 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 02:15:11,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 02:15:11,395 WARNING core: Account 2: connect timed out after 35s
2026-08-13 02:15:11,396 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 02:15:11,396 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 02:15:11,397 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 02:15:11,398 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 02:15:11,398 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 02:15:19,858 INFO core: Event loop thread started, running loop forever
2026-08-13 02:15:20,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 02:15:20,165 INFO core: _init_accounts coroutine started
2026-08-13 02:15:20,165 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 02:15:20,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:20:11,955 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 02:20:11,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:25:34,660 INFO core: Event loop thread started, running loop forever
2026-08-13 02:25:34,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 02:25:34,966 INFO core: _init_accounts coroutine started
2026-08-13 02:25:34,966 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 02:25:34,979 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:30:27,048 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 02:30:27,048 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 02:30:27,050 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:30:27,052 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 02:35:14,682 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 02:35:14,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:40:21,430 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 02:40:51,714 INFO core: Event loop thread started, running loop forever
2026-08-13 02:40:52,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 02:40:52,019 INFO core: _init_accounts coroutine started
2026-08-13 02:40:52,020 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 02:40:52,040 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 02:40:52,040 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 02:40:52,044 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 02:40:52,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:45:09,336 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 02:45:09,354 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:50:14,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 02:50:14,066 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 02:50:14,067 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 02:50:14,071 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 02:50:14,072 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 02:55:13,349 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 02:55:13,350 WARNING core: Account 2: connect timed out after 35s
2026-08-13 02:55:13,350 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 02:55:13,350 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 02:55:13,352 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 02:55:13,353 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 02:55:13,354 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 02:55:13,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:00:11,870 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 03:00:11,871 WARNING core: Account 2: connect timed out after 35s
2026-08-13 03:00:11,872 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 03:00:11,872 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 03:00:11,873 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 03:00:11,874 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 03:00:11,875 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 03:00:11,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:05:27,411 INFO core: Event loop thread started, running loop forever
2026-08-13 03:05:27,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:05:27,718 INFO core: _init_accounts coroutine started
2026-08-13 03:05:27,718 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:05:27,724 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:10:26,042 INFO core: Event loop thread started, running loop forever
2026-08-13 03:10:26,350 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:10:26,355 INFO core: _init_accounts coroutine started
2026-08-13 03:10:26,356 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:10:26,362 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:15:27,490 INFO core: Event loop thread started, running loop forever
2026-08-13 03:15:27,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:15:27,796 INFO core: _init_accounts coroutine started
2026-08-13 03:15:27,796 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:15:27,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:20:25,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:25:23,845 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:30:10,391 INFO core: Event loop thread started, running loop forever
2026-08-13 03:30:10,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:30:10,701 INFO core: _init_accounts coroutine started
2026-08-13 03:30:10,701 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:30:10,724 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:35:43,674 INFO core: Event loop thread started, running loop forever
2026-08-13 03:35:43,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:35:43,979 INFO core: _init_accounts coroutine started
2026-08-13 03:35:43,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:35:43,986 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:40:19,025 INFO core: Event loop thread started, running loop forever
2026-08-13 03:40:19,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:40:19,330 INFO core: _init_accounts coroutine started
2026-08-13 03:40:19,331 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:40:19,340 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:45:53,277 INFO core: Event loop thread started, running loop forever
2026-08-13 03:45:53,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:45:53,583 INFO core: _init_accounts coroutine started
2026-08-13 03:45:53,584 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:45:53,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:50:18,284 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 03:50:18,295 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 03:55:44,910 INFO core: Event loop thread started, running loop forever
2026-08-13 03:55:45,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 03:55:45,219 INFO core: _init_accounts coroutine started
2026-08-13 03:55:45,221 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 03:55:45,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:00:27,044 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 04:00:27,053 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:05:10,868 INFO core: Event loop thread started, running loop forever
2026-08-13 04:05:11,170 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 04:05:11,176 INFO core: _init_accounts coroutine started
2026-08-13 04:05:11,177 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 04:05:11,182 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:10:17,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 04:10:19,706 INFO core: Event loop thread started, running loop forever
2026-08-13 04:10:20,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 04:10:20,012 INFO core: _init_accounts coroutine started
2026-08-13 04:10:20,014 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 04:10:20,027 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:15:25,979 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 04:15:25,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 04:15:25,983 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 04:15:25,985 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:15:25,986 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 04:20:40,901 INFO core: Event loop thread started, running loop forever
2026-08-13 04:20:41,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 04:20:41,208 INFO core: _init_accounts coroutine started
2026-08-13 04:20:41,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 04:20:41,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:25:04,456 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:30:07,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:35:17,658 INFO core: Event loop thread started, running loop forever
2026-08-13 04:35:17,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 04:35:17,964 INFO core: _init_accounts coroutine started
2026-08-13 04:35:17,965 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 04:35:17,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:40:16,539 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:45:23,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 04:45:23,443 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 04:45:23,443 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-13 04:45:27,638 INFO core: Event loop thread started, running loop forever
2026-08-13 04:45:27,939 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 04:45:27,943 INFO core: _init_accounts coroutine started
2026-08-13 04:45:27,944 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 04:45:27,956 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:50:07,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 04:55:13,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 04:55:13,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 04:55:13,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 04:55:13,418 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-13 04:55:13,418 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 04:55:13,418 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-13 04:55:13,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 04:55:13,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 04:55:45,206 INFO core: Event loop thread started, running loop forever
2026-08-13 04:55:45,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 04:55:45,522 INFO core: _init_accounts coroutine started
2026-08-13 04:55:45,523 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 04:55:45,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:00:37,219 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 05:00:37,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:05:16,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:10:52,874 INFO core: Event loop thread started, running loop forever
2026-08-13 05:10:53,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 05:10:53,179 INFO core: _init_accounts coroutine started
2026-08-13 05:10:53,180 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 05:10:53,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:15:43,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:20:42,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 05:20:42,458 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 05:20:42,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:25:26,327 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 05:25:26,341 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 05:25:26,344 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:30:14,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:35:20,390 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 05:35:34,678 INFO core: Event loop thread started, running loop forever
2026-08-13 05:35:34,979 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 05:35:34,984 INFO core: _init_accounts coroutine started
2026-08-13 05:35:34,986 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 05:35:34,996 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:40:39,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:45:45,666 INFO core: Event loop thread started, running loop forever
2026-08-13 05:45:45,966 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 05:45:45,970 INFO core: _init_accounts coroutine started
2026-08-13 05:45:45,971 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 05:45:45,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:50:04,445 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 05:50:04,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 05:55:11,519 INFO core: Event loop thread started, running loop forever
2026-08-13 05:55:11,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 05:55:11,825 INFO core: _init_accounts coroutine started
2026-08-13 05:55:11,827 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 05:55:11,835 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:00:33,901 INFO core: Event loop thread started, running loop forever
2026-08-13 06:00:34,202 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 06:00:34,208 INFO core: _init_accounts coroutine started
2026-08-13 06:00:34,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 06:00:34,217 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:05:27,518 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 06:05:27,550 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:10:21,265 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:15:35,465 INFO core: Event loop thread started, running loop forever
2026-08-13 06:15:35,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 06:15:35,781 INFO core: _init_accounts coroutine started
2026-08-13 06:15:35,781 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 06:15:35,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:20:08,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:25:14,541 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 06:25:45,049 INFO core: Event loop thread started, running loop forever
2026-08-13 06:25:45,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 06:25:45,356 INFO core: _init_accounts coroutine started
2026-08-13 06:25:45,357 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 06:25:45,369 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:30:09,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 06:30:09,536 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 06:30:09,540 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 06:30:09,543 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:35:35,393 INFO core: Event loop thread started, running loop forever
2026-08-13 06:35:35,701 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 06:35:35,715 INFO core: _init_accounts coroutine started
2026-08-13 06:35:35,715 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 06:35:35,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:35:35,724 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 06:35:35,729 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 06:40:47,665 INFO core: Event loop thread started, running loop forever
2026-08-13 06:40:47,966 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 06:40:47,971 INFO core: _init_accounts coroutine started
2026-08-13 06:40:47,972 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 06:40:47,985 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:45:43,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:50:10,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 06:55:46,290 INFO core: Event loop thread started, running loop forever
2026-08-13 06:55:46,591 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 06:55:46,596 INFO core: _init_accounts coroutine started
2026-08-13 06:55:46,597 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 06:55:46,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:00:48,976 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:05:03,618 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 07:05:03,620 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 07:05:03,623 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 07:05:03,629 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 07:05:03,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:10:26,959 INFO core: Event loop thread started, running loop forever
2026-08-13 07:10:27,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 07:10:27,266 INFO core: _init_accounts coroutine started
2026-08-13 07:10:27,266 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 07:10:27,275 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:15:27,173 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 07:15:27,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:15:27,175 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 07:20:11,353 INFO core: Event loop thread started, running loop forever
2026-08-13 07:20:11,655 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 07:20:11,659 INFO core: _init_accounts coroutine started
2026-08-13 07:20:11,661 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 07:20:11,667 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:20:33,381 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 07:25:19,840 INFO core: Event loop thread started, running loop forever
2026-08-13 07:25:20,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 07:25:20,145 INFO core: _init_accounts coroutine started
2026-08-13 07:25:20,147 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 07:25:20,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:30:06,071 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 07:30:06,073 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 07:30:06,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:35:09,043 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 07:35:09,061 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 07:35:09,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:40:12,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:45:26,096 INFO core: Event loop thread started, running loop forever
2026-08-13 07:45:26,397 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 07:45:26,404 INFO core: _init_accounts coroutine started
2026-08-13 07:45:26,405 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 07:45:26,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:50:14,331 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 07:50:14,343 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 07:55:34,229 INFO core: Event loop thread started, running loop forever
2026-08-13 07:55:34,530 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 07:55:34,534 INFO core: _init_accounts coroutine started
2026-08-13 07:55:34,535 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 07:55:34,546 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 07:55:34,546 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 07:55:34,547 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 07:55:34,549 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 07:55:34,559 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:00:20,100 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 08:00:20,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:00:20,102 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 08:05:10,070 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:05:10,071 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:05:10,083 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:10:17,809 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:10:17,809 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:10:17,810 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:10:17,810 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:10:17,811 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:10:17,812 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:10:17,813 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:10:41,767 INFO core: Event loop thread started, running loop forever
2026-08-13 08:10:42,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 08:10:42,087 INFO core: _init_accounts coroutine started
2026-08-13 08:10:42,087 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 08:10:42,100 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 08:10:42,101 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 08:10:42,102 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 08:10:42,104 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 08:10:42,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:15:23,597 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:20:30,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 08:20:30,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 08:20:30,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 08:20:37,072 INFO core: Event loop thread started, running loop forever
2026-08-13 08:20:37,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 08:20:37,380 INFO core: _init_accounts coroutine started
2026-08-13 08:20:37,380 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 08:20:37,391 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:25:08,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:25:43,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:25:51,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 08:25:51,693 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 08:25:51,695 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 08:25:51,696 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 08:29:46,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 08:29:46,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 08:29:46,428 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:29:46,429 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:29:46,481 INFO core: Loaded 241 dialog(s) from cache (account 2)
2026-08-13 08:29:47,112 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:29:47,123 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:30:22,948 INFO core: Event loop thread started, running loop forever
2026-08-13 08:30:23,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 08:30:23,253 INFO core: _init_accounts coroutine started
2026-08-13 08:30:23,254 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 08:30:23,262 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:30:31,653 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:30:55,627 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 08:30:55,627 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 08:30:55,631 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 08:30:55,634 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:31:28,646 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 08:31:28,666 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 08:31:28,666 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 08:31:28,667 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:32:00,937 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:32:00,940 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:32:00,943 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:32:32,479 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:32:32,481 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:32:32,493 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:32:32,493 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:32:32,494 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:32:32,495 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:32:32,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:33:05,390 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:33:05,391 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:33:05,393 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:33:05,394 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:33:05,395 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:33:05,395 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:33:05,398 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:33:38,356 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:33:38,357 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:33:38,360 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:33:38,360 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:33:38,361 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:33:38,361 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:33:38,366 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:34:10,704 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:34:10,705 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:34:10,713 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:34:10,713 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:34:10,714 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:34:10,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:34:10,716 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:34:52,319 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:34:52,320 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:34:52,321 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:34:52,321 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:34:52,322 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:34:52,322 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:34:52,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:35:35,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:35:37,234 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:35:37,235 INFO core: Signal processor started
2026-08-13 08:35:37,236 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-13 08:35:37,237 INFO core: Memory RSS: 91.84 MB
2026-08-13 08:35:37,240 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:36:07,659 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:36:07,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:36:40,355 INFO core: Memory RSS: 91.87 MB
2026-08-13 08:36:40,356 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:36:40,357 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:36:40,357 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:36:40,359 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 08:36:40,359 INFO core: _init_accounts coroutine started
2026-08-13 08:36:40,360 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 08:36:40,362 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:37:12,983 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:37:12,985 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:37:12,988 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:37:12,989 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:37:12,991 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:37:12,992 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:37:12,996 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 08:37:12,996 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 08:37:12,999 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 08:37:12,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:37:45,517 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:37:45,518 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:37:45,518 INFO core: Memory RSS: 91.89 MB
2026-08-13 08:37:45,519 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:37:45,523 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:37:45,525 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:37:45,525 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:38:18,062 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 08:38:18,063 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:38:18,064 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:38:18,077 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:38:18,078 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:38:50,606 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:38:50,606 INFO core: Memory RSS: 91.89 MB
2026-08-13 08:38:50,607 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:38:50,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:38:50,614 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:38:50,615 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:38:50,616 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:38:50,618 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:39:23,340 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:39:23,348 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:39:56,228 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:39:56,230 INFO core: Memory RSS: 91.96 MB
2026-08-13 08:39:56,231 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:39:56,233 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:39:56,233 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:39:56,234 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:39:56,234 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:39:56,243 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:39:56,243 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 08:39:56,244 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 08:39:56,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:40:29,315 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:40:29,316 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:40:29,317 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:40:29,318 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:40:29,322 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:40:29,323 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:40:29,324 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:40:29,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:40:29,328 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:40:38,053 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:40:38,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:41:01,594 INFO core: Memory RSS: 92.00 MB
2026-08-13 08:41:01,604 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:41:01,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:41:01,606 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:41:01,609 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:41:39,215 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:41:39,223 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:41:39,224 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:41:39,225 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:41:39,225 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:41:39,228 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:41:39,229 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:41:39,230 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:41:39,233 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:41:39,234 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:42:11,332 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:42:11,333 WARNING core: Account 2: is_user_authorized timed out after 15s
2026-08-13 08:42:11,334 INFO core: Memory RSS: 92.44 MB
2026-08-13 08:42:11,336 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:42:11,338 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:42:11,341 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:42:11,342 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:42:11,343 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:42:11,344 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:42:11,345 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:42:11,346 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:42:11,347 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:42:11,348 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:42:11,349 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:42:43,759 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:42:43,760 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:42:43,760 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:42:43,761 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:42:43,763 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:42:43,765 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:42:43,766 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:42:43,766 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:42:43,766 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:42:43,767 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:42:43,768 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:42:43,768 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:42:43,769 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:42:43,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:43:16,237 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:43:16,238 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:43:16,239 INFO core: Memory RSS: 92.52 MB
2026-08-13 08:43:16,241 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:43:16,244 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:43:16,247 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:43:16,248 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:43:16,248 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:43:16,250 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:43:16,251 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:43:48,715 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:43:48,716 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:43:48,717 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:43:48,718 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:43:48,720 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:43:48,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:44:21,629 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:44:21,630 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:44:21,631 INFO core: Memory RSS: 92.52 MB
2026-08-13 08:44:21,633 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:44:21,635 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:44:21,637 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:44:21,637 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:44:21,638 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:44:21,638 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:44:21,638 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:44:21,639 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:44:21,639 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:44:21,646 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:44:53,847 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:44:53,848 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:44:53,851 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:44:53,851 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:44:53,851 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:44:53,852 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:44:53,856 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:44:53,856 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-13 08:44:53,856 INFO core: Memory RSS: 92.52 MB
2026-08-13 08:44:53,859 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:44:53,861 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:44:53,861 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:44:53,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:45:13,263 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:45:13,264 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:45:13,267 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:45:13,267 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:45:13,268 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:45:13,268 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:45:13,282 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 08:45:13,284 INFO core: _init_accounts coroutine started
2026-08-13 08:45:13,285 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:45:13,286 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 08:45:26,718 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:45:26,720 INFO core: Memory RSS: 92.61 MB
2026-08-13 08:45:26,724 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:45:26,730 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:45:26,731 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:45:26,733 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:45:26,734 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:45:26,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:45:26,741 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:45:26,751 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:45:26,752 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:45:26,754 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:45:26,754 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:45:59,842 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:45:59,843 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:45:59,846 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:46:32,549 INFO core: Memory RSS: 92.76 MB
2026-08-13 08:46:32,550 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 08:46:32,550 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 08:46:32,551 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:46:32,554 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:46:32,558 INFO core: Memory RSS: 92.76 MB
2026-08-13 08:46:32,559 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:46:32,559 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:46:32,559 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:46:32,559 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:46:32,560 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:46:32,561 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:46:32,563 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:46:32,563 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:46:32,565 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:46:32,565 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 08:46:32,566 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:46:32,566 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:47:04,922 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:47:04,924 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:47:04,925 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 08:47:04,927 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 08:47:04,928 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:47:04,932 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:47:04,936 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:47:04,937 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:47:04,937 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:47:04,938 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:47:04,940 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:47:04,942 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:47:04,943 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:47:04,947 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:47:04,949 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:47:04,951 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:47:04,966 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:47:37,464 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:47:37,465 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:47:37,466 INFO core: Memory RSS: 92.79 MB
2026-08-13 08:47:37,467 INFO core: Memory RSS: 92.79 MB
2026-08-13 08:47:37,468 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:47:37,471 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:47:37,474 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:47:37,474 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:47:37,475 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:47:37,475 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:47:37,476 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:47:37,477 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:47:37,477 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:47:37,483 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:47:37,497 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:47:37,498 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:47:37,498 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 08:48:11,447 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 08:48:11,449 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:48:11,452 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:48:11,453 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:48:11,454 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:48:11,457 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:48:11,458 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:48:11,459 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:48:11,460 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:48:11,472 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:48:11,474 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:48:11,475 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:48:43,822 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:48:43,823 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:48:43,825 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:48:43,826 INFO core: Memory RSS: 92.80 MB
2026-08-13 08:48:43,827 INFO core: Memory RSS: 92.80 MB
2026-08-13 08:48:43,828 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:48:43,829 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:48:43,831 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:48:43,832 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:48:43,836 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:48:43,836 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:48:43,836 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:48:43,838 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:48:43,839 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:48:43,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:48:43,840 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:48:43,841 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:49:16,325 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:49:16,326 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:49:16,327 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:49:16,329 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:49:16,335 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:49:16,338 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:49:16,339 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:49:16,340 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:49:16,341 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:49:16,343 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:49:16,345 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:49:16,345 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:49:16,347 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:49:16,351 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:49:16,351 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:49:48,817 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:49:48,819 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:49:48,820 INFO core: Memory RSS: 92.87 MB
2026-08-13 08:49:48,822 INFO core: Memory RSS: 92.87 MB
2026-08-13 08:49:48,824 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:49:48,825 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:49:48,829 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:49:48,832 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:49:48,833 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:49:48,834 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:49:48,834 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:49:48,836 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:49:48,837 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:49:48,839 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:49:48,841 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:49:48,843 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:49:48,844 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:49:48,845 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:50:10,650 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:50:10,651 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:50:10,651 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:50:10,652 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:50:10,653 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:50:10,656 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:50:10,658 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:50:10,660 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:50:10,661 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:50:10,661 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:50:10,662 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:50:10,662 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:50:10,662 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:50:10,664 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:50:10,664 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:50:10,665 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:50:10,665 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:50:10,666 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:50:10,668 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:50:21,000 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:50:21,002 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:50:21,003 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:50:21,007 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:50:21,007 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:50:21,008 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:50:21,008 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:50:21,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:50:21,016 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:50:53,311 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:50:53,312 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:50:53,312 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:50:53,313 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:50:53,313 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:50:53,314 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:50:53,314 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:50:53,315 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:50:53,315 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:50:53,316 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:50:53,316 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:50:53,317 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:50:53,319 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:50:53,319 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:50:53,320 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:50:53,320 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:50:53,320 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:50:53,321 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:50:53,322 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:50:53,322 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:50:53,323 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:50:53,325 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:51:25,644 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:51:25,645 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:51:25,646 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:51:25,652 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:51:25,657 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:51:25,658 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:51:25,659 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:51:25,660 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:51:25,662 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:51:25,664 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:51:25,665 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:51:25,666 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-13 08:51:25,667 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:51:25,667 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:51:58,336 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:51:58,336 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:51:58,337 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:51:58,338 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:51:58,339 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:51:58,342 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 08:51:58,343 INFO core: _init_accounts coroutine started
2026-08-13 08:51:58,343 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 08:51:58,346 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:51:58,351 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 08:51:58,351 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 08:51:58,353 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:51:58,354 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 08:52:30,819 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:52:30,820 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:52:30,824 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:52:30,825 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:52:30,829 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 08:52:30,831 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:52:30,833 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:52:30,838 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:52:30,844 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:52:30,846 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:52:30,850 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:52:30,850 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:52:30,857 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:52:30,857 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:53:03,815 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:53:03,819 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:53:03,820 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:53:03,822 INFO core: Memory RSS: 92.89 MB
2026-08-13 08:53:03,826 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:53:03,828 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:53:03,831 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:53:03,837 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:53:03,846 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:53:03,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:53:03,848 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:53:03,851 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:53:03,852 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:53:36,808 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:53:36,809 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:53:36,809 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:53:36,813 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:53:36,814 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:53:36,819 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:53:36,819 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:53:36,822 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:53:36,823 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:53:36,825 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:53:36,826 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:53:36,827 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:53:36,833 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:53:36,835 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:53:36,839 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 08:53:36,840 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 08:53:36,842 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:53:36,842 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:54:09,558 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:54:09,558 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:54:09,559 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:54:09,559 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:54:09,560 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:54:09,560 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:54:09,561 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:54:09,561 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:54:09,565 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:54:09,567 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:54:09,576 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:54:09,580 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:54:09,580 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:54:09,581 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:54:09,581 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:54:09,581 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:54:09,582 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:54:09,582 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:54:09,583 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:54:09,584 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:54:09,584 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:54:09,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:54:09,585 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:54:09,586 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:54:09,587 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:54:09,589 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:54:42,419 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:54:42,420 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:54:42,421 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:54:42,421 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:54:42,424 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:54:42,430 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:54:42,431 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:55:15,330 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:55:15,330 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:55:15,333 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:55:15,338 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:55:15,340 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:55:36,628 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:55:36,630 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:55:48,172 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:55:48,173 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:55:48,173 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:55:48,174 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:55:48,175 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:55:48,175 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:55:48,176 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:55:48,177 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:55:48,177 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:55:48,181 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:55:48,182 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:55:48,189 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:55:48,190 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:55:48,190 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:55:48,190 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:55:48,190 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:55:48,191 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:55:48,192 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:55:48,192 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:55:48,192 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:56:20,958 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:56:20,960 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:56:53,384 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:56:53,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:56:53,386 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:56:53,387 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:56:53,388 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:56:53,388 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:56:53,389 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:56:53,389 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:56:53,390 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:56:53,391 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:56:53,391 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:56:53,392 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:56:53,393 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:56:53,398 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:56:53,399 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:56:53,400 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:56:53,400 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:56:53,401 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:56:53,402 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:56:53,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:56:53,403 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:56:53,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:56:53,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:57:25,760 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:57:25,761 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:57:25,761 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:57:25,762 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:57:25,762 WARNING core: Account 2: connect timed out after 35s
2026-08-13 08:57:25,762 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:57:25,763 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:57:25,763 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:57:25,764 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:57:25,767 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:57:25,769 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:57:25,772 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:57:25,773 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:57:25,774 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:57:25,774 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:57:25,775 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:57:25,775 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:57:25,776 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 08:57:25,777 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:57:25,778 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:57:25,779 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:57:25,780 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:57:25,781 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:57:25,784 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:57:25,784 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 08:57:25,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:57:25,786 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:57:58,605 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:57:58,607 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:57:58,608 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:57:58,608 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:57:58,608 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:57:58,608 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:57:58,611 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:57:58,614 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:57:58,617 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:57:58,622 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:57:58,625 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:57:58,625 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:57:58,626 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:57:58,626 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:57:58,627 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 08:57:58,627 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 08:57:58,629 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:57:58,629 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:57:58,630 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:57:58,631 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:57:58,633 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 08:57:58,634 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 08:57:58,637 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:57:58,638 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:57:58,641 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:57:58,642 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:57:58,642 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:57:58,643 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-13 08:57:58,643 INFO core: Memory RSS: 92.90 MB
2026-08-13 08:58:31,522 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:58:31,522 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:58:31,528 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:58:31,537 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:58:31,548 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:58:31,551 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:58:31,553 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 08:58:31,554 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 08:58:31,557 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:58:31,558 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:58:31,559 INFO core: Watchdog: connecting missing account 2
2026-08-13 08:58:31,561 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:58:31,563 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:58:31,564 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 08:58:31,566 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:58:31,567 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 08:58:31,568 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:58:31,569 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:58:31,570 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:58:31,571 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 08:58:31,571 INFO core: _init_accounts coroutine started
2026-08-13 08:58:31,572 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 08:58:31,572 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:58:31,575 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 08:58:31,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:59:04,407 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:59:04,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:59:04,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:59:04,410 INFO core: Memory RSS: 93.07 MB
2026-08-13 08:59:04,411 INFO core: Memory RSS: 93.07 MB
2026-08-13 08:59:04,411 INFO core: Memory RSS: 93.07 MB
2026-08-13 08:59:04,412 INFO core: Memory RSS: 93.07 MB
2026-08-13 08:59:04,414 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 08:59:04,415 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 08:59:04,415 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:59:04,419 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:59:04,424 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:59:04,427 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:59:04,428 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:59:04,428 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:59:04,428 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:59:04,430 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 08:59:04,430 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 08:59:04,432 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:59:04,434 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:59:04,436 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 08:59:04,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:59:04,437 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:59:04,442 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:59:04,447 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 08:59:36,561 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:59:36,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 08:59:36,562 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:59:36,562 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:59:36,563 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:59:36,563 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 08:59:36,564 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:59:36,564 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 08:59:36,564 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:59:36,568 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:59:36,570 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 08:59:36,571 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:59:36,571 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:59:36,572 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 08:59:36,572 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 08:59:36,572 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 08:59:36,573 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 08:59:36,575 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:59:36,575 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 08:59:36,576 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 08:59:36,576 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 08:59:36,577 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 08:59:36,579 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 09:00:08,632 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 09:00:08,635 INFO core: Watchdog: connecting missing account 2
2026-08-13 09:00:08,635 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 09:00:08,637 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:00:08,638 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:00:08,640 INFO core: Memory RSS: 93.30 MB
2026-08-13 09:00:08,642 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:00:08,643 INFO core: Memory RSS: 93.30 MB
2026-08-13 09:00:09,365 INFO core: Memory RSS: 93.30 MB
2026-08-13 09:00:09,367 INFO core: Memory RSS: 93.30 MB
2026-08-13 09:00:09,370 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:00:09,376 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:00:09,382 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 09:00:09,385 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 09:00:09,386 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 09:00:09,387 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 09:00:09,389 INFO telethon.network.mtprotosender: Connection to 91.108.56.182:443/TcpAbridged complete!
2026-08-13 09:00:09,392 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 09:00:09,395 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 09:00:09,398 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 09:00:09,401 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 09:00:09,403 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 09:00:09,404 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:00:09,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 09:00:09,407 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:00:41,729 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:00:41,733 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:00:41,735 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:00:41,736 WARNING core: Account 2: connect timed out after 35s
2026-08-13 09:00:41,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:00:41,745 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:00:41,746 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:01:14,631 INFO core: Event loop thread started, running loop forever
2026-08-13 09:01:14,932 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 09:01:14,935 INFO core: _init_accounts coroutine started
2026-08-13 09:01:14,936 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 09:01:14,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:01:46,701 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:01:46,702 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-13 09:02:19,695 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:02:19,696 ERROR core: Account 2 init failed on 91.108.56.178: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:02:19,698 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:02:19,701 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:02:19,705 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 09:02:19,706 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 09:02:19,706 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 09:02:19,707 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 09:02:19,708 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 09:02:19,709 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 09:02:19,713 WARNING core: Account 2: is_user_authorized timed out after 15s
2026-08-13 09:02:19,715 INFO core: Memory RSS: 93.37 MB
2026-08-13 09:02:19,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:02:19,716 INFO core: Memory RSS: 93.37 MB
2026-08-13 09:02:19,718 INFO core: Memory RSS: 93.37 MB
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-13 09:02:52,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:03:25,346 INFO core: Memory RSS: 93.37 MB
2026-08-13 09:03:25,349 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 09:03:25,350 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 09:03:25,351 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 09:03:25,351 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:03:25,352 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 09:03:25,355 WARNING core: Account 2: disconnect timed out after 10s
2026-08-13 09:03:25,356 INFO core: Memory RSS: 93.37 MB
2026-08-13 09:03:25,356 INFO core: Memory RSS: 93.37 MB
2026-08-13 09:03:25,356 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 09:03:25,357 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 09:03:25,360 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 09:03:25,362 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 09:03:25,363 INFO telethon.network.mtprotosender: Disconnection from None complete!
2026-08-13 09:03:25,365 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 09:03:25,366 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 09:03:25,374 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 09:03:25,375 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 09:03:25,375 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:03:25,377 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:03:57,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:04:30,424 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:04:30,426 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:04:30,426 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:04:30,427 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:04:30,427 WARNING core: Account 2: connect timed out after 35s
2026-08-13 09:04:30,428 WARNING core: Account 2: connect timed out after 35s
2026-08-13 09:04:30,429 WARNING core: Account 2: connect timed out after 35s
2026-08-13 09:04:30,432 INFO core: Memory RSS: 93.38 MB
2026-08-13 09:04:30,434 INFO core: Memory RSS: 93.38 MB
2026-08-13 09:04:30,436 INFO core: Memory RSS: 93.38 MB
2026-08-13 09:04:30,438 INFO core: Memory RSS: 93.38 MB
2026-08-13 09:04:30,439 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:04:30,440 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 09:04:30,441 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 09:04:30,441 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 09:04:30,442 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 09:04:30,443 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 09:04:30,444 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 09:04:30,446 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 09:04:30,446 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 09:04:30,448 INFO core: Watchdog: connecting missing account 2
2026-08-13 09:04:30,450 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:04:30,450 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:04:30,450 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 09:04:30,451 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 09:04:30,452 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 09:04:30,452 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 09:05:03,456 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 09:05:03,458 INFO core: _init_accounts coroutine started
2026-08-13 09:05:03,459 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 09:05:03,470 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:05:24,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:09:37,686 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 09:09:37,687 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 09:09:37,687 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 09:09:37,688 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 09:09:37,688 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: OSError: [Errno 101] Network is unreachable
2026-08-13 09:09:37,688 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 09:09:37,688 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: OSError: [Errno 101] Network is unreachable
2026-08-13 09:09:37,689 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 09:09:37,689 ERROR core: pairs sync error: cannot schedule new futures after shutdown
2026-08-13 09:09:37,689 ERROR core: pairs sync error: cannot schedule new futures after shutdown
2026-08-13 09:09:37,689 ERROR core: pairs sync error: cannot schedule new futures after shutdown
2026-08-13 09:09:37,689 ERROR core: pairs sync error: cannot schedule new futures after shutdown
2026-08-13 09:09:37,689 WARNING core: Account 2: connect timed out after 35s
2026-08-13 09:09:37,690 INFO core: Memory RSS: 93.43 MB
2026-08-13 09:09:37,690 INFO core: Memory RSS: 93.43 MB
2026-08-13 09:09:37,690 INFO core: Memory RSS: 93.43 MB
2026-08-13 09:09:37,691 INFO core: Memory RSS: 93.43 MB
2026-08-13 09:09:37,691 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 09:09:37,691 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 09:09:37,691 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:09:37,693 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:09:37,694 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 09:09:37,694 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 09:09:37,694 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 09:09:37,694 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 09:09:37,695 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 09:09:37,695 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 09:09:37,695 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 09:09:37,695 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 09:09:37,696 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: OSError: [Errno 101] Network is unreachable
2026-08-13 09:09:37,696 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 09:09:37,696 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 09:09:37,696 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: OSError: [Errno 101] Network is unreachable
2026-08-13 09:09:37,697 ERROR core: Account 2 init failed on 91.108.56.186: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:09:37,698 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-13 09:09:37,698 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-13 09:09:37,699 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:09:37,700 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 09:09:37,700 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 09:09:37,701 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-13 09:09:37,701 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-13 09:09:37,702 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: OSError: [Errno 101] Network is unreachable
2026-08-13 09:09:37,702 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 09:09:37,703 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 09:09:37,703 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: OSError: [Errno 101] Network is unreachable
2026-08-13 09:09:37,703 ERROR core: Account 2 init failed on 91.108.56.187: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:09:37,705 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-13 09:09:37,705 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-13 09:09:37,706 ERROR core: Account 2 init failed on 91.108.56.182: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-13 09:09:37,708 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-13 09:09:37,708 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-13 09:09:37,709 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-13 09:09:37,710 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-13 09:09:37,710 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-13 09:10:38,107 INFO core: Event loop thread started, running loop forever
2026-08-13 09:10:38,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 09:10:38,412 INFO core: _init_accounts coroutine started
2026-08-13 09:10:38,413 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 09:10:38,423 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 09:15:35,570 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 09:15:35,571 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 09:15:35,573 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 09:15:35,575 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 09:15:35,575 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:18:47,646 INFO core: Event loop thread started, running loop forever
2026-08-13 18:18:47,653 INFO core: Event loop thread started, running loop forever
2026-08-13 18:18:47,654 INFO core: Event loop thread started, running loop forever
2026-08-13 18:18:47,953 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 18:18:47,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 18:18:47,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 18:18:47,958 INFO core: _init_accounts coroutine started
2026-08-13 18:18:47,962 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 18:18:47,963 INFO core: _init_accounts coroutine started
2026-08-13 18:18:47,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 18:18:47,964 INFO core: _init_accounts coroutine started
2026-08-13 18:18:47,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 18:18:47,986 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:18:47,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:18:48,055 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 18:18:48,055 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 18:18:48,095 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 18:18:48,147 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 18:18:48,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 18:18:48,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 18:18:48,454 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 18:18:48,455 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 18:18:48,655 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-13 18:18:49,027 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:18:49,720 INFO core: Account 2 connected and authorized via 91.108.56.178
2026-08-13 18:18:49,743 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 18:18:49,743 INFO core: Signal processor started
2026-08-13 18:18:49,744 INFO core: Handlers installed for account 2
2026-08-13 18:18:49,745 INFO core: Initialized 1 account(s), 1 pair(s)
2026-08-13 18:18:49,746 INFO core: Memory RSS: 90.95 MB
2026-08-13 18:18:50,818 INFO core: Saved 241 dialog(s) to cache (account 2)
2026-08-13 18:18:52,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:18:57,963 WARNING core: status() DB error: 
2026-08-13 18:18:57,978 ERROR sqlalchemy.pool.impl.QueuePool: Exception during reset or similar
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 810, in _read_bytes
    data = self._rfile.read(num_bytes)
  File "/opt/alt/python313/lib64/python3.13/socket.py", line 723, in readinto
    return self._sock.recv_into(b)
           ~~~~~~~~~~~~~~~~~~~~^^^
TimeoutError: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/db.py", line 68, in _conn
    yield conn
  File "/home/wovewbge/quill.nx.kg/db.py", line 225, in get_pairs
    cur.execute(sql)
    ~~~~~~~~~~~^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 159, in execute
    result = self._query(query)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 330, in _query
    conn.query(q)
    ~~~~~~~~~~^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 582, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 847, in _read_query_result
    result.read()
    ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 1245, in read
    first_packet = self.connection._read_packet()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet_header = self._read_bytes(4)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 816, in _read_bytes
    raise err.OperationalError(
    ...<2 lines>...
    )
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query (timed out)')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 986, in _finalize_fairy
    fairy._reset(
    ~~~~~~~~~~~~^
        pool,
        ^^^^^
    ...<2 lines>...
        asyncio_safe=can_manipulate_connection,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1441, in _reset
    pool._dialect.do_rollback(self)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 123, in do_rollback
    dbapi_connection.rollback()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 511, in rollback
    self._execute_command(COMMAND.COM_QUERY, "ROLLBACK")
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 865, in _execute_command
    raise err.InterfaceError(0, "")
pymysql.err.InterfaceError: (0, '')
2026-08-13 18:18:58,003 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:18:59,384 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:01,325 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:02,629 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:03,543 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:05,459 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:07,586 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:11,246 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:11,625 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:12,253 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:14,013 INFO core: status() clients=1 connected=True forwarding=True
2026-08-13 18:19:19,314 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 18:19:19,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:19:22,131 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:19:23,414 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:19:23,560 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:19:26,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:20:20,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:24:21,396 INFO core: Memory RSS: 92.50 MB
2026-08-13 18:24:21,404 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-13 18:25:27,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 18:25:34,263 INFO core: Event loop thread started, running loop forever
2026-08-13 18:25:34,564 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 18:25:34,569 INFO core: _init_accounts coroutine started
2026-08-13 18:25:34,571 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 18:25:34,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:30:32,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:35:30,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:40:34,578 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 18:40:34,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:45:35,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:50:37,330 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 18:50:37,331 INFO core: _init_accounts coroutine started
2026-08-13 18:50:37,332 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 18:50:37,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 18:55:29,971 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 18:55:29,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:00:19,156 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 19:00:19,157 INFO core: _init_accounts coroutine started
2026-08-13 19:00:19,157 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 19:00:19,161 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 19:00:19,161 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 19:00:19,162 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 19:00:19,164 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 19:00:19,176 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:06:18,176 INFO core: Event loop thread started, running loop forever
2026-08-13 19:06:18,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 19:06:18,481 INFO core: _init_accounts coroutine started
2026-08-13 19:06:18,482 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 19:06:18,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:10:15,215 INFO core: Event loop thread started, running loop forever
2026-08-13 19:10:15,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 19:10:15,527 INFO core: _init_accounts coroutine started
2026-08-13 19:10:15,528 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 19:10:15,532 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:15:24,679 INFO core: Event loop thread started, running loop forever
2026-08-13 19:15:24,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 19:15:24,985 INFO core: _init_accounts coroutine started
2026-08-13 19:15:24,986 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 19:15:24,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:20:48,195 INFO core: Event loop thread started, running loop forever
2026-08-13 19:20:48,496 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 19:20:48,500 INFO core: _init_accounts coroutine started
2026-08-13 19:20:48,502 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 19:20:48,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:25:45,324 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 19:25:45,324 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 19:25:45,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:30:32,007 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 19:30:32,008 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 19:30:32,013 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 19:30:32,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:35:39,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 19:35:39,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 19:35:39,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 19:36:20,776 INFO core: Event loop thread started, running loop forever
2026-08-13 19:36:21,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 19:36:21,081 INFO core: _init_accounts coroutine started
2026-08-13 19:36:21,082 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 19:36:21,096 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:40:38,318 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 19:40:38,320 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 19:40:38,324 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 19:40:38,328 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 19:40:38,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:45:45,376 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 19:45:50,411 INFO core: Event loop thread started, running loop forever
2026-08-13 19:45:50,713 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 19:45:50,716 INFO core: _init_accounts coroutine started
2026-08-13 19:45:50,717 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 19:45:50,729 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:50:48,072 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 19:50:48,075 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 19:50:48,078 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 19:55:19,249 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 19:55:19,254 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 19:55:19,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:00:49,348 INFO core: Event loop thread started, running loop forever
2026-08-13 20:00:49,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 20:00:49,654 INFO core: _init_accounts coroutine started
2026-08-13 20:00:49,655 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 20:00:49,660 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:05:52,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:10:19,618 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:15:08,918 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 20:15:08,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:20:15,074 INFO core: Event loop thread started, running loop forever
2026-08-13 20:20:15,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 20:20:15,383 INFO core: _init_accounts coroutine started
2026-08-13 20:20:15,384 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 20:20:15,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:25:22,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 20:25:41,966 INFO core: Event loop thread started, running loop forever
2026-08-13 20:25:42,267 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 20:25:42,272 INFO core: _init_accounts coroutine started
2026-08-13 20:25:42,273 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 20:25:42,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:30:21,046 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 20:30:21,047 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 20:30:21,058 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 20:30:21,069 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 20:30:21,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:35:03,531 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 20:35:03,532 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 20:35:03,541 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 20:35:03,542 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 20:35:03,546 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:40:08,045 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 20:40:08,045 WARNING core: Account 2: connect timed out after 35s
2026-08-13 20:40:08,046 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 20:40:08,046 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 20:40:08,047 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 20:40:08,048 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 20:40:08,049 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 20:40:08,088 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:45:15,359 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 20:45:15,360 WARNING core: Account 2: connect timed out after 35s
2026-08-13 20:45:15,361 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-13 20:45:15,361 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-13 20:45:15,361 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 20:45:15,363 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-13 20:45:15,363 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-13 20:45:41,511 INFO core: Event loop thread started, running loop forever
2026-08-13 20:45:41,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 20:45:41,820 INFO core: _init_accounts coroutine started
2026-08-13 20:45:41,821 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 20:45:41,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:50:28,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 20:50:28,398 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 20:50:28,403 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 20:50:28,404 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 20:55:05,164 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 20:55:05,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:00:20,524 INFO core: Event loop thread started, running loop forever
2026-08-13 21:00:20,825 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 21:00:20,837 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:00:20,838 INFO core: _init_accounts coroutine started
2026-08-13 21:00:20,839 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:05:03,604 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 21:05:03,604 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 21:05:03,621 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 21:05:03,632 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 21:05:03,635 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:10:10,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 21:10:10,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 21:10:12,510 INFO core: Event loop thread started, running loop forever
2026-08-13 21:10:12,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 21:10:12,815 INFO core: _init_accounts coroutine started
2026-08-13 21:10:12,815 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:10:12,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:15:12,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:20:25,977 INFO core: Event loop thread started, running loop forever
2026-08-13 21:20:26,278 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 21:20:26,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:25:33,394 INFO core: _init_accounts coroutine started
2026-08-13 21:25:33,396 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:25:44,147 INFO core: Event loop thread started, running loop forever
2026-08-13 21:25:44,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 21:25:44,456 INFO core: _init_accounts coroutine started
2026-08-13 21:25:44,456 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:25:44,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:30:02,307 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 21:30:44,249 INFO core: Event loop thread started, running loop forever
2026-08-13 21:30:44,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 21:30:44,554 INFO core: _init_accounts coroutine started
2026-08-13 21:30:44,555 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:30:44,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:35:43,543 INFO core: Event loop thread started, running loop forever
2026-08-13 21:35:43,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 21:35:43,849 INFO core: _init_accounts coroutine started
2026-08-13 21:35:43,850 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:35:43,858 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:40:33,967 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 21:40:33,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:45:35,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:50:11,974 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-13 21:50:11,975 INFO core: _init_accounts coroutine started
2026-08-13 21:50:11,976 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:50:11,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 21:55:17,426 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 21:55:38,450 INFO core: Event loop thread started, running loop forever
2026-08-13 21:55:38,752 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 21:55:38,757 INFO core: _init_accounts coroutine started
2026-08-13 21:55:38,758 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 21:55:38,764 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:00:29,734 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 22:00:29,735 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 22:00:29,736 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 22:00:29,739 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 22:00:29,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:05:32,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:05:32,107 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 22:05:32,108 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 22:05:32,113 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 22:05:32,114 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 22:10:19,571 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 22:10:19,571 WARNING core: Account 2: connect timed out after 35s
2026-08-13 22:10:19,572 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-13 22:10:19,572 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-13 22:10:19,573 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-13 22:10:19,573 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-13 22:10:19,574 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-13 22:10:19,588 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:15:26,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-13 22:15:46,747 INFO core: Event loop thread started, running loop forever
2026-08-13 22:15:47,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 22:15:47,054 INFO core: _init_accounts coroutine started
2026-08-13 22:15:47,055 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 22:15:47,067 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:20:41,952 INFO core: Event loop thread started, running loop forever
2026-08-13 22:20:42,254 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 22:20:42,264 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:25:04,443 INFO core: _init_accounts coroutine started
2026-08-13 22:25:04,444 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 22:25:04,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 22:25:04,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 22:25:04,457 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 22:25:04,460 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 22:25:04,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:30:12,482 INFO core: Event loop thread started, running loop forever
2026-08-13 22:30:12,783 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 22:30:12,790 INFO core: _init_accounts coroutine started
2026-08-13 22:30:12,790 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 22:30:12,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:35:23,660 INFO core: Event loop thread started, running loop forever
2026-08-13 22:35:23,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 22:35:23,965 INFO core: _init_accounts coroutine started
2026-08-13 22:35:23,966 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 22:35:23,976 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:40:12,005 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 22:40:12,006 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 22:40:12,013 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 22:40:12,018 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 22:40:12,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:45:10,127 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:50:17,053 INFO core: Event loop thread started, running loop forever
2026-08-13 22:50:17,060 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 22:50:17,061 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 22:50:17,061 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 22:50:17,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 22:50:17,365 INFO core: _init_accounts coroutine started
2026-08-13 22:50:17,366 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 22:50:17,375 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 22:55:13,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:00:13,727 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-13 23:00:13,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:05:22,974 INFO core: Event loop thread started, running loop forever
2026-08-13 23:05:23,275 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 23:05:23,281 INFO core: _init_accounts coroutine started
2026-08-13 23:05:23,282 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 23:05:23,291 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:10:30,378 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 23:10:42,913 INFO core: Event loop thread started, running loop forever
2026-08-13 23:10:43,214 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 23:10:43,218 INFO core: _init_accounts coroutine started
2026-08-13 23:10:43,220 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 23:10:43,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:15:30,842 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:20:21,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:25:17,979 INFO core: Event loop thread started, running loop forever
2026-08-13 23:25:18,280 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 23:25:18,287 INFO core: _init_accounts coroutine started
2026-08-13 23:25:18,288 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 23:25:18,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:30:25,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-13 23:30:30,968 INFO core: Event loop thread started, running loop forever
2026-08-13 23:30:31,270 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 23:30:31,274 INFO core: _init_accounts coroutine started
2026-08-13 23:30:31,275 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 23:30:31,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:35:25,851 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 23:35:25,852 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 23:35:25,854 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 23:35:25,856 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 23:35:25,858 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:40:18,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:45:09,550 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 23:45:28,350 INFO core: Event loop thread started, running loop forever
2026-08-13 23:45:28,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 23:45:28,657 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:45:28,659 INFO core: _init_accounts coroutine started
2026-08-13 23:50:27,122 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 23:50:27,135 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-13 23:50:27,135 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-13 23:50:27,136 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-13 23:50:27,137 INFO core: _init_accounts_inner: reloading LLM config
2026-08-13 23:50:27,149 INFO core: status() clients=0 connected=False forwarding=False
2026-08-13 23:50:27,152 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-13 23:50:27,153 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-13 23:55:33,383 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-13 23:55:33,384 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-13 23:55:36,961 INFO core: Event loop thread started, running loop forever
2026-08-13 23:55:37,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-13 23:55:37,267 INFO core: _init_accounts coroutine started
2026-08-13 23:55:37,268 INFO core: _init_accounts_inner: starting DB migrations
2026-08-13 23:55:37,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:00:44,770 INFO core: Event loop thread started, running loop forever
2026-08-14 00:00:45,071 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 00:00:45,076 INFO core: _init_accounts coroutine started
2026-08-14 00:00:45,077 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 00:00:45,088 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:05:32,355 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:05:32,356 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 00:05:32,357 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 00:10:29,727 INFO core: Event loop thread started, running loop forever
2026-08-14 00:10:30,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 00:10:30,031 INFO core: _init_accounts coroutine started
2026-08-14 00:10:30,032 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 00:10:30,050 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-14 00:10:30,057 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-14 00:15:09,173 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:20:24,242 INFO core: Event loop thread started, running loop forever
2026-08-14 00:20:24,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 00:20:24,559 INFO core: _init_accounts coroutine started
2026-08-14 00:20:24,560 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 00:20:24,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:25:14,845 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:25:14,847 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 00:25:14,847 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 00:30:26,218 INFO core: Event loop thread started, running loop forever
2026-08-14 00:30:26,519 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 00:30:26,524 INFO core: _init_accounts coroutine started
2026-08-14 00:30:26,525 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 00:30:26,532 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:35:11,963 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:40:18,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 00:40:18,404 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 00:40:44,571 INFO core: Event loop thread started, running loop forever
2026-08-14 00:40:44,872 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 00:40:44,877 INFO core: _init_accounts coroutine started
2026-08-14 00:40:44,879 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 00:40:44,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:45:10,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:50:46,797 INFO core: Event loop thread started, running loop forever
2026-08-14 00:50:47,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 00:50:47,105 INFO core: _init_accounts coroutine started
2026-08-14 00:50:47,105 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 00:50:47,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 00:55:37,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:00:44,144 INFO core: Event loop thread started, running loop forever
2026-08-14 01:00:44,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 01:00:44,454 INFO core: _init_accounts coroutine started
2026-08-14 01:00:44,454 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 01:00:44,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:05:37,444 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 01:05:37,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:05:37,445 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 01:10:39,789 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 01:10:39,798 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 01:10:39,809 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 01:10:39,809 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 01:10:39,815 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 01:10:39,816 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 01:10:39,819 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:15:07,038 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 01:15:07,039 WARNING core: Account 2: connect timed out after 35s
2026-08-14 01:15:07,040 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-14 01:15:07,041 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-14 01:15:07,042 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 01:15:07,044 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-14 01:15:07,044 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-14 01:15:07,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:20:14,029 INFO core: Event loop thread started, running loop forever
2026-08-14 01:20:14,330 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 01:20:14,335 INFO core: _init_accounts coroutine started
2026-08-14 01:20:14,338 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 01:20:14,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:25:50,978 INFO core: Event loop thread started, running loop forever
2026-08-14 01:25:51,280 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 01:25:51,287 INFO core: _init_accounts coroutine started
2026-08-14 01:25:51,287 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 01:25:51,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:30:10,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:35:17,420 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 01:35:23,992 INFO core: Event loop thread started, running loop forever
2026-08-14 01:35:24,293 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 01:35:24,299 INFO core: _init_accounts coroutine started
2026-08-14 01:35:24,300 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 01:35:24,312 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:40:04,791 INFO core: Event loop thread started, running loop forever
2026-08-14 01:40:05,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 01:40:05,096 INFO core: _init_accounts coroutine started
2026-08-14 01:40:05,098 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 01:40:05,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:40:30,823 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 01:40:30,824 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 01:40:30,824 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-14 01:40:30,825 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 01:40:30,825 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-14 01:40:30,825 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 01:40:30,825 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 01:40:30,825 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 01:40:30,825 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 01:45:06,295 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 01:45:06,296 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 01:45:06,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 01:45:06,300 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 01:45:06,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:50:10,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 01:55:51,199 INFO core: Event loop thread started, running loop forever
2026-08-14 01:55:51,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 01:55:51,508 INFO core: _init_accounts coroutine started
2026-08-14 01:55:51,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 01:55:51,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:00:44,603 INFO core: Event loop thread started, running loop forever
2026-08-14 02:00:44,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 02:00:44,908 INFO core: _init_accounts coroutine started
2026-08-14 02:00:44,908 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 02:00:44,915 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:05:30,972 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 02:05:30,973 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 02:05:30,975 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 02:05:30,978 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 02:05:30,982 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:10:33,423 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:15:50,921 INFO core: Event loop thread started, running loop forever
2026-08-14 02:15:51,222 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 02:15:51,227 INFO core: _init_accounts coroutine started
2026-08-14 02:15:51,229 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 02:15:51,238 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:20:12,368 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 02:20:12,369 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 02:20:12,372 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:25:15,750 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 02:25:15,760 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 02:25:15,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:30:53,271 INFO core: Event loop thread started, running loop forever
2026-08-14 02:30:53,572 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 02:30:53,577 INFO core: _init_accounts coroutine started
2026-08-14 02:30:53,578 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 02:30:53,586 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:35:24,891 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 02:35:24,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 02:35:24,894 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 02:35:24,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:35:24,898 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 02:40:47,474 INFO core: Event loop thread started, running loop forever
2026-08-14 02:40:47,775 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 02:40:47,780 INFO core: _init_accounts coroutine started
2026-08-14 02:40:47,780 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 02:40:47,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:45:25,472 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 02:45:25,472 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 02:45:25,476 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 02:45:25,479 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 02:45:25,482 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:50:13,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:55:12,330 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 02:55:12,337 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 02:55:12,337 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 03:00:41,605 INFO core: Event loop thread started, running loop forever
2026-08-14 03:00:41,906 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 03:00:41,910 INFO core: _init_accounts coroutine started
2026-08-14 03:00:41,911 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 03:00:41,919 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:01:01,100 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:01:01,107 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 03:01:01,107 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 03:01:01,109 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 03:01:01,111 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 03:05:25,309 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:05:25,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:10:33,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:15:33,635 INFO core: Event loop thread started, running loop forever
2026-08-14 03:15:33,936 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 03:15:33,940 INFO core: _init_accounts coroutine started
2026-08-14 03:15:33,941 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 03:15:33,949 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:20:29,556 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 03:20:29,557 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 03:20:29,558 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 03:20:29,562 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:25:18,565 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 03:25:18,569 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:30:42,315 INFO core: Event loop thread started, running loop forever
2026-08-14 03:30:42,616 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 03:30:42,622 INFO core: _init_accounts coroutine started
2026-08-14 03:30:42,622 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 03:30:42,630 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:35:18,745 INFO core: Event loop thread started, running loop forever
2026-08-14 03:35:19,046 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 03:35:19,051 INFO core: _init_accounts coroutine started
2026-08-14 03:35:19,052 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 03:35:19,057 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:40:23,082 INFO core: Event loop thread started, running loop forever
2026-08-14 03:40:23,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 03:40:23,387 INFO core: _init_accounts coroutine started
2026-08-14 03:40:23,387 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 03:40:23,391 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:45:37,179 INFO core: Event loop thread started, running loop forever
2026-08-14 03:45:37,479 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 03:45:37,484 INFO core: _init_accounts coroutine started
2026-08-14 03:45:37,484 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 03:45:37,493 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:50:04,780 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 03:55:10,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 03:55:10,425 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 03:55:24,162 INFO core: Event loop thread started, running loop forever
2026-08-14 03:55:24,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 03:55:24,467 INFO core: _init_accounts coroutine started
2026-08-14 03:55:24,467 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 03:55:24,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:00:18,658 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 04:00:18,660 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 04:00:18,663 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 04:00:18,664 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 04:00:18,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:05:23,363 INFO core: Event loop thread started, running loop forever
2026-08-14 04:05:23,664 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 04:05:23,670 INFO core: _init_accounts coroutine started
2026-08-14 04:05:23,671 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 04:05:23,679 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:10:36,682 INFO core: Event loop thread started, running loop forever
2026-08-14 04:10:36,984 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 04:10:36,989 INFO core: _init_accounts coroutine started
2026-08-14 04:10:36,990 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 04:10:36,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:15:35,144 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 04:15:35,146 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:15:35,146 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 04:20:15,607 INFO core: Event loop thread started, running loop forever
2026-08-14 04:20:15,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 04:20:15,913 INFO core: _init_accounts coroutine started
2026-08-14 04:20:15,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 04:20:15,919 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:30:30,865 INFO core: Event loop thread started, running loop forever
2026-08-14 04:30:31,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 04:30:31,171 INFO core: _init_accounts coroutine started
2026-08-14 04:30:31,172 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 04:30:31,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:35:45,581 INFO core: Event loop thread started, running loop forever
2026-08-14 04:35:45,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 04:35:45,887 INFO core: _init_accounts coroutine started
2026-08-14 04:35:45,887 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 04:35:45,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:40:52,421 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 04:40:52,478 INFO core: Event loop thread started, running loop forever
2026-08-14 04:40:52,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 04:40:52,785 INFO core: _init_accounts coroutine started
2026-08-14 04:40:52,787 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 04:40:52,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:40:52,801 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 04:40:52,801 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 04:45:24,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:50:30,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 04:50:35,397 INFO core: Event loop thread started, running loop forever
2026-08-14 04:50:35,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 04:50:35,703 INFO core: _init_accounts coroutine started
2026-08-14 04:50:35,704 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 04:50:35,710 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 04:55:16,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:00:32,118 INFO core: Event loop thread started, running loop forever
2026-08-14 05:00:32,419 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 05:00:32,424 INFO core: _init_accounts coroutine started
2026-08-14 05:00:32,425 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 05:00:32,438 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:05:06,915 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 05:05:06,916 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 05:05:06,917 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:05:06,917 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 05:10:26,192 INFO core: Event loop thread started, running loop forever
2026-08-14 05:10:26,494 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 05:10:26,502 INFO core: _init_accounts coroutine started
2026-08-14 05:10:26,502 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 05:10:26,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:15:21,498 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 05:15:21,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 05:15:21,500 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 05:15:21,505 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 05:15:21,522 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 05:15:21,523 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 05:15:21,528 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 05:15:21,529 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 05:15:21,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:20:28,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 05:20:28,416 WARNING core: Account 2: connect timed out after 35s
2026-08-14 05:20:28,418 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-14 05:20:28,418 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-14 05:20:28,420 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 05:20:28,421 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-14 05:20:28,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-14 05:20:53,792 INFO core: Event loop thread started, running loop forever
2026-08-14 05:20:54,093 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 05:20:54,098 INFO core: _init_accounts coroutine started
2026-08-14 05:20:54,099 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 05:20:54,221 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:25:03,020 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:30:10,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 05:30:10,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 05:30:10,392 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-14 05:30:10,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 05:30:10,393 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-14 05:30:10,393 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 05:30:10,393 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 05:30:10,393 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 05:30:10,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 05:30:24,499 INFO core: Event loop thread started, running loop forever
2026-08-14 05:30:24,800 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 05:30:24,804 INFO core: _init_accounts coroutine started
2026-08-14 05:30:24,805 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 05:30:24,816 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:35:43,753 INFO core: Event loop thread started, running loop forever
2026-08-14 05:35:44,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 05:35:44,057 INFO core: _init_accounts coroutine started
2026-08-14 05:35:44,058 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 05:35:44,068 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:40:45,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:45:16,739 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 05:45:16,740 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 05:45:16,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:50:47,816 INFO core: Event loop thread started, running loop forever
2026-08-14 05:50:48,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 05:50:48,121 INFO core: _init_accounts coroutine started
2026-08-14 05:50:48,122 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 05:50:48,130 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 05:55:03,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 05:55:03,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 05:55:03,484 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 05:55:03,488 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 05:55:03,492 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:00:10,403 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 06:00:10,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 06:00:10,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 06:00:51,747 INFO core: Event loop thread started, running loop forever
2026-08-14 06:00:52,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:00:52,055 INFO core: _init_accounts coroutine started
2026-08-14 06:00:52,056 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:00:52,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:05:06,943 INFO core: Event loop thread started, running loop forever
2026-08-14 06:05:07,244 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:05:07,250 INFO core: _init_accounts coroutine started
2026-08-14 06:05:07,251 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:05:07,255 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:05:59,000 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 06:10:50,837 INFO core: Event loop thread started, running loop forever
2026-08-14 06:10:51,138 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:10:51,143 INFO core: _init_accounts coroutine started
2026-08-14 06:10:51,143 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:10:51,169 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 06:10:51,169 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 06:10:51,171 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 06:10:51,174 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 06:10:51,175 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:15:23,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:20:50,094 INFO core: Event loop thread started, running loop forever
2026-08-14 06:20:50,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:20:50,399 INFO core: _init_accounts coroutine started
2026-08-14 06:20:50,401 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:20:50,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:25:38,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:30:25,151 INFO core: Event loop thread started, running loop forever
2026-08-14 06:30:25,452 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:30:25,458 INFO core: _init_accounts coroutine started
2026-08-14 06:30:25,458 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:30:25,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:35:22,740 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 06:35:22,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:40:51,948 INFO core: Event loop thread started, running loop forever
2026-08-14 06:40:52,249 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:40:52,253 INFO core: _init_accounts coroutine started
2026-08-14 06:40:52,255 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:40:52,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:45:03,363 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 06:45:16,032 INFO core: Event loop thread started, running loop forever
2026-08-14 06:45:16,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:45:16,336 INFO core: _init_accounts coroutine started
2026-08-14 06:45:16,337 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:45:16,343 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:45:16,347 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 06:45:16,350 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 06:50:49,363 INFO core: Event loop thread started, running loop forever
2026-08-14 06:50:49,664 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 06:50:49,670 INFO core: _init_accounts coroutine started
2026-08-14 06:50:49,670 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 06:50:49,679 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 06:55:22,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:00:07,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 07:00:07,621 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 07:00:07,625 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 07:00:07,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:00:07,627 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 07:05:42,818 INFO core: Event loop thread started, running loop forever
2026-08-14 07:05:43,120 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 07:05:43,125 INFO core: _init_accounts coroutine started
2026-08-14 07:05:43,126 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 07:05:43,147 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:10:03,943 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 07:10:03,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:15:25,397 INFO core: Event loop thread started, running loop forever
2026-08-14 07:15:25,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 07:15:25,702 INFO core: _init_accounts coroutine started
2026-08-14 07:15:25,702 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 07:15:25,712 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 07:15:25,712 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 07:15:25,713 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 07:15:25,714 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 07:15:25,725 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 07:15:25,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:15:25,726 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 07:20:30,633 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 07:20:30,635 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 07:20:30,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:25:09,543 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 07:25:09,545 WARNING core: Account 2: connect timed out after 35s
2026-08-14 07:25:09,546 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-14 07:25:09,546 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-14 07:25:09,548 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 07:25:09,549 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-14 07:25:09,553 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:25:09,557 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-14 07:30:14,226 WARNING core: Account 2: connect timed out after 35s
2026-08-14 07:30:14,227 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-14 07:30:14,228 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-14 07:30:14,228 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 07:30:14,230 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-14 07:30:14,231 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-14 07:30:14,245 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:35:21,376 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 07:35:24,709 INFO core: Event loop thread started, running loop forever
2026-08-14 07:35:25,010 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 07:35:25,015 INFO core: _init_accounts coroutine started
2026-08-14 07:35:25,016 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 07:35:25,029 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 07:35:25,029 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 07:35:25,032 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 07:35:25,034 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 07:35:25,038 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:40:31,434 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 07:40:31,435 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 07:40:31,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 07:40:42,652 INFO core: Event loop thread started, running loop forever
2026-08-14 07:40:42,953 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 07:40:42,957 INFO core: _init_accounts coroutine started
2026-08-14 07:40:42,959 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 07:40:42,964 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:40:42,971 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 07:40:42,972 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 07:40:42,973 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 07:40:42,974 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 07:45:24,582 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:50:42,337 INFO core: Event loop thread started, running loop forever
2026-08-14 07:50:42,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 07:50:42,650 INFO core: _init_accounts coroutine started
2026-08-14 07:50:42,651 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 07:50:42,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:55:05,057 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 07:55:05,068 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 07:55:05,068 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 08:00:11,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 08:00:11,395 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-14 08:00:11,395 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 08:00:18,131 INFO core: Event loop thread started, running loop forever
2026-08-14 08:00:18,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 08:00:18,436 INFO core: _init_accounts coroutine started
2026-08-14 08:00:18,437 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 08:00:18,448 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:05:33,699 INFO core: Event loop thread started, running loop forever
2026-08-14 08:05:34,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 08:05:34,004 INFO core: _init_accounts coroutine started
2026-08-14 08:05:34,006 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 08:05:34,019 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:10:33,290 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 08:10:33,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:15:37,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:20:22,635 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-14 08:20:22,636 INFO core: _init_accounts coroutine started
2026-08-14 08:20:22,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 08:20:22,640 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:25:29,356 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 08:25:31,411 INFO core: Event loop thread started, running loop forever
2026-08-14 08:25:31,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 08:25:31,716 INFO core: _init_accounts coroutine started
2026-08-14 08:25:31,718 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 08:25:31,730 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:30:48,484 INFO core: Event loop thread started, running loop forever
2026-08-14 08:30:48,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 08:30:48,789 INFO core: _init_accounts coroutine started
2026-08-14 08:30:48,790 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 08:30:48,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:35:44,938 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:40:43,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:45:09,500 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 08:45:09,501 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 08:45:09,505 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 08:45:09,506 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:50:45,683 INFO core: Event loop thread started, running loop forever
2026-08-14 08:50:45,984 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 08:50:45,989 INFO core: _init_accounts coroutine started
2026-08-14 08:50:45,991 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 08:50:46,003 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 08:50:46,003 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 08:50:46,004 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 08:50:46,006 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 08:50:46,007 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 08:55:23,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:00:03,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 09:00:03,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 09:00:03,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 09:00:49,949 INFO core: Event loop thread started, running loop forever
2026-08-14 09:00:50,251 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 09:00:50,255 INFO core: _init_accounts coroutine started
2026-08-14 09:00:50,256 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 09:00:50,262 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:05:38,075 INFO core: Event loop thread started, running loop forever
2026-08-14 09:05:38,382 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 09:05:38,387 INFO core: _init_accounts coroutine started
2026-08-14 09:05:38,388 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 09:05:38,397 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 09:05:38,398 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 09:05:38,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 09:05:38,401 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:10:46,536 INFO core: Event loop thread started, running loop forever
2026-08-14 09:10:46,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 09:10:46,841 INFO core: _init_accounts coroutine started
2026-08-14 09:10:46,842 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 09:10:46,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:15:30,002 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:20:23,150 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 09:20:23,151 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 09:20:23,154 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 09:20:23,155 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 09:20:23,164 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 09:20:23,165 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 09:20:23,170 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 09:20:23,171 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 09:20:23,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:25:25,338 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 09:25:25,342 WARNING core: Account 2: connect timed out after 35s
2026-08-14 09:25:25,343 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-14 09:25:25,343 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-14 09:25:25,346 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 09:25:25,347 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-14 09:25:25,348 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-14 09:25:25,352 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:30:12,593 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 09:30:12,595 WARNING core: Account 2: connect timed out after 35s
2026-08-14 09:30:12,596 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-14 09:30:12,596 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-14 09:30:12,597 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 09:30:12,598 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-14 09:30:12,600 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-14 09:30:12,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:35:18,363 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 09:35:28,045 INFO core: Event loop thread started, running loop forever
2026-08-14 09:35:28,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 09:35:28,352 INFO core: _init_accounts coroutine started
2026-08-14 09:35:28,353 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 09:35:28,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:40:28,299 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 09:40:28,309 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:45:49,156 INFO core: Event loop thread started, running loop forever
2026-08-14 09:45:49,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 09:45:49,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:50:33,411 INFO core: _init_accounts coroutine started
2026-08-14 09:50:33,411 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 09:50:33,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 09:50:33,419 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 09:50:33,420 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 09:50:33,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 09:50:33,434 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 09:55:40,407 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 09:55:40,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 09:55:40,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 09:55:40,465 INFO core: Event loop thread started, running loop forever
2026-08-14 09:55:40,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 09:55:40,771 INFO core: _init_accounts coroutine started
2026-08-14 09:55:40,772 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 09:55:40,781 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:00:48,700 INFO core: Event loop thread started, running loop forever
2026-08-14 10:00:49,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 10:00:49,004 INFO core: _init_accounts coroutine started
2026-08-14 10:00:49,005 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 10:00:49,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:05:32,311 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 10:05:32,312 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 10:05:32,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:05:32,315 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 10:10:31,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:15:37,420 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 10:15:37,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 10:15:37,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 10:15:42,407 INFO core: Event loop thread started, running loop forever
2026-08-14 10:15:42,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 10:15:42,716 INFO core: _init_accounts coroutine started
2026-08-14 10:15:42,717 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 10:15:42,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:20:10,254 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:25:17,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 10:25:17,404 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 10:25:17,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 10:25:17,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-14 10:25:27,768 INFO core: Event loop thread started, running loop forever
2026-08-14 10:25:28,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 10:25:28,074 INFO core: _init_accounts coroutine started
2026-08-14 10:25:28,074 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 10:25:28,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:30:04,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:35:11,434 INFO core: Event loop thread started, running loop forever
2026-08-14 10:35:11,735 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 10:35:11,740 INFO core: _init_accounts coroutine started
2026-08-14 10:35:11,741 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 10:35:11,753 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:40:18,142 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 10:40:34,710 INFO core: Event loop thread started, running loop forever
2026-08-14 10:40:35,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 10:40:35,016 INFO core: _init_accounts coroutine started
2026-08-14 10:40:35,017 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 10:40:35,027 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:45:30,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:50:08,732 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 10:50:08,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 10:55:05,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:00:41,198 INFO core: Event loop thread started, running loop forever
2026-08-14 11:00:41,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 11:00:41,503 INFO core: _init_accounts coroutine started
2026-08-14 11:00:41,504 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 11:00:41,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:00:41,528 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 11:00:41,528 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 11:05:14,463 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 11:05:14,469 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:10:21,347 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 11:10:21,347 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 11:10:21,349 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 11:10:21,349 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 11:10:27,520 INFO core: Event loop thread started, running loop forever
2026-08-14 11:10:27,822 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 11:10:27,826 INFO core: _init_accounts coroutine started
2026-08-14 11:10:27,827 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 11:10:27,835 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:15:18,322 INFO core: Event loop thread started, running loop forever
2026-08-14 11:15:18,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 11:15:18,627 INFO core: _init_accounts coroutine started
2026-08-14 11:15:18,627 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 11:15:18,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:20:51,706 INFO core: Event loop thread started, running loop forever
2026-08-14 11:20:52,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 11:20:52,015 INFO core: _init_accounts coroutine started
2026-08-14 11:20:52,015 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 11:20:52,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:25:21,268 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 11:25:21,269 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 11:25:21,274 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 11:25:21,276 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 11:25:21,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:30:28,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 11:30:43,498 INFO core: Event loop thread started, running loop forever
2026-08-14 11:30:43,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 11:30:43,803 INFO core: _init_accounts coroutine started
2026-08-14 11:30:43,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 11:30:43,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:35:42,565 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:40:35,084 INFO core: Event loop thread started, running loop forever
2026-08-14 11:40:35,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 11:40:35,390 INFO core: _init_accounts coroutine started
2026-08-14 11:40:35,391 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 11:40:35,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:40:49,094 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 11:40:49,094 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 11:40:49,095 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-14 11:40:49,095 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 11:40:49,095 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-14 11:40:49,095 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 11:40:49,096 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 11:45:36,979 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-14 11:45:36,991 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-14 11:50:51,680 INFO core: Event loop thread started, running loop forever
2026-08-14 11:50:51,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 11:50:51,986 INFO core: _init_accounts coroutine started
2026-08-14 11:50:51,986 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 11:50:51,995 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:55:21,308 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 11:55:21,308 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 11:55:21,310 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 11:55:21,311 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 12:00:20,536 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 12:00:20,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:05:27,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 12:05:29,885 INFO core: Event loop thread started, running loop forever
2026-08-14 12:05:30,186 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 12:05:30,190 INFO core: _init_accounts coroutine started
2026-08-14 12:05:30,191 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 12:05:30,200 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:05:30,205 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 12:05:30,205 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 12:05:30,207 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 12:10:36,389 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 12:10:39,679 INFO core: Event loop thread started, running loop forever
2026-08-14 12:10:39,980 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 12:10:39,989 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:10:39,990 INFO core: _init_accounts coroutine started
2026-08-14 12:10:39,990 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 12:15:14,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:20:09,929 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 12:20:09,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:25:04,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:30:52,564 INFO core: Event loop thread started, running loop forever
2026-08-14 12:30:52,865 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 12:30:52,869 INFO core: _init_accounts coroutine started
2026-08-14 12:30:52,869 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 12:30:52,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:35:23,924 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 12:35:23,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:40:16,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:45:47,621 INFO core: Event loop thread started, running loop forever
2026-08-14 12:45:47,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 12:45:47,928 INFO core: _init_accounts coroutine started
2026-08-14 12:45:47,929 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 12:45:47,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:50:31,677 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 12:50:31,678 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 12:50:31,679 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 12:55:38,444 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 12:55:38,444 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-14 12:55:38,445 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 12:55:45,781 INFO core: Event loop thread started, running loop forever
2026-08-14 12:55:46,082 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 12:55:46,087 INFO core: _init_accounts coroutine started
2026-08-14 12:55:46,087 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 12:55:46,102 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 12:55:46,103 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 12:55:46,105 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 12:55:46,107 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 12:55:46,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:00:39,208 INFO core: Event loop thread started, running loop forever
2026-08-14 13:00:39,509 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 13:00:39,515 INFO core: _init_accounts coroutine started
2026-08-14 13:00:39,516 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 13:00:39,525 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:00:52,249 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 13:00:52,251 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 13:05:10,508 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 13:05:10,517 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:10:22,733 INFO core: Event loop thread started, running loop forever
2026-08-14 13:10:23,035 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 13:10:23,046 INFO core: _init_accounts coroutine started
2026-08-14 13:10:23,047 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:10:23,048 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 13:15:27,244 INFO core: Event loop thread started, running loop forever
2026-08-14 13:15:27,545 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 13:15:27,549 INFO core: _init_accounts coroutine started
2026-08-14 13:15:27,551 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 13:15:27,562 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:20:27,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:25:16,707 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 13:25:16,709 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 13:25:16,715 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 13:25:16,717 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 13:25:16,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:30:37,900 INFO core: Event loop thread started, running loop forever
2026-08-14 13:30:38,201 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 13:30:38,207 INFO core: _init_accounts coroutine started
2026-08-14 13:30:38,207 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 13:30:38,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:35:05,057 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 13:35:05,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:40:46,676 INFO core: Event loop thread started, running loop forever
2026-08-14 13:40:46,977 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 13:40:46,985 INFO core: _init_accounts coroutine started
2026-08-14 13:40:46,985 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 13:40:46,989 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:45:43,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:50:32,482 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 13:50:32,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 13:55:33,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:00:06,434 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-14 14:00:06,439 INFO core: _init_accounts coroutine started
2026-08-14 14:00:06,439 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 14:00:06,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:05:06,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:10:33,893 INFO core: Event loop thread started, running loop forever
2026-08-14 14:10:34,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 14:10:34,198 INFO core: _init_accounts coroutine started
2026-08-14 14:10:34,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 14:10:34,209 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 14:10:34,209 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 14:10:34,210 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 14:10:34,211 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 14:10:34,217 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:15:11,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:20:44,590 INFO core: Event loop thread started, running loop forever
2026-08-14 14:20:44,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 14:20:44,895 INFO core: _init_accounts coroutine started
2026-08-14 14:20:44,896 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 14:20:44,905 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:25:22,369 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 14:25:22,370 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 14:25:22,372 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:25:22,372 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 14:30:33,355 INFO core: Event loop thread started, running loop forever
2026-08-14 14:30:33,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 14:30:33,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:35:30,282 INFO core: _init_accounts coroutine started
2026-08-14 14:35:30,285 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 14:35:30,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:40:09,711 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 14:40:09,716 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:45:31,286 INFO core: Event loop thread started, running loop forever
2026-08-14 14:45:31,588 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 14:45:31,593 INFO core: _init_accounts coroutine started
2026-08-14 14:45:31,595 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 14:45:31,623 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:50:05,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 14:55:25,162 INFO core: Event loop thread started, running loop forever
2026-08-14 14:55:25,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 14:55:25,470 INFO core: _init_accounts coroutine started
2026-08-14 14:55:25,471 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 14:55:25,479 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:00:32,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 15:00:37,427 INFO core: Event loop thread started, running loop forever
2026-08-14 15:00:37,728 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 15:00:37,733 INFO core: _init_accounts coroutine started
2026-08-14 15:00:37,733 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 15:00:37,746 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:05:25,058 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 15:05:25,059 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 15:05:25,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:10:12,726 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 15:10:12,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:15:36,998 INFO core: Event loop thread started, running loop forever
2026-08-14 15:15:37,299 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 15:15:37,304 INFO core: _init_accounts coroutine started
2026-08-14 15:15:37,305 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 15:15:37,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:20:44,050 INFO core: Event loop thread started, running loop forever
2026-08-14 15:20:44,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 15:20:44,356 INFO core: _init_accounts coroutine started
2026-08-14 15:20:44,358 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 15:20:44,370 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:25:44,660 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:30:39,918 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-14 15:30:39,934 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-14 15:35:46,795 INFO core: Event loop thread started, running loop forever
2026-08-14 15:35:47,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 15:35:47,102 INFO core: _init_accounts coroutine started
2026-08-14 15:35:47,103 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 15:35:47,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:40:15,483 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:45:31,480 INFO core: Event loop thread started, running loop forever
2026-08-14 15:45:31,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 15:45:31,787 INFO core: _init_accounts coroutine started
2026-08-14 15:45:31,787 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 15:45:31,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:50:45,695 INFO core: Event loop thread started, running loop forever
2026-08-14 15:50:45,996 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 15:50:46,000 INFO core: _init_accounts coroutine started
2026-08-14 15:50:46,001 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 15:50:46,011 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 15:55:30,020 INFO core: Event loop thread started, running loop forever
2026-08-14 15:55:30,322 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 15:55:30,327 INFO core: _init_accounts coroutine started
2026-08-14 15:55:30,329 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 15:55:30,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:00:23,835 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 16:00:23,835 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 16:00:23,837 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 16:00:23,840 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 16:00:23,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:05:29,446 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 16:05:29,447 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 16:05:29,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 16:05:40,779 INFO core: Event loop thread started, running loop forever
2026-08-14 16:05:41,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 16:05:41,085 INFO core: _init_accounts coroutine started
2026-08-14 16:05:41,087 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 16:05:41,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:10:20,352 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 16:10:20,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:15:34,594 INFO core: Event loop thread started, running loop forever
2026-08-14 16:15:34,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 16:15:34,902 INFO core: _init_accounts coroutine started
2026-08-14 16:15:34,902 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 16:15:34,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:20:28,830 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 16:20:28,830 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 16:20:28,832 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 16:20:28,834 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 16:20:28,838 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:25:03,737 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 16:25:03,738 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 16:25:03,747 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 16:25:03,748 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 16:25:03,755 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:30:10,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 16:30:10,418 WARNING core: Account 2: connect timed out after 35s
2026-08-14 16:30:10,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-14 16:30:10,420 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-14 16:30:10,421 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 16:30:10,422 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-14 16:30:10,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-14 16:30:13,300 INFO core: Event loop thread started, running loop forever
2026-08-14 16:30:13,602 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 16:30:13,623 INFO core: _init_accounts coroutine started
2026-08-14 16:30:13,624 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 16:30:13,639 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 16:30:13,639 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 16:30:13,652 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 16:30:13,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:35:20,365 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 16:35:20,365 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 16:35:20,366 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 16:35:20,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 16:35:47,453 INFO core: Event loop thread started, running loop forever
2026-08-14 16:35:47,754 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 16:35:47,759 INFO core: _init_accounts coroutine started
2026-08-14 16:35:47,760 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 16:35:47,770 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:40:22,447 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:45:26,785 INFO core: Event loop thread started, running loop forever
2026-08-14 16:45:27,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 16:45:27,093 INFO core: _init_accounts coroutine started
2026-08-14 16:45:27,093 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 16:45:27,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:50:42,670 INFO core: Event loop thread started, running loop forever
2026-08-14 16:50:42,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 16:50:42,978 INFO core: _init_accounts coroutine started
2026-08-14 16:50:42,978 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 16:50:42,985 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 16:55:13,507 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 16:55:13,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:00:45,116 INFO core: Event loop thread started, running loop forever
2026-08-14 17:00:45,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 17:00:45,421 INFO core: _init_accounts coroutine started
2026-08-14 17:00:45,423 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 17:00:45,433 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:05:50,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 17:05:50,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 17:05:50,113 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:10:34,531 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 17:10:34,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:10:34,538 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 17:15:41,380 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 17:15:41,381 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 17:15:41,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 17:15:43,888 INFO core: Event loop thread started, running loop forever
2026-08-14 17:15:44,189 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 17:15:44,193 INFO core: _init_accounts coroutine started
2026-08-14 17:15:44,195 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 17:15:44,206 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:20:47,412 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:20:47,413 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 17:20:47,414 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 17:25:39,633 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 17:25:39,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:30:45,413 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 17:30:45,413 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 17:30:45,414 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 17:30:45,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 17:30:51,447 INFO core: Event loop thread started, running loop forever
2026-08-14 17:30:51,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 17:30:51,752 INFO core: _init_accounts coroutine started
2026-08-14 17:30:51,753 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 17:30:51,761 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:35:46,325 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:35:46,326 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 17:40:33,161 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 17:40:33,169 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 17:40:33,173 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 17:40:33,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:45:40,430 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 17:45:53,330 INFO core: Event loop thread started, running loop forever
2026-08-14 17:45:53,631 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 17:45:53,635 INFO core: _init_accounts coroutine started
2026-08-14 17:45:53,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 17:45:53,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:50:49,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 17:55:20,068 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 17:55:20,069 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 17:55:20,074 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 17:55:20,076 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 17:55:20,078 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:00:03,482 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 18:00:50,173 INFO core: Event loop thread started, running loop forever
2026-08-14 18:00:50,474 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 18:00:50,479 INFO core: _init_accounts coroutine started
2026-08-14 18:00:50,479 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 18:00:50,488 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:05:48,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 18:05:48,479 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 18:05:48,481 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 18:05:48,483 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 18:05:48,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:10:23,010 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:15:13,977 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 18:15:13,977 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 18:15:13,982 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 18:15:13,983 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 18:15:14,011 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:20:08,158 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 18:20:08,159 WARNING core: Account 2: connect timed out after 35s
2026-08-14 18:20:08,159 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-14 18:20:08,160 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-14 18:20:08,161 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 18:20:08,162 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-14 18:20:08,162 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-14 18:20:08,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:25:36,587 INFO core: Event loop thread started, running loop forever
2026-08-14 18:25:36,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 18:25:36,893 INFO core: _init_accounts coroutine started
2026-08-14 18:25:36,893 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 18:25:36,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:30:21,316 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 18:30:21,316 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 18:30:21,318 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 18:30:21,325 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 18:30:21,332 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:35:11,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:35:11,089 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 18:35:11,091 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 18:35:11,100 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 18:40:18,389 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 18:40:41,447 INFO core: Event loop thread started, running loop forever
2026-08-14 18:40:41,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 18:40:41,757 INFO core: _init_accounts coroutine started
2026-08-14 18:40:41,757 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 18:40:41,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:45:26,301 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 18:45:26,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:45:26,302 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 18:45:26,309 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 18:45:26,310 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 18:45:26,327 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 18:45:26,327 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 18:45:26,332 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-14 18:50:12,202 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-14 18:50:12,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 18:55:19,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-14 18:55:19,383 WARNING core: Account 2: connect timed out after 35s
2026-08-14 18:55:19,384 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-14 18:55:19,384 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-14 18:55:19,385 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-14 18:55:19,386 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-14 18:55:51,372 INFO core: Event loop thread started, running loop forever
2026-08-14 18:55:51,674 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 18:55:51,678 INFO core: _init_accounts coroutine started
2026-08-14 18:55:51,680 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 18:55:51,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:00:34,607 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 19:00:34,608 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 19:00:34,610 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 19:00:34,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:00:34,612 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 19:05:32,654 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:10:45,339 INFO core: Event loop thread started, running loop forever
2026-08-14 19:10:45,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 19:10:45,645 INFO core: _init_accounts coroutine started
2026-08-14 19:10:45,645 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 19:10:45,654 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:15:32,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:20:32,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:25:07,533 INFO core: Event loop thread started, running loop forever
2026-08-14 19:25:07,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 19:25:07,837 INFO core: _init_accounts coroutine started
2026-08-14 19:25:07,839 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 19:25:07,863 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:25:38,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 19:25:38,574 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 19:25:38,574 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-14 19:25:38,575 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 19:25:38,575 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-14 19:25:38,575 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 19:25:38,575 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 19:25:38,575 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 19:25:38,575 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 19:30:08,708 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 19:30:08,708 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 19:30:08,710 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 19:30:08,713 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 19:30:08,727 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:35:14,454 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 19:35:14,454 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 19:35:14,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 19:35:33,758 INFO core: Event loop thread started, running loop forever
2026-08-14 19:35:34,059 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 19:35:34,064 INFO core: _init_accounts coroutine started
2026-08-14 19:35:34,065 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 19:35:34,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:40:36,025 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 19:40:36,026 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:40:36,026 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 19:40:36,035 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 19:45:10,880 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:50:12,910 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 19:50:12,917 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 19:55:34,188 INFO core: Event loop thread started, running loop forever
2026-08-14 19:55:34,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 19:55:34,494 INFO core: _init_accounts coroutine started
2026-08-14 19:55:34,495 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 19:55:34,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:00:16,799 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 20:00:16,812 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:05:04,359 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:10:21,786 INFO core: Event loop thread started, running loop forever
2026-08-14 20:10:22,087 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 20:10:22,100 INFO core: _init_accounts coroutine started
2026-08-14 20:10:22,101 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 20:10:22,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:15:23,253 INFO core: Event loop thread started, running loop forever
2026-08-14 20:15:23,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 20:15:23,558 INFO core: _init_accounts coroutine started
2026-08-14 20:15:23,560 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 20:15:23,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:20:37,053 INFO core: Event loop thread started, running loop forever
2026-08-14 20:20:37,367 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 20:20:37,371 INFO core: _init_accounts coroutine started
2026-08-14 20:20:37,372 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 20:20:37,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:25:34,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:30:05,343 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 20:30:05,343 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 20:30:05,345 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:35:11,368 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 20:35:42,710 INFO core: Event loop thread started, running loop forever
2026-08-14 20:35:43,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 20:35:43,021 INFO core: _init_accounts coroutine started
2026-08-14 20:35:43,021 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 20:35:43,032 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:40:50,658 INFO core: Event loop thread started, running loop forever
2026-08-14 20:40:50,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 20:40:50,963 INFO core: _init_accounts coroutine started
2026-08-14 20:40:50,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 20:40:50,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:45:35,025 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:50:17,031 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 20:50:17,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 20:55:27,094 INFO core: Event loop thread started, running loop forever
2026-08-14 20:55:27,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 20:55:27,400 INFO core: _init_accounts coroutine started
2026-08-14 20:55:27,401 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 20:55:27,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:00:34,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 21:00:43,498 INFO core: Event loop thread started, running loop forever
2026-08-14 21:00:43,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 21:00:43,803 INFO core: _init_accounts coroutine started
2026-08-14 21:00:43,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 21:00:43,812 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:05:06,819 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 21:05:06,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:10:31,288 INFO core: Event loop thread started, running loop forever
2026-08-14 21:10:31,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 21:10:31,593 INFO core: _init_accounts coroutine started
2026-08-14 21:10:31,595 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 21:10:31,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:15:32,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 21:15:32,459 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 21:15:32,460 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:20:07,642 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 21:20:07,648 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:25:13,397 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 21:25:13,398 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 21:25:13,399 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 21:25:13,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 21:25:36,745 INFO core: Event loop thread started, running loop forever
2026-08-14 21:25:37,046 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 21:25:37,052 INFO core: _init_accounts coroutine started
2026-08-14 21:25:37,054 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 21:25:37,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:30:50,823 INFO core: Event loop thread started, running loop forever
2026-08-14 21:30:51,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 21:30:51,129 INFO core: _init_accounts coroutine started
2026-08-14 21:30:51,130 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 21:30:51,147 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:35:11,448 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:35:11,451 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 21:35:11,451 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 21:40:10,363 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 21:40:10,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:45:13,565 INFO core: Event loop thread started, running loop forever
2026-08-14 21:45:13,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 21:45:13,872 INFO core: _init_accounts coroutine started
2026-08-14 21:45:13,874 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 21:45:13,884 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 21:45:13,886 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-14 21:50:07,866 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-14 21:55:36,371 INFO core: Event loop thread started, running loop forever
2026-08-14 21:55:36,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 21:55:36,678 INFO core: _init_accounts coroutine started
2026-08-14 21:55:36,679 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 21:55:36,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:00:44,494 INFO core: Event loop thread started, running loop forever
2026-08-14 22:00:44,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 22:00:44,799 INFO core: _init_accounts coroutine started
2026-08-14 22:00:44,800 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 22:00:44,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:05:05,656 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:10:11,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 22:10:11,413 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 22:10:11,413 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-14 22:10:45,482 INFO core: Event loop thread started, running loop forever
2026-08-14 22:10:45,783 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 22:10:45,787 INFO core: _init_accounts coroutine started
2026-08-14 22:10:45,788 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 22:10:45,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:15:27,858 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 22:15:27,858 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 22:15:27,859 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:20:06,941 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 22:20:06,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:25:12,377 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 22:25:12,378 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-14 22:25:12,380 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-14 22:25:12,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-14 22:25:24,074 INFO core: Event loop thread started, running loop forever
2026-08-14 22:25:24,375 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 22:25:24,379 INFO core: _init_accounts coroutine started
2026-08-14 22:25:24,381 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 22:25:24,389 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:30:13,163 INFO core: Event loop thread started, running loop forever
2026-08-14 22:30:13,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 22:30:13,472 INFO core: _init_accounts coroutine started
2026-08-14 22:30:13,473 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 22:30:13,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:35:16,444 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 22:35:16,450 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:40:06,588 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:45:23,796 INFO core: Event loop thread started, running loop forever
2026-08-14 22:45:24,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 22:45:24,102 INFO core: _init_accounts coroutine started
2026-08-14 22:45:24,103 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 22:45:24,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:50:41,927 INFO core: Event loop thread started, running loop forever
2026-08-14 22:50:42,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 22:50:42,233 INFO core: _init_accounts coroutine started
2026-08-14 22:50:42,233 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 22:50:42,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 22:55:35,949 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:00:49,669 INFO core: Event loop thread started, running loop forever
2026-08-14 23:00:49,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 23:00:49,974 INFO core: _init_accounts coroutine started
2026-08-14 23:00:49,974 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 23:00:49,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:05:20,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:10:30,863 INFO core: Event loop thread started, running loop forever
2026-08-14 23:10:31,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 23:10:31,168 INFO core: _init_accounts coroutine started
2026-08-14 23:10:31,169 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 23:10:31,200 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:15:14,604 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:20:14,817 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 23:20:14,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 23:20:14,822 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 23:20:14,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:20:14,826 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 23:25:20,434 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-14 23:25:33,973 INFO core: Event loop thread started, running loop forever
2026-08-14 23:25:34,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 23:25:34,278 INFO core: _init_accounts coroutine started
2026-08-14 23:25:34,278 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 23:25:34,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:30:21,746 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:35:13,234 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-14 23:35:13,235 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-14 23:35:13,249 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:40:04,919 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-14 23:40:04,926 INFO core: _init_accounts_inner: reloading LLM config
2026-08-14 23:40:04,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:45:34,797 INFO core: Event loop thread started, running loop forever
2026-08-14 23:45:35,099 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-14 23:45:35,107 INFO core: _init_accounts coroutine started
2026-08-14 23:45:35,108 INFO core: _init_accounts_inner: starting DB migrations
2026-08-14 23:45:35,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:50:36,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-14 23:55:27,419 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-14 23:55:27,425 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:00:53,981 INFO core: Event loop thread started, running loop forever
2026-08-15 00:00:54,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 00:00:54,287 INFO core: _init_accounts coroutine started
2026-08-15 00:00:54,288 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 00:00:54,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:05:41,515 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 00:05:41,515 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 00:05:41,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:05:41,524 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 00:10:28,341 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 00:10:28,355 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:15:38,905 INFO core: Event loop thread started, running loop forever
2026-08-15 00:15:39,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 00:15:39,212 INFO core: _init_accounts coroutine started
2026-08-15 00:15:39,212 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 00:15:39,332 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:20:26,491 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 00:20:26,492 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 00:20:26,497 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 00:20:26,499 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:20:26,501 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 00:25:08,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:30:35,256 INFO core: Event loop thread started, running loop forever
2026-08-15 00:30:35,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 00:30:35,565 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:35:21,684 INFO core: _init_accounts coroutine started
2026-08-15 00:35:21,685 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 00:35:21,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:40:27,945 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 00:40:53,385 INFO core: Event loop thread started, running loop forever
2026-08-15 00:40:53,686 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 00:40:53,690 INFO core: _init_accounts coroutine started
2026-08-15 00:40:53,691 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 00:40:53,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:45:03,345 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-15 00:45:55,549 INFO core: Event loop thread started, running loop forever
2026-08-15 00:45:55,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 00:45:55,854 INFO core: _init_accounts coroutine started
2026-08-15 00:45:55,854 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 00:45:55,859 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:50:48,882 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 00:50:48,891 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 00:55:19,780 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:00:15,841 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-15 01:00:15,842 INFO core: _init_accounts coroutine started
2026-08-15 01:00:15,843 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 01:00:15,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:05:24,097 INFO core: Event loop thread started, running loop forever
2026-08-15 01:05:24,398 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 01:05:24,404 INFO core: _init_accounts coroutine started
2026-08-15 01:05:24,405 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 01:05:24,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:10:45,669 INFO core: Event loop thread started, running loop forever
2026-08-15 01:10:45,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 01:10:45,976 INFO core: _init_accounts coroutine started
2026-08-15 01:10:45,978 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 01:10:45,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:15:12,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:20:21,969 INFO core: Event loop thread started, running loop forever
2026-08-15 01:20:22,270 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 01:20:22,275 INFO core: _init_accounts coroutine started
2026-08-15 01:20:22,276 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 01:20:22,290 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 01:20:22,290 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 01:20:22,292 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 01:20:22,293 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 01:20:22,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:25:32,472 INFO core: Event loop thread started, running loop forever
2026-08-15 01:25:32,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 01:25:32,777 INFO core: _init_accounts coroutine started
2026-08-15 01:25:32,778 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 01:25:32,793 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 01:25:32,794 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 01:25:32,796 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 01:25:32,798 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 01:25:32,802 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:30:19,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:35:25,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 01:35:25,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 01:35:25,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 01:35:46,168 INFO core: Event loop thread started, running loop forever
2026-08-15 01:35:46,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 01:35:46,474 INFO core: _init_accounts coroutine started
2026-08-15 01:35:46,475 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 01:35:46,483 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:40:49,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:45:45,414 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 01:45:45,415 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 01:45:45,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 01:45:45,425 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:50:34,833 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 01:50:34,848 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 01:55:21,815 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:00:46,187 INFO core: Event loop thread started, running loop forever
2026-08-15 02:00:46,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 02:00:46,494 INFO core: _init_accounts coroutine started
2026-08-15 02:00:46,497 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 02:00:46,504 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:05:19,136 INFO core: Event loop thread started, running loop forever
2026-08-15 02:05:19,437 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 02:05:19,444 INFO core: _init_accounts coroutine started
2026-08-15 02:05:19,444 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 02:05:19,455 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:10:25,501 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 02:10:32,303 INFO core: Event loop thread started, running loop forever
2026-08-15 02:10:32,604 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 02:10:32,607 INFO core: _init_accounts coroutine started
2026-08-15 02:10:32,609 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 02:10:32,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:15:36,507 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:20:39,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 02:20:39,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:20:39,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 02:25:10,164 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:30:44,130 INFO core: Event loop thread started, running loop forever
2026-08-15 02:30:44,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 02:30:44,443 INFO core: _init_accounts coroutine started
2026-08-15 02:30:44,443 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 02:30:44,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:35:36,221 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:40:12,007 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:45:19,384 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-15 02:45:20,339 INFO core: Event loop thread started, running loop forever
2026-08-15 02:45:20,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 02:45:20,646 INFO core: _init_accounts coroutine started
2026-08-15 02:45:20,647 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 02:45:20,654 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:50:25,391 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 02:50:25,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 02:55:24,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:00:20,560 INFO core: Event loop thread started, running loop forever
2026-08-15 03:00:20,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 03:00:20,877 INFO core: _init_accounts coroutine started
2026-08-15 03:00:20,877 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 03:00:20,879 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:05:29,641 INFO core: Event loop thread started, running loop forever
2026-08-15 03:05:29,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 03:05:29,952 INFO core: _init_accounts coroutine started
2026-08-15 03:05:29,952 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 03:05:29,957 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:10:23,782 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 03:10:23,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:10:23,784 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 03:15:37,634 INFO core: Event loop thread started, running loop forever
2026-08-15 03:15:37,935 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 03:15:37,939 INFO core: _init_accounts coroutine started
2026-08-15 03:15:37,940 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 03:15:37,952 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:20:43,653 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:25:40,551 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:30:22,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 03:30:22,437 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 03:30:22,438 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:35:46,833 INFO core: Event loop thread started, running loop forever
2026-08-15 03:35:47,134 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 03:35:47,139 INFO core: _init_accounts coroutine started
2026-08-15 03:35:47,140 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 03:35:47,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:40:30,146 INFO core: Event loop thread started, running loop forever
2026-08-15 03:40:30,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 03:40:30,451 INFO core: _init_accounts coroutine started
2026-08-15 03:40:30,451 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 03:40:30,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:45:11,526 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 03:45:11,526 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 03:45:11,529 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 03:45:11,531 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 03:45:11,541 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 03:45:11,542 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 03:45:11,545 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-15 03:45:11,546 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-15 03:45:11,548 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:50:18,404 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 03:50:18,404 WARNING core: Account 2: connect timed out after 35s
2026-08-15 03:50:18,405 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-15 03:50:18,405 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-15 03:50:18,406 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 03:50:18,407 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-15 03:50:18,408 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-15 03:50:29,120 INFO core: Event loop thread started, running loop forever
2026-08-15 03:50:29,421 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 03:50:29,426 INFO core: _init_accounts coroutine started
2026-08-15 03:50:29,427 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 03:50:29,434 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 03:50:29,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 03:50:29,440 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 03:55:19,024 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 03:55:19,031 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 03:55:19,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:00:09,349 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:05:37,205 INFO core: Event loop thread started, running loop forever
2026-08-15 04:05:37,506 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 04:05:37,512 INFO core: _init_accounts coroutine started
2026-08-15 04:05:37,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:05:37,515 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 04:10:16,679 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 04:10:16,679 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 04:10:16,681 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 04:10:16,682 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 04:10:16,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:15:32,368 INFO core: Event loop thread started, running loop forever
2026-08-15 04:15:32,671 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 04:15:32,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:20:39,394 INFO core: _init_accounts coroutine started
2026-08-15 04:20:39,395 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 04:20:39,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 04:20:41,906 INFO core: Event loop thread started, running loop forever
2026-08-15 04:20:42,207 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 04:20:42,211 INFO core: _init_accounts coroutine started
2026-08-15 04:20:42,212 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 04:20:42,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:25:48,385 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 04:25:50,984 INFO core: Event loop thread started, running loop forever
2026-08-15 04:25:51,287 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 04:25:51,293 INFO core: _init_accounts coroutine started
2026-08-15 04:25:51,294 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 04:25:51,303 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 04:25:51,303 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 04:25:51,305 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 04:25:51,307 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 04:25:51,318 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 04:25:51,319 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 04:25:51,323 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-15 04:25:51,323 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-15 04:25:51,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:30:25,479 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 04:30:25,480 WARNING core: Account 2: connect timed out after 35s
2026-08-15 04:30:25,481 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-15 04:30:25,481 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-15 04:30:25,482 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 04:30:25,483 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-15 04:30:25,483 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-15 04:30:25,490 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:35:28,259 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 04:35:28,269 WARNING core: Account 2: connect timed out after 35s
2026-08-15 04:35:28,270 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-15 04:35:28,271 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-15 04:35:28,272 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 04:35:28,274 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-15 04:35:28,274 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-15 04:35:28,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:40:31,592 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 04:40:31,593 WARNING core: Account 2: connect timed out after 35s
2026-08-15 04:40:31,594 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-15 04:40:31,594 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-15 04:40:31,595 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 04:40:31,595 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-15 04:40:31,596 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-15 04:40:31,599 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:45:35,761 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 04:45:35,762 WARNING core: Account 2: connect timed out after 35s
2026-08-15 04:45:35,763 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-15 04:45:35,763 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-15 04:45:35,765 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 04:45:35,766 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-15 04:45:35,766 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-15 04:45:35,768 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:50:41,361 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 04:50:41,361 WARNING core: Account 2: connect timed out after 35s
2026-08-15 04:50:41,369 INFO core: Event loop thread started, running loop forever
2026-08-15 04:50:41,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 04:50:41,677 INFO core: _init_accounts coroutine started
2026-08-15 04:50:41,678 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 04:50:41,684 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:55:23,339 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 04:55:23,340 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 04:55:23,340 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 05:00:22,829 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 05:00:22,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:05:19,121 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 05:05:19,133 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:10:36,546 INFO core: Event loop thread started, running loop forever
2026-08-15 05:10:36,848 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 05:10:36,857 INFO core: _init_accounts coroutine started
2026-08-15 05:10:36,858 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 05:10:36,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:15:12,759 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 05:15:12,759 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 05:15:12,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:15:12,766 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 05:20:34,604 INFO core: Event loop thread started, running loop forever
2026-08-15 05:20:34,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 05:20:34,912 INFO core: _init_accounts coroutine started
2026-08-15 05:20:34,913 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 05:20:34,927 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 05:20:34,927 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 05:20:34,928 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 05:20:34,934 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 05:20:34,938 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:25:33,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:30:38,751 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:35:20,747 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:40:39,307 INFO core: Event loop thread started, running loop forever
2026-08-15 05:40:39,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 05:40:39,614 INFO core: _init_accounts coroutine started
2026-08-15 05:40:39,615 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 05:40:39,622 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:45:37,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:50:43,273 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 05:50:43,285 INFO core: Event loop thread started, running loop forever
2026-08-15 05:50:43,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 05:50:43,593 INFO core: _init_accounts coroutine started
2026-08-15 05:50:43,593 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 05:50:43,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 05:55:26,033 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:00:06,185 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 06:00:06,201 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 06:00:06,215 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:05:13,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 06:05:44,355 INFO core: Event loop thread started, running loop forever
2026-08-15 06:05:44,658 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 06:05:44,662 INFO core: _init_accounts coroutine started
2026-08-15 06:05:44,662 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 06:05:44,675 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:10:24,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:15:09,354 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 06:15:09,354 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 06:15:09,355 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-15 06:15:09,356 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 06:15:09,356 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-15 06:15:09,356 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 06:15:09,356 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-15 06:15:09,356 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 06:15:09,357 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 06:15:32,665 INFO core: Event loop thread started, running loop forever
2026-08-15 06:15:32,966 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 06:15:32,970 INFO core: _init_accounts coroutine started
2026-08-15 06:15:32,970 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 06:15:32,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:20:36,364 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:25:40,130 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 06:25:40,131 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 06:25:40,131 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:30:41,915 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 06:30:41,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:35:42,335 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 06:35:42,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:40:09,696 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:45:15,484 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 06:45:15,484 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 06:45:15,484 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 06:45:41,147 INFO core: Event loop thread started, running loop forever
2026-08-15 06:45:41,448 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 06:45:41,452 INFO core: _init_accounts coroutine started
2026-08-15 06:45:41,454 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 06:45:41,472 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:50:04,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 06:50:04,535 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 06:50:04,537 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 06:50:04,538 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 06:50:04,553 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 06:55:25,148 INFO core: Event loop thread started, running loop forever
2026-08-15 06:55:25,452 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 06:55:25,456 INFO core: _init_accounts coroutine started
2026-08-15 06:55:25,457 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 06:55:25,466 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:00:42,134 INFO core: Event loop thread started, running loop forever
2026-08-15 07:00:42,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 07:00:42,440 INFO core: _init_accounts coroutine started
2026-08-15 07:00:42,441 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 07:00:42,456 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:05:16,214 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 07:05:16,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:10:26,412 INFO core: Event loop thread started, running loop forever
2026-08-15 07:10:26,713 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 07:10:26,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:15:11,283 INFO core: _init_accounts coroutine started
2026-08-15 07:15:11,286 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 07:15:11,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:20:53,573 INFO core: Event loop thread started, running loop forever
2026-08-15 07:20:53,874 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 07:20:53,884 INFO core: _init_accounts coroutine started
2026-08-15 07:20:53,885 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:20:53,885 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 07:25:45,718 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 07:25:45,719 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 07:25:45,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:30:04,124 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 07:30:04,130 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 07:30:04,160 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 07:30:04,160 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 07:30:04,169 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-15 07:30:04,170 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-15 07:30:04,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:35:11,361 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 07:35:11,361 WARNING core: Account 2: connect timed out after 35s
2026-08-15 07:35:11,362 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-15 07:35:11,362 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-15 07:35:11,363 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 07:35:11,364 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-15 07:35:11,364 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-15 07:35:47,388 INFO core: Event loop thread started, running loop forever
2026-08-15 07:35:47,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 07:35:47,694 INFO core: _init_accounts coroutine started
2026-08-15 07:35:47,695 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 07:35:47,703 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:40:24,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:45:30,435 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 07:45:35,163 INFO core: Event loop thread started, running loop forever
2026-08-15 07:45:35,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 07:45:35,467 INFO core: _init_accounts coroutine started
2026-08-15 07:45:35,468 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 07:45:35,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:50:42,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 07:50:52,968 INFO core: Event loop thread started, running loop forever
2026-08-15 07:50:53,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 07:50:53,274 INFO core: _init_accounts coroutine started
2026-08-15 07:50:53,274 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 07:50:53,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 07:55:07,636 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 07:55:07,653 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:00:53,400 INFO core: Event loop thread started, running loop forever
2026-08-15 08:00:53,701 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 08:00:53,706 INFO core: _init_accounts coroutine started
2026-08-15 08:00:53,707 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 08:00:53,716 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:05:05,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:10:11,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 08:10:11,426 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 08:10:11,426 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-15 08:10:11,427 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 08:10:11,427 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-15 08:10:11,427 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 08:10:11,427 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-15 08:10:11,427 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 08:10:11,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 08:10:18,613 INFO core: Event loop thread started, running loop forever
2026-08-15 08:10:18,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 08:10:18,919 INFO core: _init_accounts coroutine started
2026-08-15 08:10:18,920 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 08:10:18,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:15:24,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 08:15:33,350 INFO core: Event loop thread started, running loop forever
2026-08-15 08:15:33,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 08:15:33,657 INFO core: _init_accounts coroutine started
2026-08-15 08:15:33,657 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 08:15:33,676 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:20:27,033 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 08:20:27,053 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:25:42,604 INFO core: Event loop thread started, running loop forever
2026-08-15 08:25:42,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 08:25:42,909 INFO core: _init_accounts coroutine started
2026-08-15 08:25:42,911 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 08:25:42,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:30:08,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 08:30:43,365 INFO core: Event loop thread started, running loop forever
2026-08-15 08:30:43,666 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 08:30:43,669 INFO core: _init_accounts coroutine started
2026-08-15 08:30:43,670 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 08:30:43,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:35:14,995 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 08:35:14,996 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 08:35:14,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:35:15,000 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 08:40:03,784 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:45:48,563 INFO core: Event loop thread started, running loop forever
2026-08-15 08:45:48,864 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 08:45:48,868 INFO core: _init_accounts coroutine started
2026-08-15 08:45:48,868 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 08:45:48,877 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:50:40,443 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 08:50:40,444 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 08:50:40,446 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 08:50:40,447 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 08:55:13,555 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 08:55:13,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:00:37,965 INFO core: Event loop thread started, running loop forever
2026-08-15 09:00:38,266 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 09:00:38,272 INFO core: _init_accounts coroutine started
2026-08-15 09:00:38,272 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 09:00:38,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:05:06,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:10:07,861 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:15:13,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 09:15:13,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 09:15:13,421 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-15 09:15:13,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 09:15:13,421 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-15 09:15:13,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 09:15:13,421 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-15 09:15:13,422 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 09:15:13,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 09:15:52,961 INFO core: Event loop thread started, running loop forever
2026-08-15 09:15:53,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 09:15:53,266 INFO core: _init_accounts coroutine started
2026-08-15 09:15:53,268 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 09:15:53,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 09:15:53,280 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 09:15:53,283 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 09:15:53,284 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:20:04,676 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 09:20:04,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:25:49,641 INFO core: Event loop thread started, running loop forever
2026-08-15 09:25:49,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 09:25:49,948 INFO core: _init_accounts coroutine started
2026-08-15 09:25:49,948 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 09:25:49,954 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:30:22,375 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 09:30:22,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:35:22,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:40:23,915 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-15 09:40:23,916 INFO core: _init_accounts coroutine started
2026-08-15 09:40:23,916 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 09:40:23,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:45:09,272 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 09:45:09,272 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 09:45:09,273 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 09:45:09,274 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 09:45:09,283 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 09:45:09,283 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 09:45:09,287 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-15 09:45:09,288 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-15 09:45:09,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:50:16,401 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 09:50:21,566 INFO core: Event loop thread started, running loop forever
2026-08-15 09:50:21,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 09:50:21,871 INFO core: _init_accounts coroutine started
2026-08-15 09:50:21,872 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 09:50:21,883 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 09:55:04,278 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 09:55:04,278 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 09:55:04,280 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 09:55:04,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:00:37,080 INFO core: Event loop thread started, running loop forever
2026-08-15 10:00:37,382 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 10:00:37,387 INFO core: _init_accounts coroutine started
2026-08-15 10:00:37,389 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 10:00:37,398 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:05:03,474 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 10:05:03,475 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 10:05:03,480 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 10:05:03,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:10:36,082 INFO core: Event loop thread started, running loop forever
2026-08-15 10:10:36,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 10:10:36,388 INFO core: _init_accounts coroutine started
2026-08-15 10:10:36,389 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 10:10:36,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:15:51,295 INFO core: Event loop thread started, running loop forever
2026-08-15 10:15:51,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 10:15:51,602 INFO core: _init_accounts coroutine started
2026-08-15 10:15:51,603 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 10:15:51,612 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:20:52,482 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 10:20:52,483 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 10:20:52,483 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:20:52,486 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 10:25:47,346 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 10:25:47,353 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:30:22,367 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:35:29,368 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 10:35:43,070 INFO core: Event loop thread started, running loop forever
2026-08-15 10:35:43,374 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 10:35:43,379 INFO core: _init_accounts coroutine started
2026-08-15 10:35:43,381 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 10:35:43,392 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:40:15,664 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 10:40:15,665 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 10:40:15,675 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 10:40:15,677 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 10:40:15,677 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:45:18,140 INFO core: Event loop thread started, running loop forever
2026-08-15 10:45:18,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 10:45:18,447 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:50:25,334 INFO core: _init_accounts coroutine started
2026-08-15 10:50:29,549 INFO core: Event loop thread started, running loop forever
2026-08-15 10:50:29,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 10:50:29,854 INFO core: _init_accounts coroutine started
2026-08-15 10:50:29,855 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 10:50:29,864 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 10:55:38,536 INFO core: Event loop thread started, running loop forever
2026-08-15 10:55:38,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 10:55:38,842 INFO core: _init_accounts coroutine started
2026-08-15 10:55:38,842 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 10:55:38,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:00:26,706 INFO core: Event loop thread started, running loop forever
2026-08-15 11:00:27,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 11:00:27,011 INFO core: _init_accounts coroutine started
2026-08-15 11:00:27,012 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 11:00:27,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:05:34,339 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 11:05:45,133 INFO core: Event loop thread started, running loop forever
2026-08-15 11:05:45,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 11:05:45,439 INFO core: _init_accounts coroutine started
2026-08-15 11:05:45,440 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 11:05:45,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:10:11,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:15:31,615 INFO core: Event loop thread started, running loop forever
2026-08-15 11:15:31,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 11:15:31,921 INFO core: _init_accounts coroutine started
2026-08-15 11:15:31,922 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 11:15:31,932 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:20:40,416 INFO core: Event loop thread started, running loop forever
2026-08-15 11:20:40,717 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 11:20:40,720 INFO core: _init_accounts coroutine started
2026-08-15 11:20:40,722 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 11:20:40,733 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 11:20:40,734 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 11:20:40,736 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 11:20:40,738 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:20:40,740 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 11:25:07,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:30:13,437 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 11:30:14,567 INFO core: Event loop thread started, running loop forever
2026-08-15 11:30:14,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 11:30:14,872 INFO core: _init_accounts coroutine started
2026-08-15 11:30:14,872 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 11:30:14,888 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:35:21,381 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 11:35:26,470 INFO core: Event loop thread started, running loop forever
2026-08-15 11:35:26,772 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 11:35:26,776 INFO core: _init_accounts coroutine started
2026-08-15 11:35:26,777 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 11:35:26,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:40:12,316 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:40:12,318 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 11:40:12,319 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 11:45:50,061 INFO core: Event loop thread started, running loop forever
2026-08-15 11:45:50,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 11:45:50,373 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:50:37,375 INFO core: _init_accounts coroutine started
2026-08-15 11:50:37,377 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 11:50:37,387 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 11:55:23,249 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 11:55:23,249 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 11:55:23,250 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 11:55:23,252 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 11:55:23,263 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:00:12,542 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 12:00:12,543 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 12:00:12,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:05:29,592 INFO core: Event loop thread started, running loop forever
2026-08-15 12:05:29,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 12:05:29,898 INFO core: _init_accounts coroutine started
2026-08-15 12:05:29,899 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 12:05:29,912 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:10:36,915 INFO core: Event loop thread started, running loop forever
2026-08-15 12:10:37,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 12:10:37,219 INFO core: _init_accounts coroutine started
2026-08-15 12:10:37,220 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 12:10:37,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:15:47,118 INFO core: Event loop thread started, running loop forever
2026-08-15 12:15:47,419 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 12:15:47,423 INFO core: _init_accounts coroutine started
2026-08-15 12:15:47,424 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 12:15:47,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:20:31,989 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 12:20:31,990 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 12:20:31,991 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 12:20:32,002 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 12:20:32,005 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:25:19,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:30:06,449 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 12:30:06,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 12:30:06,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:35:41,567 INFO core: Event loop thread started, running loop forever
2026-08-15 12:35:41,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 12:35:41,873 INFO core: _init_accounts coroutine started
2026-08-15 12:35:41,873 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 12:35:41,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:40:35,034 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 12:40:35,034 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 12:40:35,037 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 12:40:35,038 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 12:40:35,047 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:45:35,180 INFO core: Event loop thread started, running loop forever
2026-08-15 12:45:35,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 12:45:35,486 INFO core: _init_accounts coroutine started
2026-08-15 12:45:35,486 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 12:45:35,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:45:41,211 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 12:45:41,212 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 12:45:41,212 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 12:50:22,516 INFO core: Event loop thread started, running loop forever
2026-08-15 12:50:22,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 12:50:22,821 INFO core: _init_accounts coroutine started
2026-08-15 12:50:22,822 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 12:50:22,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 12:55:19,269 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:00:07,336 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 13:00:07,336 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 13:00:51,534 INFO core: Event loop thread started, running loop forever
2026-08-15 13:00:51,835 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:00:51,839 INFO core: _init_accounts coroutine started
2026-08-15 13:00:51,839 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:00:51,847 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 13:00:51,847 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 13:00:51,848 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 13:00:51,851 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 13:00:51,852 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:05:03,710 INFO core: Event loop thread started, running loop forever
2026-08-15 13:05:04,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:05:04,015 INFO core: _init_accounts coroutine started
2026-08-15 13:05:04,016 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:05:04,025 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:10:24,653 INFO core: Event loop thread started, running loop forever
2026-08-15 13:10:24,955 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:10:24,961 INFO core: _init_accounts coroutine started
2026-08-15 13:10:24,961 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:10:24,972 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:15:30,329 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 13:15:43,168 INFO core: Event loop thread started, running loop forever
2026-08-15 13:15:43,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:15:43,474 INFO core: _init_accounts coroutine started
2026-08-15 13:15:43,474 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:15:43,482 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:20:22,548 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:25:29,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 13:25:51,696 INFO core: Event loop thread started, running loop forever
2026-08-15 13:25:51,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:25:52,002 INFO core: _init_accounts coroutine started
2026-08-15 13:25:52,002 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:25:52,012 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:30:15,141 INFO core: Event loop thread started, running loop forever
2026-08-15 13:30:15,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:30:15,464 INFO core: _init_accounts coroutine started
2026-08-15 13:30:15,464 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:30:15,470 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:35:32,283 INFO core: Event loop thread started, running loop forever
2026-08-15 13:35:32,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:35:32,589 INFO core: _init_accounts coroutine started
2026-08-15 13:35:32,590 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:35:32,601 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:40:39,390 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 13:40:46,032 INFO core: Event loop thread started, running loop forever
2026-08-15 13:40:46,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:40:46,337 INFO core: _init_accounts coroutine started
2026-08-15 13:40:46,338 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:40:46,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:45:05,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:50:07,823 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 13:50:07,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 13:55:17,091 INFO core: Event loop thread started, running loop forever
2026-08-15 13:55:17,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 13:55:17,398 INFO core: _init_accounts coroutine started
2026-08-15 13:55:17,398 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 13:55:17,403 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:00:13,208 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 14:00:13,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:05:22,957 INFO core: Event loop thread started, running loop forever
2026-08-15 14:05:23,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 14:05:23,267 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:10:29,522 INFO core: _init_accounts coroutine started
2026-08-15 14:10:29,523 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 14:10:29,531 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 14:10:37,656 INFO core: Event loop thread started, running loop forever
2026-08-15 14:10:37,957 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 14:10:37,962 INFO core: _init_accounts coroutine started
2026-08-15 14:10:37,963 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 14:10:37,973 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:15:06,999 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 14:15:07,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:20:39,389 INFO core: Event loop thread started, running loop forever
2026-08-15 14:20:39,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 14:20:39,696 INFO core: _init_accounts coroutine started
2026-08-15 14:20:39,697 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 14:20:39,706 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:25:06,613 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:30:33,471 INFO core: Event loop thread started, running loop forever
2026-08-15 14:30:33,772 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 14:30:33,776 INFO core: _init_accounts coroutine started
2026-08-15 14:30:33,778 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 14:30:33,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:35:26,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 14:35:26,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 14:35:26,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 14:35:26,399 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:40:33,432 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 14:40:33,433 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-15 14:40:33,433 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 14:40:33,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 14:40:47,291 INFO core: Event loop thread started, running loop forever
2026-08-15 14:40:47,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 14:40:47,598 INFO core: _init_accounts coroutine started
2026-08-15 14:40:47,600 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 14:40:47,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:45:40,408 INFO core: Event loop thread started, running loop forever
2026-08-15 14:45:40,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 14:45:40,713 INFO core: _init_accounts coroutine started
2026-08-15 14:45:40,714 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 14:45:40,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:50:30,227 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 14:50:30,255 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 14:55:29,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:00:24,854 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-15 15:00:24,855 INFO core: _init_accounts coroutine started
2026-08-15 15:00:24,855 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 15:00:24,863 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 15:00:24,863 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 15:00:24,864 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 15:00:24,866 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 15:00:24,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:05:48,730 INFO core: Event loop thread started, running loop forever
2026-08-15 15:05:49,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 15:05:49,036 INFO core: _init_accounts coroutine started
2026-08-15 15:05:49,036 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 15:05:49,045 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 15:05:49,045 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 15:05:49,046 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 15:05:49,047 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 15:05:49,056 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 15:05:49,056 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 15:05:49,060 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-15 15:05:49,060 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-15 15:05:49,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:10:08,147 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 15:10:08,148 WARNING core: Account 2: connect timed out after 35s
2026-08-15 15:10:08,149 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-15 15:10:08,149 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-15 15:10:08,150 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 15:10:08,151 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-15 15:10:08,152 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-15 15:10:08,158 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:15:05,380 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 15:15:05,380 WARNING core: Account 2: connect timed out after 35s
2026-08-15 15:15:05,381 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-15 15:15:20,962 INFO core: Event loop thread started, running loop forever
2026-08-15 15:15:21,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 15:15:21,267 INFO core: _init_accounts coroutine started
2026-08-15 15:15:21,268 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 15:15:21,274 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:20:17,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:25:45,440 INFO core: Event loop thread started, running loop forever
2026-08-15 15:25:45,741 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 15:25:45,745 INFO core: _init_accounts coroutine started
2026-08-15 15:25:45,748 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 15:25:45,754 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:30:21,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:35:08,397 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 15:35:08,397 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 15:35:08,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 15:35:08,419 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 15:35:08,429 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:40:20,652 INFO core: Event loop thread started, running loop forever
2026-08-15 15:40:20,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 15:40:20,963 INFO core: _init_accounts coroutine started
2026-08-15 15:40:20,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 15:40:20,970 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:45:22,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:50:41,911 INFO core: Event loop thread started, running loop forever
2026-08-15 15:50:42,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 15:50:42,217 INFO core: _init_accounts coroutine started
2026-08-15 15:50:42,217 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 15:50:42,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 15:55:21,853 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 15:55:21,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:00:05,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:05:35,466 INFO core: Event loop thread started, running loop forever
2026-08-15 16:05:35,767 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 16:05:35,774 INFO core: _init_accounts coroutine started
2026-08-15 16:05:35,775 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 16:05:35,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:10:42,120 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 16:10:42,125 INFO core: Event loop thread started, running loop forever
2026-08-15 16:10:42,429 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 16:10:42,433 INFO core: _init_accounts coroutine started
2026-08-15 16:10:42,434 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 16:10:42,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:15:48,436 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 16:15:50,242 INFO core: Event loop thread started, running loop forever
2026-08-15 16:15:50,543 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 16:15:50,547 INFO core: _init_accounts coroutine started
2026-08-15 16:15:50,547 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 16:15:50,554 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:20:37,504 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:25:22,740 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 16:25:22,751 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:30:38,814 INFO core: Event loop thread started, running loop forever
2026-08-15 16:30:39,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 16:30:39,129 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:35:10,520 INFO core: _init_accounts coroutine started
2026-08-15 16:35:10,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 16:35:10,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:40:08,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:45:15,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 16:45:15,371 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 16:45:15,371 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-15 16:45:15,372 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 16:45:15,372 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-15 16:45:15,372 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 16:45:15,372 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-15 16:45:15,372 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 16:45:15,372 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 16:45:48,178 INFO core: Event loop thread started, running loop forever
2026-08-15 16:45:48,480 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 16:45:48,487 INFO core: _init_accounts coroutine started
2026-08-15 16:45:48,487 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 16:45:48,496 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:50:07,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 16:50:07,430 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 16:50:07,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 16:50:07,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 16:55:14,415 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 16:55:27,749 INFO core: Event loop thread started, running loop forever
2026-08-15 16:55:28,050 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 16:55:28,055 INFO core: _init_accounts coroutine started
2026-08-15 16:55:28,056 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 16:55:28,069 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:00:12,144 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 17:00:12,145 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 17:00:12,146 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:05:14,678 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 17:05:14,685 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:10:12,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 17:10:12,422 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:15:04,048 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:20:43,047 INFO core: Event loop thread started, running loop forever
2026-08-15 17:20:43,349 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 17:20:43,354 INFO core: _init_accounts coroutine started
2026-08-15 17:20:43,354 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 17:20:43,364 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:25:29,213 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 17:25:29,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:30:26,628 INFO core: Event loop thread started, running loop forever
2026-08-15 17:30:26,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 17:30:26,934 INFO core: _init_accounts coroutine started
2026-08-15 17:30:26,934 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 17:30:26,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:35:19,304 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 17:35:19,305 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 17:35:19,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:40:04,693 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 17:40:04,699 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 17:40:04,701 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:45:36,843 INFO core: Event loop thread started, running loop forever
2026-08-15 17:45:37,144 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 17:45:37,148 INFO core: _init_accounts coroutine started
2026-08-15 17:45:37,148 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 17:45:37,159 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:50:26,533 INFO core: Event loop thread started, running loop forever
2026-08-15 17:50:26,833 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 17:50:26,838 INFO core: _init_accounts coroutine started
2026-08-15 17:50:26,838 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 17:50:26,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 17:55:23,495 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 17:55:23,495 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 17:55:23,497 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:00:23,763 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 18:00:23,769 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 18:00:23,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:05:48,106 INFO core: Event loop thread started, running loop forever
2026-08-15 18:05:48,407 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 18:05:48,411 INFO core: _init_accounts coroutine started
2026-08-15 18:05:48,412 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 18:05:48,419 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:10:08,295 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:15:15,360 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 18:15:18,346 INFO core: Event loop thread started, running loop forever
2026-08-15 18:15:18,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 18:15:18,653 INFO core: _init_accounts coroutine started
2026-08-15 18:15:18,654 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 18:15:18,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:20:17,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:20:17,790 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 18:20:17,790 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 18:25:04,844 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 18:25:04,856 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 18:25:04,857 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:30:11,481 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 18:30:11,481 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 18:30:11,481 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 18:30:48,837 INFO core: Event loop thread started, running loop forever
2026-08-15 18:30:49,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 18:30:49,153 INFO core: _init_accounts coroutine started
2026-08-15 18:30:49,154 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 18:30:49,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:35:31,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:40:09,662 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:45:35,331 INFO core: Event loop thread started, running loop forever
2026-08-15 18:45:35,632 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 18:45:35,636 INFO core: _init_accounts coroutine started
2026-08-15 18:45:35,637 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 18:45:35,646 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:50:29,111 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 18:50:29,118 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 18:55:30,844 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:00:21,317 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-15 19:00:21,321 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:05:17,840 INFO core: _init_accounts coroutine started
2026-08-15 19:05:17,841 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 19:05:17,855 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:10:35,191 INFO core: Event loop thread started, running loop forever
2026-08-15 19:10:35,495 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 19:10:35,499 INFO core: _init_accounts coroutine started
2026-08-15 19:10:35,500 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 19:10:35,508 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:15:49,103 INFO core: Event loop thread started, running loop forever
2026-08-15 19:15:49,405 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 19:15:49,409 INFO core: _init_accounts coroutine started
2026-08-15 19:15:49,410 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 19:15:49,424 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:20:11,083 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 19:20:11,084 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 19:20:11,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:25:03,284 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 19:25:03,294 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 19:25:03,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:30:38,750 INFO core: Event loop thread started, running loop forever
2026-08-15 19:30:39,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 19:30:39,055 INFO core: _init_accounts coroutine started
2026-08-15 19:30:39,057 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 19:30:39,066 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:35:45,363 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 19:35:46,269 INFO core: Event loop thread started, running loop forever
2026-08-15 19:35:46,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 19:35:46,575 INFO core: _init_accounts coroutine started
2026-08-15 19:35:46,575 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 19:35:46,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:40:11,540 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 19:40:11,541 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 19:40:11,547 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:45:04,403 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 19:45:04,404 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-15 19:45:04,404 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 19:45:04,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-15 19:45:04,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 19:45:04,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 19:45:45,357 INFO core: Event loop thread started, running loop forever
2026-08-15 19:45:45,658 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 19:45:45,664 INFO core: _init_accounts coroutine started
2026-08-15 19:45:45,664 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 19:45:45,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:50:47,227 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 19:50:47,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 19:55:29,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:00:43,480 INFO core: Event loop thread started, running loop forever
2026-08-15 20:00:43,781 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 20:00:43,786 INFO core: _init_accounts coroutine started
2026-08-15 20:00:43,787 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 20:00:43,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:05:36,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:10:47,281 INFO core: Event loop thread started, running loop forever
2026-08-15 20:10:47,582 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 20:10:47,588 INFO core: _init_accounts coroutine started
2026-08-15 20:10:47,588 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 20:10:47,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:15:41,330 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 20:15:41,333 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 20:15:41,338 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 20:15:41,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:15:41,341 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 20:20:34,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:25:25,765 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:30:34,419 INFO core: Event loop thread started, running loop forever
2026-08-15 20:30:34,720 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 20:30:34,725 INFO core: _init_accounts coroutine started
2026-08-15 20:30:34,727 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 20:30:34,738 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:35:05,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:40:29,668 INFO core: Event loop thread started, running loop forever
2026-08-15 20:40:29,969 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 20:40:29,973 INFO core: _init_accounts coroutine started
2026-08-15 20:40:29,974 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 20:40:29,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:45:35,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 20:45:45,082 INFO core: Event loop thread started, running loop forever
2026-08-15 20:45:45,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 20:45:45,388 INFO core: _init_accounts coroutine started
2026-08-15 20:45:45,388 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 20:45:45,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 20:45:45,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 20:45:45,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 20:45:45,407 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 20:45:45,419 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 20:45:45,419 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 20:45:45,426 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-15 20:45:45,427 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-15 20:45:45,433 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:50:31,345 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 20:50:31,346 WARNING core: Account 2: connect timed out after 35s
2026-08-15 20:50:31,346 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-15 20:50:31,347 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-15 20:50:31,347 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-15 20:50:31,349 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-15 20:50:31,349 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-15 20:50:31,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 20:55:38,437 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 20:55:38,438 WARNING core: Account 2: connect timed out after 35s
2026-08-15 20:55:51,129 INFO core: Event loop thread started, running loop forever
2026-08-15 20:55:51,430 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 20:55:51,434 INFO core: _init_accounts coroutine started
2026-08-15 20:55:51,435 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 20:55:51,443 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:00:50,552 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 21:00:50,557 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:05:35,703 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:10:20,282 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-15 21:10:20,283 INFO core: _init_accounts coroutine started
2026-08-15 21:10:20,284 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 21:10:20,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:15:06,621 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 21:15:06,622 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 21:15:06,626 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 21:15:06,629 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 21:15:06,632 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:20:07,199 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:25:34,055 INFO core: Event loop thread started, running loop forever
2026-08-15 21:25:34,356 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 21:25:34,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:30:30,912 INFO core: _init_accounts coroutine started
2026-08-15 21:30:30,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 21:30:30,925 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 21:30:30,925 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 21:30:30,927 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 21:30:30,934 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 21:30:30,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:35:26,108 INFO core: Event loop thread started, running loop forever
2026-08-15 21:35:26,409 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 21:35:26,414 INFO core: _init_accounts coroutine started
2026-08-15 21:35:26,414 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 21:35:26,424 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:40:08,508 INFO core: Event loop thread started, running loop forever
2026-08-15 21:40:08,809 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 21:40:08,812 INFO core: _init_accounts coroutine started
2026-08-15 21:40:08,813 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 21:40:08,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:45:15,327 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 21:45:15,328 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 21:45:25,553 INFO core: Event loop thread started, running loop forever
2026-08-15 21:45:25,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 21:45:25,859 INFO core: _init_accounts coroutine started
2026-08-15 21:45:25,862 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 21:45:25,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:50:31,682 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:55:17,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 21:55:17,381 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 21:55:17,385 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 21:55:17,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 22:00:36,860 INFO core: Event loop thread started, running loop forever
2026-08-15 22:00:37,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 22:00:37,168 INFO core: _init_accounts coroutine started
2026-08-15 22:00:37,169 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 22:00:37,173 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:05:07,719 INFO core: Event loop thread started, running loop forever
2026-08-15 22:05:08,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 22:05:08,033 INFO core: _init_accounts coroutine started
2026-08-15 22:05:08,033 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 22:05:08,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:05:43,771 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 22:10:15,340 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 22:10:19,300 INFO core: Event loop thread started, running loop forever
2026-08-15 22:10:19,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 22:10:19,606 INFO core: _init_accounts coroutine started
2026-08-15 22:10:19,607 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 22:10:19,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:15:16,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 22:15:16,388 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 22:15:16,389 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:20:05,818 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 22:20:05,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:20:05,827 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 22:25:11,361 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 22:25:11,362 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 22:25:11,362 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 22:25:41,561 INFO core: Event loop thread started, running loop forever
2026-08-15 22:25:41,869 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 22:25:41,875 INFO core: _init_accounts coroutine started
2026-08-15 22:25:41,875 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 22:25:41,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:30:43,390 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-15 22:30:43,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:35:33,262 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:40:05,619 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-15 22:40:05,622 INFO core: _init_accounts coroutine started
2026-08-15 22:40:05,622 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 22:40:05,664 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 22:40:05,664 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 22:40:05,665 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 22:40:05,667 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 22:40:05,679 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 22:40:05,679 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 22:40:05,683 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-15 22:40:05,684 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-15 22:40:05,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:45:11,391 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-15 22:45:11,392 WARNING core: Account 2: connect timed out after 35s
2026-08-15 22:45:11,392 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-15 22:45:11,393 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-15 22:45:15,214 INFO core: Event loop thread started, running loop forever
2026-08-15 22:45:15,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 22:45:15,520 INFO core: _init_accounts coroutine started
2026-08-15 22:45:15,520 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 22:45:15,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:50:43,197 INFO core: Event loop thread started, running loop forever
2026-08-15 22:50:43,498 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 22:50:43,504 INFO core: _init_accounts coroutine started
2026-08-15 22:50:43,506 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 22:50:43,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:55:48,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 22:55:48,198 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 23:00:32,549 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 23:00:32,555 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 23:00:32,558 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 23:00:32,559 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:05:07,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:10:14,660 INFO core: Event loop thread started, running loop forever
2026-08-15 23:10:14,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 23:10:14,967 INFO core: _init_accounts coroutine started
2026-08-15 23:10:14,967 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 23:10:14,978 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 23:10:14,978 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 23:10:14,981 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 23:10:14,984 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 23:10:14,985 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:15:43,028 INFO core: Event loop thread started, running loop forever
2026-08-15 23:15:43,329 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 23:15:43,333 INFO core: _init_accounts coroutine started
2026-08-15 23:15:43,334 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 23:15:43,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:20:43,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 23:20:43,401 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 23:20:43,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 23:20:43,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:20:43,408 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 23:25:18,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:30:25,422 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-15 23:30:25,423 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-15 23:30:25,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-15 23:30:35,484 INFO core: Event loop thread started, running loop forever
2026-08-15 23:30:35,788 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 23:30:35,794 INFO core: _init_accounts coroutine started
2026-08-15 23:30:35,794 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 23:30:35,802 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:35:12,523 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:35:12,524 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-15 23:40:13,997 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-15 23:40:14,001 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-15 23:40:14,003 INFO core: _init_accounts_inner: reloading LLM config
2026-08-15 23:40:14,023 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:45:44,204 INFO core: Event loop thread started, running loop forever
2026-08-15 23:45:44,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 23:45:44,509 INFO core: _init_accounts coroutine started
2026-08-15 23:45:44,511 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 23:45:44,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:50:11,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-15 23:55:06,139 INFO core: Event loop thread started, running loop forever
2026-08-15 23:55:06,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-15 23:55:06,444 INFO core: _init_accounts coroutine started
2026-08-15 23:55:06,444 INFO core: _init_accounts_inner: starting DB migrations
2026-08-15 23:55:06,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:00:18,675 INFO core: Event loop thread started, running loop forever
2026-08-16 00:00:18,976 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 00:00:18,987 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:05:03,511 INFO core: _init_accounts coroutine started
2026-08-16 00:05:03,511 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 00:05:03,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:05:03,529 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 00:05:03,538 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 00:05:03,540 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 00:05:03,542 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 00:10:27,050 INFO core: Event loop thread started, running loop forever
2026-08-16 00:10:27,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 00:10:27,363 INFO core: _init_accounts coroutine started
2026-08-16 00:10:27,363 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 00:10:27,379 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:15:12,061 INFO core: Event loop thread started, running loop forever
2026-08-16 00:15:12,368 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 00:15:12,372 INFO core: _init_accounts coroutine started
2026-08-16 00:15:12,372 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 00:15:12,377 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:20:19,441 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 00:20:27,544 INFO core: Event loop thread started, running loop forever
2026-08-16 00:20:27,853 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 00:20:27,860 INFO core: _init_accounts coroutine started
2026-08-16 00:20:27,860 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 00:20:27,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:25:05,895 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 00:25:05,895 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 00:25:05,897 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 00:25:05,899 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 00:25:05,906 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:30:11,417 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 00:30:11,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 00:30:11,448 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 00:30:11,450 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 00:30:43,547 INFO core: Event loop thread started, running loop forever
2026-08-16 00:30:43,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 00:30:43,857 INFO core: _init_accounts coroutine started
2026-08-16 00:30:43,859 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 00:30:43,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:35:18,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:40:25,409 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 00:40:51,707 INFO core: Event loop thread started, running loop forever
2026-08-16 00:40:52,008 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 00:40:52,014 INFO core: _init_accounts coroutine started
2026-08-16 00:40:52,015 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 00:40:52,025 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:45:34,482 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:45:34,482 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 00:45:34,484 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 00:50:37,973 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 00:50:37,979 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 00:50:37,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 00:55:44,517 INFO core: Event loop thread started, running loop forever
2026-08-16 00:55:44,819 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 00:55:44,823 INFO core: _init_accounts coroutine started
2026-08-16 00:55:44,825 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 00:55:44,834 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:00:26,303 INFO core: Event loop thread started, running loop forever
2026-08-16 01:00:26,607 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 01:00:26,614 INFO core: _init_accounts coroutine started
2026-08-16 01:00:26,615 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 01:00:26,620 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:05:27,560 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 01:05:27,560 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 01:05:27,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 01:05:27,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:05:27,569 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 01:10:18,724 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:15:51,895 INFO core: Event loop thread started, running loop forever
2026-08-16 01:15:52,196 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 01:15:52,200 INFO core: _init_accounts coroutine started
2026-08-16 01:15:52,201 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 01:15:52,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:20:31,100 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:25:20,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 01:25:20,625 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 01:25:20,626 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:30:27,375 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 01:30:27,375 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 01:30:27,376 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 01:30:27,376 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 01:30:27,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 01:30:27,376 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 01:30:53,205 INFO core: Event loop thread started, running loop forever
2026-08-16 01:30:53,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 01:30:53,519 INFO core: _init_accounts coroutine started
2026-08-16 01:30:53,519 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 01:30:53,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:35:43,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:40:36,568 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 01:40:36,569 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 01:40:36,577 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 01:40:36,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:45:28,966 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 01:45:28,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:50:21,347 INFO core: Event loop thread started, running loop forever
2026-08-16 01:50:21,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 01:50:21,657 INFO core: _init_accounts coroutine started
2026-08-16 01:50:21,659 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 01:50:21,667 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 01:55:27,394 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-16 01:55:45,008 INFO core: Event loop thread started, running loop forever
2026-08-16 01:55:45,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 01:55:45,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:00:17,727 INFO core: _init_accounts coroutine started
2026-08-16 02:00:17,728 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 02:00:17,752 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:05:10,290 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:10:06,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:10:06,319 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 02:10:06,319 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 02:15:53,556 INFO core: Event loop thread started, running loop forever
2026-08-16 02:15:53,858 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 02:15:53,863 INFO core: _init_accounts coroutine started
2026-08-16 02:15:53,864 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 02:15:53,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:20:41,833 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 02:20:41,835 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 02:20:41,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:20:41,840 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 02:25:34,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:30:04,360 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 02:30:04,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 02:30:25,076 INFO core: Event loop thread started, running loop forever
2026-08-16 02:30:25,377 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 02:30:25,382 INFO core: _init_accounts coroutine started
2026-08-16 02:30:25,383 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 02:30:25,392 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:35:32,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 02:35:32,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 02:35:32,421 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-16 02:35:48,352 INFO core: Event loop thread started, running loop forever
2026-08-16 02:35:48,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 02:35:48,658 INFO core: _init_accounts coroutine started
2026-08-16 02:35:48,658 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 02:35:48,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:40:11,575 INFO core: Event loop thread started, running loop forever
2026-08-16 02:40:11,875 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 02:40:11,880 INFO core: _init_accounts coroutine started
2026-08-16 02:40:11,880 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 02:40:11,891 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:40:54,629 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 02:45:18,392 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 02:45:26,232 INFO core: Event loop thread started, running loop forever
2026-08-16 02:45:26,533 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 02:45:26,537 INFO core: _init_accounts coroutine started
2026-08-16 02:45:26,538 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 02:45:26,548 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 02:45:26,548 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 02:45:26,564 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 02:45:26,566 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:50:33,438 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 02:50:33,440 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 02:50:51,896 INFO core: Event loop thread started, running loop forever
2026-08-16 02:50:52,197 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 02:50:52,202 INFO core: _init_accounts coroutine started
2026-08-16 02:50:52,204 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 02:50:52,216 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 02:55:27,502 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 02:55:27,503 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 02:55:27,504 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:00:33,504 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 03:00:33,504 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 03:00:33,505 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 03:00:33,505 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 03:00:33,505 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 03:00:33,505 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 03:00:52,933 INFO core: Event loop thread started, running loop forever
2026-08-16 03:00:53,233 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 03:00:53,238 INFO core: _init_accounts coroutine started
2026-08-16 03:00:53,239 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 03:00:53,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:05:31,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:10:17,145 INFO core: Event loop thread started, running loop forever
2026-08-16 03:10:17,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 03:10:17,451 INFO core: _init_accounts coroutine started
2026-08-16 03:10:17,451 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 03:10:17,455 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:15:24,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 03:15:35,375 INFO core: Event loop thread started, running loop forever
2026-08-16 03:15:35,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 03:15:35,681 INFO core: _init_accounts coroutine started
2026-08-16 03:15:35,681 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 03:15:35,685 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:20:39,764 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 03:20:39,764 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 03:20:39,767 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 03:20:39,769 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:25:29,019 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 03:25:29,031 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:30:05,543 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 03:30:05,546 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 03:30:05,554 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 03:30:05,555 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 03:30:05,570 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:35:52,163 INFO core: Event loop thread started, running loop forever
2026-08-16 03:35:52,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 03:35:52,469 INFO core: _init_accounts coroutine started
2026-08-16 03:35:52,470 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 03:35:52,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:40:12,484 INFO core: Event loop thread started, running loop forever
2026-08-16 03:40:12,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 03:40:12,792 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:45:11,906 INFO core: _init_accounts coroutine started
2026-08-16 03:45:11,907 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 03:45:11,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:50:34,422 INFO core: Event loop thread started, running loop forever
2026-08-16 03:50:34,723 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 03:50:34,728 INFO core: _init_accounts coroutine started
2026-08-16 03:50:34,729 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 03:50:34,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:55:34,696 INFO core: Event loop thread started, running loop forever
2026-08-16 03:55:34,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 03:55:35,001 INFO core: _init_accounts coroutine started
2026-08-16 03:55:35,002 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 03:55:35,012 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 03:55:41,696 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 04:00:36,817 INFO core: Event loop thread started, running loop forever
2026-08-16 04:00:37,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 04:00:37,122 INFO core: _init_accounts coroutine started
2026-08-16 04:00:37,123 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 04:00:37,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:00:42,816 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 04:00:42,817 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 04:05:33,422 INFO core: Event loop thread started, running loop forever
2026-08-16 04:05:33,723 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 04:05:33,728 INFO core: _init_accounts coroutine started
2026-08-16 04:05:33,728 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 04:05:33,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:10:52,910 INFO core: Event loop thread started, running loop forever
2026-08-16 04:10:53,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 04:10:53,216 INFO core: _init_accounts coroutine started
2026-08-16 04:10:53,216 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 04:10:53,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:15:04,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:20:10,372 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 04:20:10,373 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 04:20:16,628 INFO core: Event loop thread started, running loop forever
2026-08-16 04:20:16,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 04:20:16,936 INFO core: _init_accounts coroutine started
2026-08-16 04:20:16,937 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 04:20:16,943 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:25:26,921 INFO core: Event loop thread started, running loop forever
2026-08-16 04:25:27,226 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 04:25:27,232 INFO core: _init_accounts coroutine started
2026-08-16 04:25:27,233 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 04:25:27,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:30:45,641 INFO core: Event loop thread started, running loop forever
2026-08-16 04:30:45,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 04:30:45,945 INFO core: _init_accounts coroutine started
2026-08-16 04:30:45,946 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 04:30:45,964 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 04:30:45,965 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 04:30:45,966 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:30:45,968 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 04:35:04,452 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 04:35:04,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:40:10,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:45:12,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:50:19,459 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 04:50:20,119 INFO core: Event loop thread started, running loop forever
2026-08-16 04:50:20,422 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 04:50:20,427 INFO core: _init_accounts coroutine started
2026-08-16 04:50:20,428 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 04:50:20,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 04:55:18,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:00:28,323 INFO core: Event loop thread started, running loop forever
2026-08-16 05:00:28,624 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 05:00:28,627 INFO core: _init_accounts coroutine started
2026-08-16 05:00:28,627 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 05:00:28,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:05:35,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 05:05:41,342 INFO core: Event loop thread started, running loop forever
2026-08-16 05:05:41,643 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 05:05:41,650 INFO core: _init_accounts coroutine started
2026-08-16 05:05:41,651 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 05:05:41,662 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:10:39,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 05:10:39,694 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 05:10:39,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:15:19,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:20:26,488 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 05:20:26,490 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 05:20:26,490 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 05:20:41,661 INFO core: Event loop thread started, running loop forever
2026-08-16 05:20:41,962 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 05:20:41,968 INFO core: _init_accounts coroutine started
2026-08-16 05:20:41,969 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 05:20:41,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:25:47,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 05:25:49,156 INFO core: Event loop thread started, running loop forever
2026-08-16 05:25:49,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 05:25:49,461 INFO core: _init_accounts coroutine started
2026-08-16 05:25:49,461 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 05:25:49,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:30:27,843 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 05:30:27,844 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 05:30:27,847 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 05:30:27,852 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 05:30:27,859 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:35:44,201 INFO core: Event loop thread started, running loop forever
2026-08-16 05:35:44,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 05:35:44,509 INFO core: _init_accounts coroutine started
2026-08-16 05:35:44,510 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 05:35:44,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:35:44,527 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 05:35:44,527 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 05:35:44,528 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 05:35:44,529 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 05:40:44,372 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 05:40:44,375 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 05:40:44,384 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 05:40:44,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 05:40:44,394 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:45:47,953 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 05:45:47,954 WARNING core: Account 2: connect timed out after 35s
2026-08-16 05:45:47,955 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 05:45:47,955 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 05:45:47,957 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 05:45:47,958 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 05:45:47,958 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 05:45:47,970 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:50:13,622 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 05:50:13,625 WARNING core: Account 2: connect timed out after 35s
2026-08-16 05:50:13,625 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-16 05:50:13,626 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-16 05:50:13,627 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 05:50:13,628 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-16 05:50:13,629 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-16 05:50:13,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 05:55:20,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 05:55:20,420 WARNING core: Account 2: connect timed out after 35s
2026-08-16 05:55:20,421 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-16 05:55:20,421 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-16 05:55:20,422 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 05:55:20,423 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-16 05:55:20,423 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-16 05:55:46,163 INFO core: Event loop thread started, running loop forever
2026-08-16 05:55:46,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 05:55:46,469 INFO core: _init_accounts coroutine started
2026-08-16 05:55:46,470 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 05:55:46,480 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:00:18,512 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 06:00:18,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:00:18,514 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 06:05:25,516 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 06:05:38,976 INFO core: Event loop thread started, running loop forever
2026-08-16 06:05:39,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 06:05:39,284 INFO core: _init_accounts coroutine started
2026-08-16 06:05:39,285 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 06:05:39,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:10:26,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:15:09,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 06:15:17,344 INFO core: Event loop thread started, running loop forever
2026-08-16 06:15:17,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 06:15:17,650 INFO core: _init_accounts coroutine started
2026-08-16 06:15:17,651 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 06:15:17,656 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:20:24,428 INFO core: Event loop thread started, running loop forever
2026-08-16 06:20:24,736 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 06:20:24,746 INFO core: _init_accounts coroutine started
2026-08-16 06:20:24,747 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 06:20:24,772 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 06:20:24,772 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 06:20:24,774 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 06:20:24,778 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 06:20:24,790 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:20:24,798 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 06:25:24,329 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 06:25:24,337 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 06:25:24,338 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 06:25:24,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:30:20,041 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 06:30:20,044 WARNING core: Account 2: connect timed out after 35s
2026-08-16 06:30:20,045 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 06:30:20,045 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 06:30:20,046 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 06:30:20,048 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 06:30:20,048 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 06:30:20,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:35:17,300 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 06:35:17,300 WARNING core: Account 2: connect timed out after 35s
2026-08-16 06:35:17,300 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-16 06:35:17,301 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-16 06:35:17,302 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 06:35:17,303 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-16 06:35:17,303 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-16 06:35:17,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:40:24,164 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 06:40:52,714 INFO core: Event loop thread started, running loop forever
2026-08-16 06:40:53,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 06:40:53,019 INFO core: _init_accounts coroutine started
2026-08-16 06:40:53,019 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 06:40:53,027 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:45:29,967 INFO core: Event loop thread started, running loop forever
2026-08-16 06:45:30,268 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 06:45:30,274 INFO core: _init_accounts coroutine started
2026-08-16 06:45:30,274 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 06:45:30,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:50:09,988 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 06:50:09,991 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 06:50:09,991 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 06:55:15,387 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-16 06:55:20,049 INFO core: Event loop thread started, running loop forever
2026-08-16 06:55:20,350 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 06:55:20,356 INFO core: _init_accounts coroutine started
2026-08-16 06:55:20,357 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 06:55:20,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 06:55:20,370 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 06:55:20,372 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 06:55:20,374 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 06:55:20,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:00:04,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:05:21,954 INFO core: Event loop thread started, running loop forever
2026-08-16 07:05:22,255 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 07:05:22,261 INFO core: _init_accounts coroutine started
2026-08-16 07:05:22,262 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 07:05:22,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:10:45,972 INFO core: Event loop thread started, running loop forever
2026-08-16 07:10:46,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 07:10:46,277 INFO core: _init_accounts coroutine started
2026-08-16 07:10:46,279 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 07:10:46,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:15:34,371 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:20:39,714 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 07:20:39,715 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 07:20:39,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:25:24,332 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 07:25:24,338 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:30:21,300 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 07:30:21,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:35:29,687 INFO core: Event loop thread started, running loop forever
2026-08-16 07:35:29,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 07:35:29,994 INFO core: _init_accounts coroutine started
2026-08-16 07:35:29,994 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 07:35:30,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:40:36,816 INFO core: Event loop thread started, running loop forever
2026-08-16 07:40:37,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 07:40:37,120 INFO core: _init_accounts coroutine started
2026-08-16 07:40:37,121 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 07:40:37,142 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:45:20,676 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:50:18,154 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 07:50:18,154 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 07:50:18,159 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 07:50:18,161 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 07:50:18,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 07:50:18,175 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 07:50:18,175 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 07:50:18,181 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 07:50:18,182 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 07:55:25,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 07:55:25,395 WARNING core: Account 2: connect timed out after 35s
2026-08-16 07:55:25,395 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 07:55:25,395 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 07:55:25,396 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 07:55:25,397 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 07:55:25,397 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 07:55:36,004 INFO core: Event loop thread started, running loop forever
2026-08-16 07:55:36,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 07:55:36,308 INFO core: _init_accounts coroutine started
2026-08-16 07:55:36,310 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 07:55:36,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:00:21,777 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 08:00:21,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:05:38,589 INFO core: Event loop thread started, running loop forever
2026-08-16 08:05:38,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 08:05:38,896 INFO core: _init_accounts coroutine started
2026-08-16 08:05:38,897 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 08:05:38,904 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:10:32,639 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 08:10:32,639 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 08:10:32,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:15:38,389 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 08:15:41,127 INFO core: Event loop thread started, running loop forever
2026-08-16 08:15:41,428 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 08:15:41,432 INFO core: _init_accounts coroutine started
2026-08-16 08:15:41,433 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 08:15:41,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:20:40,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:25:05,257 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:30:07,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 08:30:07,429 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 08:30:07,468 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 08:30:56,515 INFO core: Event loop thread started, running loop forever
2026-08-16 08:30:56,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 08:30:56,822 INFO core: _init_accounts coroutine started
2026-08-16 08:30:56,823 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 08:30:56,831 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:35:04,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:35:04,253 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 08:35:04,254 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 08:40:30,655 INFO core: Event loop thread started, running loop forever
2026-08-16 08:40:30,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 08:40:30,960 INFO core: _init_accounts coroutine started
2026-08-16 08:40:30,961 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 08:40:30,972 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:45:26,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 08:45:26,467 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 08:45:26,468 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 08:45:26,469 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 08:45:26,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:50:42,600 INFO core: Event loop thread started, running loop forever
2026-08-16 08:50:42,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 08:50:42,907 INFO core: _init_accounts coroutine started
2026-08-16 08:50:42,908 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 08:50:42,919 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 08:55:40,618 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 08:55:40,618 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 08:55:40,622 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:00:46,391 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 09:00:46,392 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 09:00:49,417 INFO core: Event loop thread started, running loop forever
2026-08-16 09:00:49,718 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 09:00:49,722 INFO core: _init_accounts coroutine started
2026-08-16 09:00:49,723 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 09:00:49,734 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:05:34,319 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 09:05:34,319 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 09:05:34,323 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 09:05:34,326 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 09:05:34,341 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 09:05:34,342 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 09:05:34,347 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 09:05:34,348 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 09:05:34,364 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:10:10,114 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 09:10:10,114 WARNING core: Account 2: connect timed out after 35s
2026-08-16 09:10:10,115 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 09:10:10,115 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 09:10:10,117 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 09:10:10,119 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 09:10:10,119 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 09:10:10,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:15:16,425 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 09:15:52,985 INFO core: Event loop thread started, running loop forever
2026-08-16 09:15:53,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 09:15:53,292 INFO core: _init_accounts coroutine started
2026-08-16 09:15:53,293 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 09:15:53,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:20:52,101 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:20:52,102 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 09:20:52,102 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 09:20:52,103 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 09:25:41,275 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 09:25:41,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:30:52,695 INFO core: Event loop thread started, running loop forever
2026-08-16 09:30:52,996 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 09:30:53,001 INFO core: _init_accounts coroutine started
2026-08-16 09:30:53,002 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 09:30:53,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:35:52,521 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 09:35:52,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:40:03,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:45:11,555 INFO core: Event loop thread started, running loop forever
2026-08-16 09:45:11,857 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 09:45:11,861 INFO core: _init_accounts coroutine started
2026-08-16 09:45:11,863 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 09:45:11,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 09:45:11,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 09:45:11,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:45:11,880 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 09:50:48,072 INFO core: Event loop thread started, running loop forever
2026-08-16 09:50:48,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 09:50:48,378 INFO core: _init_accounts coroutine started
2026-08-16 09:50:48,380 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 09:50:48,387 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 09:55:20,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:00:19,311 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 10:00:19,312 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 10:00:19,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:05:21,376 INFO core: Event loop thread started, running loop forever
2026-08-16 10:05:21,677 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 10:05:21,682 INFO core: _init_accounts coroutine started
2026-08-16 10:05:21,683 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 10:05:21,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:10:38,209 INFO core: Event loop thread started, running loop forever
2026-08-16 10:10:38,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 10:10:38,515 INFO core: _init_accounts coroutine started
2026-08-16 10:10:38,516 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 10:10:38,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:15:14,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:20:19,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 10:20:19,399 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 10:20:19,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 10:20:19,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:20:19,407 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 10:25:07,548 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 10:25:07,548 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 10:25:07,555 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 10:25:07,557 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 10:25:07,561 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:30:14,389 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 10:30:14,390 WARNING core: Account 2: connect timed out after 35s
2026-08-16 10:30:14,392 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 10:30:15,368 INFO core: Event loop thread started, running loop forever
2026-08-16 10:30:15,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 10:30:15,677 INFO core: _init_accounts coroutine started
2026-08-16 10:30:15,677 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 10:30:15,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:35:11,615 INFO core: Event loop thread started, running loop forever
2026-08-16 10:35:11,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 10:35:11,920 INFO core: _init_accounts coroutine started
2026-08-16 10:35:11,920 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 10:35:11,930 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:35:22,618 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-16 10:40:45,680 INFO core: Event loop thread started, running loop forever
2026-08-16 10:40:45,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 10:40:45,986 INFO core: _init_accounts coroutine started
2026-08-16 10:40:45,986 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 10:40:46,000 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 10:40:46,000 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 10:40:46,002 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 10:40:46,003 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 10:40:46,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:45:39,724 INFO core: Event loop thread started, running loop forever
2026-08-16 10:45:40,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 10:45:40,030 INFO core: _init_accounts coroutine started
2026-08-16 10:45:40,031 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 10:45:40,050 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 10:45:40,051 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 10:45:40,052 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 10:45:40,054 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 10:45:40,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:50:13,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 10:55:10,705 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 10:55:10,706 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 10:55:10,711 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 10:55:10,712 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 10:55:10,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:00:16,404 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 11:00:16,404 WARNING core: Account 2: connect timed out after 35s
2026-08-16 11:00:16,405 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 11:00:16,405 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 11:00:23,980 INFO core: Event loop thread started, running loop forever
2026-08-16 11:00:24,288 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 11:00:24,293 INFO core: _init_accounts coroutine started
2026-08-16 11:00:24,294 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 11:00:24,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:05:36,815 INFO core: Event loop thread started, running loop forever
2026-08-16 11:05:37,116 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 11:05:37,120 INFO core: _init_accounts coroutine started
2026-08-16 11:05:37,121 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 11:05:37,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:10:35,496 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 11:10:35,496 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 11:10:35,498 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:10:35,498 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 11:15:45,736 INFO core: Event loop thread started, running loop forever
2026-08-16 11:15:46,037 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 11:15:46,043 INFO core: _init_accounts coroutine started
2026-08-16 11:15:46,044 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 11:15:46,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:20:21,602 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 11:20:21,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:25:43,452 INFO core: Event loop thread started, running loop forever
2026-08-16 11:25:43,755 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 11:25:43,762 INFO core: _init_accounts coroutine started
2026-08-16 11:25:43,763 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 11:25:43,769 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:30:29,192 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:35:04,327 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 11:35:04,328 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 11:35:04,330 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 11:35:04,332 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:40:10,973 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 11:40:10,974 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 11:40:10,974 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 11:40:10,975 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 11:40:51,563 INFO core: Event loop thread started, running loop forever
2026-08-16 11:40:51,865 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 11:40:51,870 INFO core: _init_accounts coroutine started
2026-08-16 11:40:51,871 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 11:40:51,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:45:13,829 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:50:12,478 INFO core: Event loop thread started, running loop forever
2026-08-16 11:50:12,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 11:50:12,783 INFO core: _init_accounts coroutine started
2026-08-16 11:50:12,784 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 11:50:12,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:50:20,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 11:50:20,483 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 11:50:20,486 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 11:50:20,488 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 11:55:19,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 11:55:35,048 INFO core: Event loop thread started, running loop forever
2026-08-16 11:55:35,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 11:55:35,356 INFO core: _init_accounts coroutine started
2026-08-16 11:55:35,362 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 11:55:35,362 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:00:27,816 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:05:51,461 INFO core: Event loop thread started, running loop forever
2026-08-16 12:05:51,762 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 12:05:51,766 INFO core: _init_accounts coroutine started
2026-08-16 12:05:51,767 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:05:51,783 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 12:05:51,783 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 12:05:51,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:10:47,871 INFO core: Event loop thread started, running loop forever
2026-08-16 12:10:48,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 12:10:48,179 INFO core: _init_accounts coroutine started
2026-08-16 12:10:48,179 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:10:48,201 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-16 12:10:48,209 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-16 12:10:58,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 12:10:58,882 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 12:15:21,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:20:09,459 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-16 12:20:09,460 INFO core: _init_accounts coroutine started
2026-08-16 12:20:09,461 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:20:09,497 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:25:50,519 INFO core: Event loop thread started, running loop forever
2026-08-16 12:25:50,820 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 12:25:50,825 INFO core: _init_accounts coroutine started
2026-08-16 12:25:50,825 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:25:50,833 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:30:08,066 INFO core: Event loop thread started, running loop forever
2026-08-16 12:30:08,367 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 12:30:08,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:35:13,040 INFO core: _init_accounts coroutine started
2026-08-16 12:35:13,043 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:35:13,054 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:40:12,102 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 12:40:12,129 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:45:23,826 INFO core: Event loop thread started, running loop forever
2026-08-16 12:45:24,127 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 12:45:24,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:45:24,136 INFO core: _init_accounts coroutine started
2026-08-16 12:45:24,136 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:50:05,177 INFO core: Event loop thread started, running loop forever
2026-08-16 12:50:05,478 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 12:50:05,488 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:55:11,447 INFO core: _init_accounts coroutine started
2026-08-16 12:55:44,396 INFO core: Event loop thread started, running loop forever
2026-08-16 12:55:44,699 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 12:55:44,706 INFO core: _init_accounts coroutine started
2026-08-16 12:55:44,707 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 12:55:44,722 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 12:55:44,724 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 13:00:05,278 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 13:00:05,278 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-16 13:00:05,279 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 13:00:05,279 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 13:00:41,448 INFO core: Event loop thread started, running loop forever
2026-08-16 13:00:41,749 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 13:00:41,754 INFO core: _init_accounts coroutine started
2026-08-16 13:00:41,754 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 13:00:41,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:05:15,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:10:22,393 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 13:10:23,753 INFO core: Event loop thread started, running loop forever
2026-08-16 13:10:24,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 13:10:24,058 INFO core: _init_accounts coroutine started
2026-08-16 13:10:24,060 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 13:10:24,070 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:15:30,453 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 13:15:30,454 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 13:15:30,458 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 13:15:30,458 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 13:15:30,459 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 13:15:30,460 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 13:15:39,723 INFO core: Event loop thread started, running loop forever
2026-08-16 13:15:40,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 13:15:40,030 INFO core: _init_accounts coroutine started
2026-08-16 13:15:40,030 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 13:15:40,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:20:15,045 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 13:20:15,046 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 13:20:15,049 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 13:20:15,051 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 13:20:15,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:25:07,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:30:42,506 INFO core: Event loop thread started, running loop forever
2026-08-16 13:30:42,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 13:30:42,811 INFO core: _init_accounts coroutine started
2026-08-16 13:30:42,813 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 13:30:42,821 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:35:24,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:40:31,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 13:40:37,351 INFO core: Event loop thread started, running loop forever
2026-08-16 13:40:37,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 13:40:37,656 INFO core: _init_accounts coroutine started
2026-08-16 13:40:37,657 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 13:40:37,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:45:14,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:50:30,793 INFO core: Event loop thread started, running loop forever
2026-08-16 13:50:31,094 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 13:50:31,098 INFO core: _init_accounts coroutine started
2026-08-16 13:50:31,099 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 13:50:31,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 13:55:37,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 13:55:52,676 INFO core: Event loop thread started, running loop forever
2026-08-16 13:55:52,977 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 13:55:52,981 INFO core: _init_accounts coroutine started
2026-08-16 13:55:52,982 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 13:55:53,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:00:50,717 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 14:00:50,717 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 14:00:50,719 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 14:00:50,721 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 14:00:50,726 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:05:24,971 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 14:05:24,972 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 14:05:24,982 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 14:05:24,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:05:24,984 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 14:10:12,830 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 14:10:12,831 WARNING core: Account 2: connect timed out after 35s
2026-08-16 14:10:12,831 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 14:10:12,832 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 14:10:12,833 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 14:10:12,834 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 14:10:12,834 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 14:10:12,842 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:15:19,490 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 14:15:36,114 INFO core: Event loop thread started, running loop forever
2026-08-16 14:15:36,415 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 14:15:36,420 INFO core: _init_accounts coroutine started
2026-08-16 14:15:36,421 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 14:15:36,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:15:36,442 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 14:15:36,443 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 14:15:36,445 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 14:15:36,447 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 14:20:43,477 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 14:20:43,478 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 14:20:43,478 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 14:20:49,161 INFO core: Event loop thread started, running loop forever
2026-08-16 14:20:49,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 14:20:49,468 INFO core: _init_accounts coroutine started
2026-08-16 14:20:49,471 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 14:20:49,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:25:28,539 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:30:13,753 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:35:19,385 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-16 14:35:44,277 INFO core: Event loop thread started, running loop forever
2026-08-16 14:35:44,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 14:35:44,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:35:44,593 INFO core: _init_accounts coroutine started
2026-08-16 14:35:44,594 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 14:40:04,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:45:50,148 INFO core: Event loop thread started, running loop forever
2026-08-16 14:45:50,450 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 14:45:50,454 INFO core: _init_accounts coroutine started
2026-08-16 14:45:50,455 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 14:45:50,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:50:52,357 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 14:50:52,369 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 14:55:46,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:00:12,196 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-16 15:00:12,198 INFO core: _init_accounts coroutine started
2026-08-16 15:00:12,198 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 15:00:12,202 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:05:44,241 INFO core: Event loop thread started, running loop forever
2026-08-16 15:05:44,548 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 15:05:44,553 INFO core: _init_accounts coroutine started
2026-08-16 15:05:44,554 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 15:05:44,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:10:15,568 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 15:10:15,575 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:15:39,165 INFO core: Event loop thread started, running loop forever
2026-08-16 15:15:39,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 15:15:39,470 INFO core: _init_accounts coroutine started
2026-08-16 15:15:39,470 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 15:15:39,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:20:44,054 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:25:03,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:30:40,950 INFO core: Event loop thread started, running loop forever
2026-08-16 15:30:41,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 15:30:41,257 INFO core: _init_accounts coroutine started
2026-08-16 15:30:41,257 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 15:30:41,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:35:23,233 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:40:15,711 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 15:40:15,712 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 15:40:15,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:40:15,718 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 15:45:38,227 INFO core: Event loop thread started, running loop forever
2026-08-16 15:45:38,528 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 15:45:38,534 INFO core: _init_accounts coroutine started
2026-08-16 15:45:38,534 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 15:45:38,541 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:50:45,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 15:50:50,354 INFO core: Event loop thread started, running loop forever
2026-08-16 15:50:50,655 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 15:50:50,659 INFO core: _init_accounts coroutine started
2026-08-16 15:50:50,660 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 15:50:50,674 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 15:55:39,678 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 15:55:39,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:00:18,761 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:05:03,131 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-16 16:05:03,134 INFO core: _init_accounts coroutine started
2026-08-16 16:05:03,134 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 16:05:03,151 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:10:05,556 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 16:10:05,563 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 16:10:05,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:15:10,301 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 16:15:10,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:20:03,128 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 16:20:03,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:20:03,167 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 16:20:03,169 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 16:20:03,182 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 16:20:03,183 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 16:25:07,809 INFO core: Event loop thread started, running loop forever
2026-08-16 16:25:08,110 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 16:25:08,114 INFO core: _init_accounts coroutine started
2026-08-16 16:25:08,115 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 16:25:08,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:25:10,803 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 16:25:10,803 WARNING core: Account 2: connect timed out after 35s
2026-08-16 16:25:10,804 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 16:25:10,804 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 16:25:10,805 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 16:25:10,806 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 16:25:10,807 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 16:30:10,722 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:35:12,700 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 16:35:12,713 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:40:04,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:45:25,771 INFO core: Event loop thread started, running loop forever
2026-08-16 16:45:26,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 16:45:26,077 INFO core: _init_accounts coroutine started
2026-08-16 16:45:26,079 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 16:45:26,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:50:34,500 INFO core: Event loop thread started, running loop forever
2026-08-16 16:50:34,801 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 16:50:34,806 INFO core: _init_accounts coroutine started
2026-08-16 16:50:34,807 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 16:50:34,815 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 16:55:38,876 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 16:55:38,886 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:00:45,175 INFO core: Event loop thread started, running loop forever
2026-08-16 17:00:45,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 17:00:45,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:05:19,000 INFO core: _init_accounts coroutine started
2026-08-16 17:05:19,001 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 17:05:19,057 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 17:05:19,058 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 17:05:19,058 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:10:21,097 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 17:10:21,100 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:15:48,176 INFO core: Event loop thread started, running loop forever
2026-08-16 17:15:48,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 17:15:48,480 INFO core: _init_accounts coroutine started
2026-08-16 17:15:48,481 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 17:15:48,492 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:20:18,173 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:25:25,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 17:25:25,372 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 17:25:36,100 INFO core: Event loop thread started, running loop forever
2026-08-16 17:25:36,401 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 17:25:36,410 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:30:03,364 INFO core: _init_accounts coroutine started
2026-08-16 17:30:03,365 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 17:30:03,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 17:30:31,718 INFO core: Event loop thread started, running loop forever
2026-08-16 17:30:32,020 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 17:30:32,031 INFO core: _init_accounts coroutine started
2026-08-16 17:30:32,031 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 17:30:32,034 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:35:34,670 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 17:35:34,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:40:33,253 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:45:10,793 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-16 17:45:10,795 INFO core: _init_accounts coroutine started
2026-08-16 17:45:10,795 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 17:45:10,818 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 17:45:10,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 17:45:10,819 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 17:45:10,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:50:20,926 INFO core: Event loop thread started, running loop forever
2026-08-16 17:50:21,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 17:50:21,233 INFO core: _init_accounts coroutine started
2026-08-16 17:50:21,233 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 17:50:21,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 17:55:30,774 INFO core: Event loop thread started, running loop forever
2026-08-16 17:55:31,075 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 17:55:31,086 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:00:37,440 INFO core: _init_accounts coroutine started
2026-08-16 18:00:49,155 INFO core: Event loop thread started, running loop forever
2026-08-16 18:00:49,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 18:00:49,469 INFO core: _init_accounts coroutine started
2026-08-16 18:00:49,469 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 18:00:49,498 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:05:51,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:10:38,157 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 18:10:38,158 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 18:10:38,171 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 18:10:38,174 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 18:10:38,189 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 18:10:38,189 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 18:10:38,203 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 18:10:38,204 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 18:10:38,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:15:07,780 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 18:15:07,782 WARNING core: Account 2: connect timed out after 35s
2026-08-16 18:15:07,783 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 18:15:07,783 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 18:15:07,784 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 18:15:07,786 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 18:15:07,787 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 18:15:07,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:20:43,213 INFO core: Event loop thread started, running loop forever
2026-08-16 18:20:43,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 18:20:43,518 INFO core: _init_accounts coroutine started
2026-08-16 18:20:43,519 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 18:20:43,529 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:25:25,244 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 18:25:25,245 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 18:25:25,246 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 18:25:25,248 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 18:25:25,258 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 18:25:25,258 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 18:25:25,263 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 18:25:25,264 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 18:25:25,269 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:30:40,272 INFO core: Event loop thread started, running loop forever
2026-08-16 18:30:40,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 18:30:40,578 INFO core: _init_accounts coroutine started
2026-08-16 18:30:40,580 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 18:30:40,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:35:13,802 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:35:13,803 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 18:40:19,419 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 18:40:19,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 18:40:19,433 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 18:40:19,434 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 18:40:19,434 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 18:40:19,434 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 18:40:19,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 18:40:51,640 INFO core: Event loop thread started, running loop forever
2026-08-16 18:40:51,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 18:40:51,950 INFO core: _init_accounts coroutine started
2026-08-16 18:40:51,950 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 18:40:51,961 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:40:51,962 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 18:40:51,963 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 18:45:49,001 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 18:45:49,005 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 18:45:49,008 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:50:08,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 18:55:51,972 INFO core: Event loop thread started, running loop forever
2026-08-16 18:55:52,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 18:55:52,280 INFO core: _init_accounts coroutine started
2026-08-16 18:55:52,280 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 18:55:52,287 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:00:04,392 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:05:23,475 INFO core: Event loop thread started, running loop forever
2026-08-16 19:05:23,777 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 19:05:23,782 INFO core: _init_accounts coroutine started
2026-08-16 19:05:23,784 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 19:05:23,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:10:06,529 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 19:10:06,529 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 19:10:06,531 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 19:10:06,532 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 19:10:06,544 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 19:10:06,544 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 19:10:06,549 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 19:10:06,550 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 19:10:06,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:15:04,049 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 19:15:04,049 WARNING core: Account 2: connect timed out after 35s
2026-08-16 19:15:04,050 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-16 19:15:04,050 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-16 19:15:04,051 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 19:15:04,052 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-16 19:15:04,052 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-16 19:15:04,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:20:04,794 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 19:20:04,795 WARNING core: Account 2: connect timed out after 35s
2026-08-16 19:20:04,797 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-16 19:20:04,798 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-16 19:20:04,799 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 19:20:04,801 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-16 19:20:04,802 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-16 19:20:04,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:25:11,396 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-16 19:25:11,398 WARNING core: Account 2: connect timed out after 35s
2026-08-16 19:25:11,398 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-16 19:25:11,399 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-16 19:25:11,399 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-16 19:25:11,400 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-16 19:25:11,401 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-16 19:25:45,902 INFO core: Event loop thread started, running loop forever
2026-08-16 19:25:46,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 19:25:46,208 INFO core: _init_accounts coroutine started
2026-08-16 19:25:46,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 19:25:46,219 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:25:46,222 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 19:25:46,238 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 19:30:48,468 INFO core: Event loop thread started, running loop forever
2026-08-16 19:30:48,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 19:30:48,774 INFO core: _init_accounts coroutine started
2026-08-16 19:30:48,774 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 19:30:48,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:35:52,036 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 19:35:52,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 19:35:52,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:35:52,038 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 19:40:28,337 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 19:40:28,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:45:10,586 INFO core: Event loop thread started, running loop forever
2026-08-16 19:45:10,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 19:45:10,893 INFO core: _init_accounts coroutine started
2026-08-16 19:45:10,894 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 19:45:10,904 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 19:45:10,905 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 19:45:10,906 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 19:45:10,907 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:50:40,769 INFO core: Event loop thread started, running loop forever
2026-08-16 19:50:41,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 19:50:41,074 INFO core: _init_accounts coroutine started
2026-08-16 19:50:41,075 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 19:50:41,089 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:55:07,640 INFO core: Event loop thread started, running loop forever
2026-08-16 19:55:07,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 19:55:07,947 INFO core: _init_accounts coroutine started
2026-08-16 19:55:07,948 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 19:55:07,955 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 19:55:48,688 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 19:55:48,688 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 20:00:32,587 INFO core: Event loop thread started, running loop forever
2026-08-16 20:00:32,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 20:00:32,893 INFO core: _init_accounts coroutine started
2026-08-16 20:00:32,894 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 20:00:32,907 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:05:18,195 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 20:05:18,196 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 20:05:18,205 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 20:05:18,208 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 20:05:18,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:10:23,130 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:15:30,389 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 20:15:36,154 INFO core: Event loop thread started, running loop forever
2026-08-16 20:15:36,455 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 20:15:36,459 INFO core: _init_accounts coroutine started
2026-08-16 20:15:36,459 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 20:15:36,470 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:20:14,730 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 20:20:14,736 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:25:21,778 INFO core: Event loop thread started, running loop forever
2026-08-16 20:25:22,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 20:25:22,082 INFO core: _init_accounts coroutine started
2026-08-16 20:25:22,083 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 20:25:22,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:30:28,426 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 20:30:28,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 20:30:28,427 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-16 20:30:28,428 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 20:30:28,428 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 20:30:28,428 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 20:30:28,428 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 20:30:28,428 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 20:30:28,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 20:30:43,322 INFO core: Event loop thread started, running loop forever
2026-08-16 20:30:43,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 20:30:43,628 INFO core: _init_accounts coroutine started
2026-08-16 20:30:43,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 20:30:43,635 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:35:18,239 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:40:24,572 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 20:40:51,702 INFO core: Event loop thread started, running loop forever
2026-08-16 20:40:52,003 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 20:40:52,008 INFO core: _init_accounts coroutine started
2026-08-16 20:40:52,009 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 20:40:52,014 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:45:20,775 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:50:21,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 20:55:31,607 INFO core: Event loop thread started, running loop forever
2026-08-16 20:55:31,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 20:55:31,913 INFO core: _init_accounts coroutine started
2026-08-16 20:55:31,915 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 20:55:31,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:00:06,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:05:04,186 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 21:05:04,186 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 21:05:04,204 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 21:05:04,207 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 21:05:04,228 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 21:05:04,228 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 21:05:04,235 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-16 21:05:04,236 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-16 21:05:04,248 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:10:28,796 INFO core: Event loop thread started, running loop forever
2026-08-16 21:10:29,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 21:10:29,101 INFO core: _init_accounts coroutine started
2026-08-16 21:10:29,102 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 21:10:29,118 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:10:29,128 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 21:10:29,128 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 21:10:29,130 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 21:15:16,154 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 21:15:16,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:20:23,345 INFO core: Event loop thread started, running loop forever
2026-08-16 21:20:23,364 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 21:20:23,364 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 21:20:23,364 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 21:20:23,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 21:20:23,651 INFO core: _init_accounts coroutine started
2026-08-16 21:20:23,653 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 21:20:23,675 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:25:24,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:30:30,372 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 21:30:30,372 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 21:30:30,372 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-16 21:30:30,373 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 21:30:30,373 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 21:30:30,373 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 21:30:30,373 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 21:30:30,373 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 21:30:30,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 21:30:52,321 INFO core: Event loop thread started, running loop forever
2026-08-16 21:30:52,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 21:30:52,628 INFO core: _init_accounts coroutine started
2026-08-16 21:30:52,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 21:30:52,641 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 21:30:52,642 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 21:30:52,643 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 21:30:52,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:30:52,646 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 21:35:43,893 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:40:37,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:45:44,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 21:45:52,249 INFO core: Event loop thread started, running loop forever
2026-08-16 21:45:52,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 21:45:52,559 INFO core: _init_accounts coroutine started
2026-08-16 21:45:52,561 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 21:45:52,569 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:50:23,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 21:55:30,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 21:55:41,511 INFO core: Event loop thread started, running loop forever
2026-08-16 21:55:41,812 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 21:55:41,815 INFO core: _init_accounts coroutine started
2026-08-16 21:55:41,816 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 21:55:41,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:00:05,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 22:00:05,452 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 22:00:05,453 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-16 22:00:05,453 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 22:00:05,454 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 22:00:05,454 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 22:00:05,454 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 22:00:05,454 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 22:00:05,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 22:00:29,115 INFO core: Event loop thread started, running loop forever
2026-08-16 22:00:29,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 22:00:29,421 INFO core: _init_accounts coroutine started
2026-08-16 22:00:29,422 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 22:00:29,439 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:05:36,841 INFO core: Event loop thread started, running loop forever
2026-08-16 22:05:37,142 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 22:05:37,147 INFO core: _init_accounts coroutine started
2026-08-16 22:05:37,147 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 22:05:37,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:10:22,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:15:28,480 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 22:15:35,608 INFO core: Event loop thread started, running loop forever
2026-08-16 22:15:35,911 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 22:15:35,916 INFO core: _init_accounts coroutine started
2026-08-16 22:15:35,916 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 22:15:35,928 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:15:35,937 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 22:15:35,938 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 22:15:35,940 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 22:20:13,147 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 22:20:13,154 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:25:20,395 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 22:25:20,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 22:25:20,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 22:25:52,056 INFO core: Event loop thread started, running loop forever
2026-08-16 22:25:52,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 22:25:52,361 INFO core: _init_accounts coroutine started
2026-08-16 22:25:52,362 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 22:25:52,377 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:30:26,622 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:35:51,839 INFO core: Event loop thread started, running loop forever
2026-08-16 22:35:52,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 22:35:52,147 INFO core: _init_accounts coroutine started
2026-08-16 22:35:52,148 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 22:35:52,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:35:52,164 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 22:35:52,165 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 22:35:52,166 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 22:40:05,590 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 22:40:05,597 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:45:11,496 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-16 22:45:11,497 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 22:45:11,497 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 22:45:35,972 INFO core: Event loop thread started, running loop forever
2026-08-16 22:45:36,272 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 22:45:36,276 INFO core: _init_accounts coroutine started
2026-08-16 22:45:36,277 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 22:45:36,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:50:05,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 22:50:05,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 22:50:05,419 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 22:55:24,092 INFO core: Event loop thread started, running loop forever
2026-08-16 22:55:24,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 22:55:24,397 INFO core: _init_accounts coroutine started
2026-08-16 22:55:24,398 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 22:55:24,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:00:50,215 INFO core: Event loop thread started, running loop forever
2026-08-16 23:00:50,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 23:00:50,520 INFO core: _init_accounts coroutine started
2026-08-16 23:00:50,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 23:00:50,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:05:15,595 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-16 23:05:15,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:10:26,104 INFO core: Event loop thread started, running loop forever
2026-08-16 23:10:26,405 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 23:10:26,410 INFO core: _init_accounts coroutine started
2026-08-16 23:10:26,412 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 23:10:26,417 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:15:10,116 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:20:11,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:20:11,523 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 23:20:11,523 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 23:25:18,447 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 23:25:18,447 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 23:25:18,448 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 23:25:18,448 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 23:25:18,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 23:25:18,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 23:25:33,069 INFO core: Event loop thread started, running loop forever
2026-08-16 23:25:33,370 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 23:25:33,375 INFO core: _init_accounts coroutine started
2026-08-16 23:25:33,376 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 23:25:33,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:30:32,498 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:35:15,596 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 23:35:15,607 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 23:35:15,617 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:40:41,382 INFO core: Event loop thread started, running loop forever
2026-08-16 23:40:41,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 23:40:41,688 INFO core: _init_accounts coroutine started
2026-08-16 23:40:41,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 23:40:41,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:45:23,607 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 23:45:23,607 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 23:45:23,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:50:30,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 23:50:30,423 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-16 23:50:30,423 INFO core: _init_accounts_inner: reloading LLM config
2026-08-16 23:50:30,424 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-16 23:50:30,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-16 23:50:30,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-16 23:50:46,362 INFO core: Event loop thread started, running loop forever
2026-08-16 23:50:46,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-16 23:50:46,668 INFO core: _init_accounts coroutine started
2026-08-16 23:50:46,668 INFO core: _init_accounts_inner: starting DB migrations
2026-08-16 23:50:46,674 INFO core: status() clients=0 connected=False forwarding=False
2026-08-16 23:50:46,679 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-16 23:50:46,679 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-16 23:55:42,633 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-16 23:55:42,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:00:46,758 INFO core: Event loop thread started, running loop forever
2026-08-17 00:00:47,063 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 00:00:47,067 INFO core: _init_accounts coroutine started
2026-08-17 00:00:47,068 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 00:00:47,076 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:05:40,652 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 00:05:40,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:10:44,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:15:07,381 INFO core: Event loop thread started, running loop forever
2026-08-17 00:15:07,682 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 00:15:07,686 INFO core: _init_accounts coroutine started
2026-08-17 00:15:07,687 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 00:15:07,695 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:20:18,370 INFO core: Event loop thread started, running loop forever
2026-08-17 00:20:18,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 00:20:18,676 INFO core: _init_accounts coroutine started
2026-08-17 00:20:18,677 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 00:20:18,686 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:25:52,846 INFO core: Event loop thread started, running loop forever
2026-08-17 00:25:53,147 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 00:25:53,154 INFO core: _init_accounts coroutine started
2026-08-17 00:25:53,154 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 00:25:53,161 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:30:48,138 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 00:30:48,139 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 00:30:48,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:35:17,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 00:35:17,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:40:38,140 INFO core: Event loop thread started, running loop forever
2026-08-17 00:40:38,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 00:40:38,448 INFO core: _init_accounts coroutine started
2026-08-17 00:40:38,449 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 00:40:38,455 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:45:16,078 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 00:45:16,079 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 00:45:16,086 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 00:45:16,088 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 00:45:16,089 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:50:20,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 00:55:43,670 INFO core: Event loop thread started, running loop forever
2026-08-17 00:55:43,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 00:55:43,976 INFO core: _init_accounts coroutine started
2026-08-17 00:55:43,976 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 00:55:43,989 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:00:34,599 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 01:00:34,600 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 01:00:34,604 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 01:00:34,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:05:37,562 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 01:05:37,603 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:10:24,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:15:44,329 INFO core: Event loop thread started, running loop forever
2026-08-17 01:15:44,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 01:15:44,635 INFO core: _init_accounts coroutine started
2026-08-17 01:15:44,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 01:15:44,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:20:20,647 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 01:20:20,647 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 01:20:20,652 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:20:20,652 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 01:20:20,654 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 01:25:29,278 INFO core: Event loop thread started, running loop forever
2026-08-17 01:25:29,579 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 01:25:29,583 INFO core: _init_accounts coroutine started
2026-08-17 01:25:29,583 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 01:25:29,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:30:16,451 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 01:30:16,452 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 01:30:16,453 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:35:22,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 01:35:22,413 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-17 01:35:22,414 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 01:35:41,586 INFO core: Event loop thread started, running loop forever
2026-08-17 01:35:41,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 01:35:41,891 INFO core: _init_accounts coroutine started
2026-08-17 01:35:41,892 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 01:35:41,898 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:40:09,480 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:45:15,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 01:45:19,140 INFO core: Event loop thread started, running loop forever
2026-08-17 01:45:19,450 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 01:45:19,455 INFO core: _init_accounts coroutine started
2026-08-17 01:45:19,455 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 01:45:19,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:50:50,845 INFO core: Event loop thread started, running loop forever
2026-08-17 01:50:51,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 01:50:51,149 INFO core: _init_accounts coroutine started
2026-08-17 01:50:51,151 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 01:50:51,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 01:55:09,651 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 01:55:09,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:00:25,222 INFO core: Event loop thread started, running loop forever
2026-08-17 02:00:25,523 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 02:00:25,527 INFO core: _init_accounts coroutine started
2026-08-17 02:00:25,527 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 02:00:25,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:05:48,988 INFO core: Event loop thread started, running loop forever
2026-08-17 02:05:49,289 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 02:05:49,294 INFO core: _init_accounts coroutine started
2026-08-17 02:05:49,296 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 02:05:49,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:10:16,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:15:05,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 02:15:22,000 INFO core: Event loop thread started, running loop forever
2026-08-17 02:15:22,301 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 02:15:22,305 INFO core: _init_accounts coroutine started
2026-08-17 02:15:22,306 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 02:15:22,311 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:20:28,352 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:20:28,355 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 02:25:15,918 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 02:25:15,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:30:08,136 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 02:30:08,141 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 02:30:08,173 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:35:52,436 INFO core: Event loop thread started, running loop forever
2026-08-17 02:35:52,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 02:35:52,742 INFO core: _init_accounts coroutine started
2026-08-17 02:35:52,743 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 02:35:52,755 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:40:19,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:45:26,361 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 02:45:36,831 INFO core: Event loop thread started, running loop forever
2026-08-17 02:45:37,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 02:45:37,139 INFO core: _init_accounts coroutine started
2026-08-17 02:45:37,140 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 02:45:37,152 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:50:52,519 INFO core: Event loop thread started, running loop forever
2026-08-17 02:50:52,820 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 02:50:52,825 INFO core: _init_accounts coroutine started
2026-08-17 02:50:52,825 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 02:50:52,836 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 02:55:38,684 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 02:55:38,685 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 02:55:38,687 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 02:55:38,690 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 02:55:38,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:00:35,469 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:05:42,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 03:05:42,390 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 03:05:44,972 INFO core: Event loop thread started, running loop forever
2026-08-17 03:05:45,280 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 03:05:45,285 INFO core: _init_accounts coroutine started
2026-08-17 03:05:45,286 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 03:05:45,301 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 03:05:45,301 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 03:05:45,303 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 03:05:45,305 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 03:05:45,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:10:39,368 INFO core: Event loop thread started, running loop forever
2026-08-17 03:10:39,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 03:10:39,679 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:10:39,681 INFO core: _init_accounts coroutine started
2026-08-17 03:10:39,681 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 03:15:42,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:20:17,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:25:14,136 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 03:25:14,137 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 03:25:14,153 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 03:25:14,155 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 03:25:14,224 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:30:21,528 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 03:30:21,549 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 03:30:21,550 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 03:30:54,209 INFO core: Event loop thread started, running loop forever
2026-08-17 03:30:54,519 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 03:30:54,535 INFO core: _init_accounts coroutine started
2026-08-17 03:30:54,536 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 03:30:54,541 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:35:36,471 INFO core: Event loop thread started, running loop forever
2026-08-17 03:35:36,772 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 03:35:36,776 INFO core: _init_accounts coroutine started
2026-08-17 03:35:36,776 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 03:35:36,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:40:26,773 INFO core: Event loop thread started, running loop forever
2026-08-17 03:40:27,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 03:40:27,082 INFO core: _init_accounts coroutine started
2026-08-17 03:40:27,083 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 03:40:27,084 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:45:28,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 03:45:28,438 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 03:45:28,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 03:45:28,441 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 03:45:28,442 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:50:14,718 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:55:34,687 INFO core: Event loop thread started, running loop forever
2026-08-17 03:55:34,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 03:55:34,997 INFO core: _init_accounts coroutine started
2026-08-17 03:55:34,997 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 03:55:35,009 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 03:55:35,013 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 03:55:35,013 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 03:55:35,015 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 03:55:35,016 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 04:00:36,449 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 04:00:36,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 04:00:36,457 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 04:00:36,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:00:36,461 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 04:10:46,802 INFO core: Event loop thread started, running loop forever
2026-08-17 04:10:47,104 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 04:10:47,109 INFO core: _init_accounts coroutine started
2026-08-17 04:10:47,110 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 04:10:47,116 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:15:45,034 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:20:19,856 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 04:20:19,856 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 04:20:19,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:25:18,023 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 04:25:18,030 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 04:25:18,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:30:24,407 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:30:24,410 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 04:30:24,415 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 04:35:23,578 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 04:35:23,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:35:23,585 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 04:40:12,933 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 04:40:12,938 WARNING core: Account 2: connect timed out after 35s
2026-08-17 04:40:12,941 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-17 04:40:12,942 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-17 04:40:12,943 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 04:40:12,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:40:12,946 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-17 04:45:18,444 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-17 04:45:51,489 INFO core: Event loop thread started, running loop forever
2026-08-17 04:45:51,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 04:45:51,795 INFO core: _init_accounts coroutine started
2026-08-17 04:45:51,796 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 04:45:51,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:50:38,508 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 04:55:15,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 04:55:15,626 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 04:55:15,630 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:00:21,370 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 05:00:49,375 INFO core: Event loop thread started, running loop forever
2026-08-17 05:00:49,677 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 05:00:49,682 INFO core: _init_accounts coroutine started
2026-08-17 05:00:49,683 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 05:00:49,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:05:14,728 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 05:05:14,728 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 05:05:14,732 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 05:05:14,751 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 05:05:14,760 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:10:32,248 INFO core: Event loop thread started, running loop forever
2026-08-17 05:10:32,549 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 05:10:32,554 INFO core: _init_accounts coroutine started
2026-08-17 05:10:32,555 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 05:10:32,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:15:39,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 05:15:39,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 05:15:39,440 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-17 05:15:39,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 05:15:39,441 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-17 05:15:39,441 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 05:15:39,441 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-17 05:15:39,441 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 05:15:39,441 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 05:15:40,814 INFO core: Event loop thread started, running loop forever
2026-08-17 05:15:41,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 05:15:41,121 INFO core: _init_accounts coroutine started
2026-08-17 05:15:41,122 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 05:15:41,128 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:20:14,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:25:33,080 INFO core: Event loop thread started, running loop forever
2026-08-17 05:25:33,381 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 05:25:33,392 INFO core: _init_accounts coroutine started
2026-08-17 05:25:33,393 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 05:25:33,397 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:30:14,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:35:20,450 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 05:35:31,593 INFO core: Event loop thread started, running loop forever
2026-08-17 05:35:31,897 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 05:35:31,903 INFO core: _init_accounts coroutine started
2026-08-17 05:35:31,903 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 05:35:31,908 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:40:20,263 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 05:40:20,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:45:42,136 INFO core: Event loop thread started, running loop forever
2026-08-17 05:45:42,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 05:45:42,443 INFO core: _init_accounts coroutine started
2026-08-17 05:45:42,446 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 05:45:42,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:50:37,134 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 05:50:37,136 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 05:50:37,139 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 05:50:37,143 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 05:55:34,084 INFO core: Event loop thread started, running loop forever
2026-08-17 05:55:34,386 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 05:55:34,392 INFO core: _init_accounts coroutine started
2026-08-17 05:55:34,394 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 05:55:34,408 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-17 05:55:34,408 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-17 06:00:08,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:05:47,536 INFO core: Event loop thread started, running loop forever
2026-08-17 06:05:47,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 06:05:47,847 INFO core: _init_accounts coroutine started
2026-08-17 06:05:47,848 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 06:05:47,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:10:08,097 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 06:10:08,098 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 06:10:08,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:15:10,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 06:15:31,431 INFO core: Event loop thread started, running loop forever
2026-08-17 06:15:31,732 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 06:15:31,738 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:20:22,828 INFO core: _init_accounts coroutine started
2026-08-17 06:20:22,828 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 06:20:22,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:25:14,845 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 06:25:14,845 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 06:25:14,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:25:14,849 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 06:30:20,416 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 06:30:47,278 INFO core: Event loop thread started, running loop forever
2026-08-17 06:30:47,579 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 06:30:47,582 INFO core: _init_accounts coroutine started
2026-08-17 06:30:47,583 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 06:30:47,594 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:35:21,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:40:28,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 06:40:28,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 06:40:41,660 INFO core: Event loop thread started, running loop forever
2026-08-17 06:40:41,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 06:40:41,967 INFO core: _init_accounts coroutine started
2026-08-17 06:40:41,967 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 06:40:41,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:45:22,669 INFO core: Event loop thread started, running loop forever
2026-08-17 06:45:22,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 06:45:22,974 INFO core: _init_accounts coroutine started
2026-08-17 06:45:22,975 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 06:45:22,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:50:29,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 06:50:29,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 06:50:49,129 INFO core: Event loop thread started, running loop forever
2026-08-17 06:50:49,430 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 06:50:49,435 INFO core: _init_accounts coroutine started
2026-08-17 06:50:49,435 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 06:50:49,443 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 06:55:34,300 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 06:55:34,301 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 06:55:34,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:00:16,940 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 07:00:16,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:05:33,349 INFO core: Event loop thread started, running loop forever
2026-08-17 07:05:33,650 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 07:05:33,655 INFO core: _init_accounts coroutine started
2026-08-17 07:05:33,656 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 07:05:33,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:10:53,004 INFO core: Event loop thread started, running loop forever
2026-08-17 07:10:53,305 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 07:10:53,310 INFO core: _init_accounts coroutine started
2026-08-17 07:10:53,311 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 07:10:53,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:15:05,868 INFO core: Event loop thread started, running loop forever
2026-08-17 07:15:06,169 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 07:15:06,175 INFO core: _init_accounts coroutine started
2026-08-17 07:15:06,175 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 07:15:06,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:20:13,440 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-17 07:20:22,691 INFO core: Event loop thread started, running loop forever
2026-08-17 07:20:22,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 07:20:22,996 INFO core: _init_accounts coroutine started
2026-08-17 07:20:22,997 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 07:20:23,004 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:25:15,965 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:30:14,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 07:30:14,468 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 07:30:14,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:30:14,475 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 07:35:29,548 INFO core: Event loop thread started, running loop forever
2026-08-17 07:35:29,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 07:35:29,855 INFO core: _init_accounts coroutine started
2026-08-17 07:35:29,857 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 07:35:29,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:40:11,642 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:45:39,289 INFO core: Event loop thread started, running loop forever
2026-08-17 07:45:39,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 07:45:39,597 INFO core: _init_accounts coroutine started
2026-08-17 07:45:39,597 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 07:45:39,631 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:50:11,835 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 07:50:11,835 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 07:50:11,840 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 07:50:11,842 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 07:50:11,848 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 07:55:45,008 INFO core: Event loop thread started, running loop forever
2026-08-17 07:55:45,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 07:55:45,314 INFO core: _init_accounts coroutine started
2026-08-17 07:55:45,316 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 07:55:45,330 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:00:13,880 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 08:00:13,880 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 08:00:13,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 08:00:13,883 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 08:00:13,894 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:05:05,160 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 08:05:05,160 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 08:05:05,172 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 08:05:05,173 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 08:05:05,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:10:12,443 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 08:10:16,515 INFO core: Event loop thread started, running loop forever
2026-08-17 08:10:16,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 08:10:16,828 INFO core: _init_accounts coroutine started
2026-08-17 08:10:16,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:10:16,831 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 08:15:13,160 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 08:15:13,161 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 08:15:13,162 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:15:13,165 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 08:20:08,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 08:20:08,433 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:25:31,524 INFO core: Event loop thread started, running loop forever
2026-08-17 08:25:31,826 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 08:25:31,830 INFO core: _init_accounts coroutine started
2026-08-17 08:25:31,831 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 08:25:31,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:30:10,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 08:30:20,116 INFO core: Event loop thread started, running loop forever
2026-08-17 08:30:20,417 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 08:30:20,422 INFO core: _init_accounts coroutine started
2026-08-17 08:30:20,426 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 08:30:20,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:35:27,475 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 08:35:46,722 INFO core: Event loop thread started, running loop forever
2026-08-17 08:35:47,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 08:35:47,030 INFO core: _init_accounts coroutine started
2026-08-17 08:35:47,031 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 08:35:47,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:40:39,281 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 08:40:39,282 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 08:40:39,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:45:15,897 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 08:45:15,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:50:21,446 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 08:50:21,447 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-17 08:50:21,447 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 08:50:21,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 08:50:24,698 INFO core: Event loop thread started, running loop forever
2026-08-17 08:50:24,999 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 08:50:25,005 INFO core: _init_accounts coroutine started
2026-08-17 08:50:25,006 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 08:50:25,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 08:55:44,715 INFO core: Event loop thread started, running loop forever
2026-08-17 08:55:45,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 08:55:45,020 INFO core: _init_accounts coroutine started
2026-08-17 08:55:45,022 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 08:55:45,029 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:00:26,621 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:00:26,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 09:05:33,423 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 09:05:43,963 INFO core: Event loop thread started, running loop forever
2026-08-17 09:05:44,265 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 09:05:44,273 INFO core: _init_accounts coroutine started
2026-08-17 09:05:44,274 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 09:05:44,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:10:32,689 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 09:10:32,689 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 09:10:32,691 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 09:10:32,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:15:34,409 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 09:15:34,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:20:46,512 INFO core: Event loop thread started, running loop forever
2026-08-17 09:20:46,813 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 09:20:46,818 INFO core: _init_accounts coroutine started
2026-08-17 09:20:46,819 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 09:20:46,829 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:25:31,310 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:30:21,822 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 09:30:21,823 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 09:30:21,826 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 09:30:21,828 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 09:30:21,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:35:06,894 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:40:15,465 INFO core: Event loop thread started, running loop forever
2026-08-17 09:40:15,765 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 09:40:15,769 INFO core: _init_accounts coroutine started
2026-08-17 09:40:15,770 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 09:40:15,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:45:16,308 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:50:15,656 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 09:55:37,227 INFO core: Event loop thread started, running loop forever
2026-08-17 09:55:37,528 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 09:55:37,532 INFO core: _init_accounts coroutine started
2026-08-17 09:55:37,534 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 09:55:37,540 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:00:44,472 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 10:00:47,691 INFO core: Event loop thread started, running loop forever
2026-08-17 10:00:47,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 10:00:47,996 INFO core: _init_accounts coroutine started
2026-08-17 10:00:47,998 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 10:00:48,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:05:34,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:10:41,393 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 10:10:41,393 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 10:10:41,393 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-17 10:10:41,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 10:10:41,394 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-17 10:10:41,394 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 10:10:41,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-17 10:10:41,394 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 10:10:41,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 10:10:50,768 INFO core: Event loop thread started, running loop forever
2026-08-17 10:10:51,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 10:10:51,076 INFO core: _init_accounts coroutine started
2026-08-17 10:10:51,076 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 10:10:51,083 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:15:05,201 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:20:14,355 INFO core: Event loop thread started, running loop forever
2026-08-17 10:20:14,664 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 10:20:14,668 INFO core: _init_accounts coroutine started
2026-08-17 10:20:14,670 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 10:20:14,683 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 10:20:14,684 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 10:20:14,685 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:25:08,766 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 10:25:08,775 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 10:25:08,779 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:30:13,908 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:35:06,894 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:40:11,337 INFO core: Event loop thread started, running loop forever
2026-08-17 10:40:11,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 10:40:11,643 INFO core: _init_accounts coroutine started
2026-08-17 10:40:11,643 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 10:40:11,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:45:07,737 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-17 10:45:07,753 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:50:34,324 INFO core: Event loop thread started, running loop forever
2026-08-17 10:50:34,625 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 10:50:34,629 INFO core: _init_accounts coroutine started
2026-08-17 10:50:34,630 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 10:50:34,643 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 10:55:41,407 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 10:55:50,528 INFO core: Event loop thread started, running loop forever
2026-08-17 10:55:50,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 10:55:50,843 INFO core: _init_accounts coroutine started
2026-08-17 10:55:50,844 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 10:55:50,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:00:16,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:05:12,186 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:05:12,187 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 11:05:12,187 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 11:10:07,352 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 11:10:07,357 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 11:10:07,369 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 11:10:07,369 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 11:10:07,375 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 11:10:07,376 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 11:10:07,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:15:14,471 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 11:15:14,472 WARNING core: Account 2: connect timed out after 35s
2026-08-17 11:15:14,472 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-17 11:15:14,473 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-17 11:15:14,474 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 11:15:14,475 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-17 11:15:14,475 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-17 11:15:24,760 INFO core: Event loop thread started, running loop forever
2026-08-17 11:15:25,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 11:15:25,069 INFO core: _init_accounts coroutine started
2026-08-17 11:15:25,069 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 11:15:25,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:20:07,155 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 11:20:07,166 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:25:41,295 INFO core: Event loop thread started, running loop forever
2026-08-17 11:25:41,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 11:25:41,600 INFO core: _init_accounts coroutine started
2026-08-17 11:25:41,602 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 11:25:41,612 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:30:21,430 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 11:30:21,431 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 11:30:21,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 11:30:21,434 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 11:30:21,442 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:35:10,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:35:10,846 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 11:40:16,367 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 11:40:16,368 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 11:40:39,143 INFO core: Event loop thread started, running loop forever
2026-08-17 11:40:39,443 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 11:40:39,447 INFO core: _init_accounts coroutine started
2026-08-17 11:40:39,448 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 11:40:39,456 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:45:48,984 INFO core: Event loop thread started, running loop forever
2026-08-17 11:45:49,285 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 11:45:49,290 INFO core: _init_accounts coroutine started
2026-08-17 11:45:49,291 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 11:45:49,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:50:05,237 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 11:50:05,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 11:55:06,343 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:00:22,167 INFO core: Event loop thread started, running loop forever
2026-08-17 12:00:22,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 12:00:22,471 INFO core: _init_accounts coroutine started
2026-08-17 12:00:22,471 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 12:00:22,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:05:29,740 INFO core: Event loop thread started, running loop forever
2026-08-17 12:05:30,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 12:05:30,056 INFO core: _init_accounts coroutine started
2026-08-17 12:05:30,058 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 12:05:30,066 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:10:27,170 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:15:42,714 INFO core: Event loop thread started, running loop forever
2026-08-17 12:15:43,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 12:15:43,022 INFO core: _init_accounts coroutine started
2026-08-17 12:15:43,022 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 12:15:43,032 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:20:20,703 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 12:20:20,704 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 12:20:20,707 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 12:20:20,710 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 12:20:20,713 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:25:27,545 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 12:25:27,545 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 12:25:27,546 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 12:25:38,053 INFO core: Event loop thread started, running loop forever
2026-08-17 12:25:38,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 12:25:38,359 INFO core: _init_accounts coroutine started
2026-08-17 12:25:38,360 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 12:25:38,377 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:30:13,487 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 12:30:20,811 INFO core: Event loop thread started, running loop forever
2026-08-17 12:30:21,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 12:30:21,117 INFO core: _init_accounts coroutine started
2026-08-17 12:30:21,117 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 12:30:21,128 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:35:03,716 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 12:35:03,716 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 12:35:03,719 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 12:35:03,722 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 12:35:03,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:40:36,164 INFO core: Event loop thread started, running loop forever
2026-08-17 12:40:36,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 12:40:36,470 INFO core: _init_accounts coroutine started
2026-08-17 12:40:36,471 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 12:40:36,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:45:43,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 12:45:52,157 INFO core: Event loop thread started, running loop forever
2026-08-17 12:45:52,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 12:45:52,462 INFO core: _init_accounts coroutine started
2026-08-17 12:45:52,463 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 12:45:52,479 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 12:45:52,479 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 12:45:52,480 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 12:45:52,481 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 12:45:52,492 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 12:45:52,492 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 12:45:52,496 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 12:45:52,497 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 12:45:52,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:50:38,754 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 12:50:38,756 WARNING core: Account 2: connect timed out after 35s
2026-08-17 12:50:38,756 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-17 12:50:38,757 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-17 12:50:38,759 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 12:50:38,760 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-17 12:50:38,760 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-17 12:50:38,764 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 12:55:08,177 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 12:55:08,178 WARNING core: Account 2: connect timed out after 35s
2026-08-17 12:55:08,178 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-17 12:55:08,179 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-17 12:55:08,179 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 12:55:08,180 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-17 12:55:08,180 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-17 12:55:08,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:00:11,087 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 13:00:11,087 WARNING core: Account 2: connect timed out after 35s
2026-08-17 13:00:11,088 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-17 13:00:11,088 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-17 13:00:11,088 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 13:00:11,089 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-17 13:00:11,089 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-17 13:00:11,110 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:05:18,425 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 13:05:18,425 WARNING core: Account 2: connect timed out after 35s
2026-08-17 13:05:18,426 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-17 13:05:18,426 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-17 13:05:18,427 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 13:05:18,428 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-17 13:05:18,428 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-17 13:05:52,544 INFO core: Event loop thread started, running loop forever
2026-08-17 13:05:52,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 13:05:52,852 INFO core: _init_accounts coroutine started
2026-08-17 13:05:52,853 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 13:05:52,861 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:10:38,228 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 13:10:38,244 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:15:19,888 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:20:08,527 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-17 13:20:08,530 INFO core: _init_accounts coroutine started
2026-08-17 13:20:08,530 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 13:20:08,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:25:32,685 INFO core: Event loop thread started, running loop forever
2026-08-17 13:25:32,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 13:25:32,993 INFO core: _init_accounts coroutine started
2026-08-17 13:25:32,995 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 13:25:33,005 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:30:36,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 13:30:36,621 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 13:30:36,625 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:35:38,004 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 13:35:38,011 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:40:15,215 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 13:40:15,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:45:12,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:50:03,789 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 13:50:03,790 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 13:50:03,795 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 13:50:03,796 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 13:50:03,798 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:55:09,373 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 13:55:23,461 INFO core: Event loop thread started, running loop forever
2026-08-17 13:55:23,763 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 13:55:23,768 INFO core: _init_accounts coroutine started
2026-08-17 13:55:23,769 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 13:55:23,782 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 13:55:23,782 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 13:55:23,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 13:55:23,784 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 13:55:23,786 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 13:55:23,797 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 13:55:23,798 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 13:55:23,804 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 13:55:23,804 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 14:00:23,689 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 14:00:23,690 WARNING core: Account 2: connect timed out after 35s
2026-08-17 14:00:23,691 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-17 14:00:23,691 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-17 14:00:23,692 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 14:00:23,693 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-17 14:00:23,694 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-17 14:00:23,701 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:05:20,934 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 14:05:20,934 WARNING core: Account 2: connect timed out after 35s
2026-08-17 14:05:20,935 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-17 14:05:20,935 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-17 14:05:20,936 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 14:05:20,940 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-17 14:05:20,940 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-17 14:05:20,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:10:25,241 INFO core: Event loop thread started, running loop forever
2026-08-17 14:10:25,542 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 14:10:25,546 INFO core: _init_accounts coroutine started
2026-08-17 14:10:25,549 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 14:10:25,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:10:26,242 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 14:10:26,243 WARNING core: Account 2: connect timed out after 35s
2026-08-17 14:10:26,244 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-17 14:10:26,244 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-17 14:10:26,246 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 14:15:25,882 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 14:15:25,883 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 14:15:25,885 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:20:31,963 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 14:20:31,965 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-17 14:20:33,372 INFO core: Event loop thread started, running loop forever
2026-08-17 14:20:33,674 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 14:20:33,679 INFO core: _init_accounts coroutine started
2026-08-17 14:20:33,681 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 14:20:33,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:25:32,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:30:38,459 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 14:30:38,460 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 14:30:38,460 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-17 14:30:38,461 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 14:30:38,462 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-17 14:30:38,462 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 14:30:38,462 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-17 14:30:38,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 14:30:38,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 14:30:40,226 INFO core: Event loop thread started, running loop forever
2026-08-17 14:30:40,528 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 14:30:40,533 INFO core: _init_accounts coroutine started
2026-08-17 14:30:40,535 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 14:30:40,546 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:35:22,350 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 14:35:22,350 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 14:35:22,353 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 14:35:22,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:40:41,652 INFO core: Event loop thread started, running loop forever
2026-08-17 14:40:41,953 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 14:40:41,962 INFO core: _init_accounts coroutine started
2026-08-17 14:40:41,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 14:40:41,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:45:07,358 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 14:45:41,440 INFO core: Event loop thread started, running loop forever
2026-08-17 14:45:41,741 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 14:45:41,746 INFO core: _init_accounts coroutine started
2026-08-17 14:45:41,746 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 14:45:41,751 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:50:32,421 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 14:50:32,422 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 14:50:32,423 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 14:50:32,425 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 14:50:32,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 14:55:46,558 INFO core: Event loop thread started, running loop forever
2026-08-17 14:55:46,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 14:55:46,864 INFO core: _init_accounts coroutine started
2026-08-17 14:55:46,864 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 14:55:46,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:00:47,339 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 15:00:47,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:05:10,995 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:10:38,146 INFO core: Event loop thread started, running loop forever
2026-08-17 15:10:38,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 15:10:38,455 INFO core: _init_accounts coroutine started
2026-08-17 15:10:38,456 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 15:10:38,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:15:17,507 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 15:15:17,507 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 15:15:17,509 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 15:15:17,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:20:42,987 INFO core: Event loop thread started, running loop forever
2026-08-17 15:20:43,288 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 15:20:43,293 INFO core: _init_accounts coroutine started
2026-08-17 15:20:43,295 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 15:20:43,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:25:32,802 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 15:25:32,804 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 15:25:32,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:30:33,941 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 15:30:33,946 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 15:30:33,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:35:37,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:40:44,212 INFO core: Event loop thread started, running loop forever
2026-08-17 15:40:44,513 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 15:40:44,519 INFO core: _init_accounts coroutine started
2026-08-17 15:40:44,520 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 15:40:44,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:45:30,519 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 15:45:30,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:45:30,520 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 15:50:05,251 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 15:50:05,263 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 15:50:05,267 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 15:55:07,020 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:00:13,440 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 16:00:13,441 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 16:00:39,085 INFO core: Event loop thread started, running loop forever
2026-08-17 16:00:39,386 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 16:00:39,392 INFO core: _init_accounts coroutine started
2026-08-17 16:00:39,393 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 16:00:39,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:05:04,705 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 16:05:04,706 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 16:05:04,708 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 16:05:04,710 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 16:05:04,712 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:10:24,524 INFO core: Event loop thread started, running loop forever
2026-08-17 16:10:24,825 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 16:10:24,831 INFO core: _init_accounts coroutine started
2026-08-17 16:10:24,831 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 16:10:24,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:15:19,251 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:15:19,252 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 16:15:19,252 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 16:20:26,379 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 16:20:26,380 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-17 16:20:47,344 INFO core: Event loop thread started, running loop forever
2026-08-17 16:20:47,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 16:20:47,650 INFO core: _init_accounts coroutine started
2026-08-17 16:20:47,650 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 16:20:47,665 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:25:51,302 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 16:25:51,303 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 16:25:51,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:30:50,664 INFO core: Event loop thread started, running loop forever
2026-08-17 16:30:50,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 16:30:50,972 INFO core: _init_accounts coroutine started
2026-08-17 16:30:50,973 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 16:30:50,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:35:44,289 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 16:35:44,290 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 16:35:44,293 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 16:35:44,296 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:40:04,522 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 16:40:04,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:45:11,417 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 16:45:35,141 INFO core: Event loop thread started, running loop forever
2026-08-17 16:45:35,442 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 16:45:35,445 INFO core: _init_accounts coroutine started
2026-08-17 16:45:35,446 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 16:45:35,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:50:20,568 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 16:50:20,569 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 16:50:20,570 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 16:50:20,571 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 16:55:07,750 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 16:55:07,770 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:00:13,434 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 17:00:13,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 17:00:48,929 INFO core: Event loop thread started, running loop forever
2026-08-17 17:00:49,232 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 17:00:49,239 INFO core: _init_accounts coroutine started
2026-08-17 17:00:49,241 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 17:00:49,249 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:05:46,876 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:10:18,858 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 17:10:18,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:15:45,059 INFO core: Event loop thread started, running loop forever
2026-08-17 17:15:45,361 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 17:15:45,367 INFO core: _init_accounts coroutine started
2026-08-17 17:15:45,367 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 17:15:45,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:15:45,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 17:15:45,390 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 17:15:45,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 17:15:45,393 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 17:20:03,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:25:10,388 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 17:25:10,389 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 17:25:40,708 INFO core: Event loop thread started, running loop forever
2026-08-17 17:25:41,009 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 17:25:41,015 INFO core: _init_accounts coroutine started
2026-08-17 17:25:41,016 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 17:25:41,027 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:30:32,264 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:35:18,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:40:36,259 INFO core: Event loop thread started, running loop forever
2026-08-17 17:40:36,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 17:40:36,568 INFO core: _init_accounts coroutine started
2026-08-17 17:40:36,569 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 17:40:36,581 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:45:45,582 INFO core: Event loop thread started, running loop forever
2026-08-17 17:45:45,883 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 17:45:45,887 INFO core: _init_accounts coroutine started
2026-08-17 17:45:45,888 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 17:45:45,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:45:45,904 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 17:45:45,906 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 17:50:21,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 17:50:21,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 17:55:14,818 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 17:55:14,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:00:14,219 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:05:21,510 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 18:05:21,511 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 18:05:21,512 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 18:05:26,250 INFO core: Event loop thread started, running loop forever
2026-08-17 18:05:26,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 18:05:26,559 INFO core: _init_accounts coroutine started
2026-08-17 18:05:26,559 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 18:05:26,572 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:10:29,147 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 18:10:29,148 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 18:10:29,150 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:15:11,728 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 18:15:11,730 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 18:15:11,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:15:11,736 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 18:20:24,739 INFO core: Event loop thread started, running loop forever
2026-08-17 18:20:25,040 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 18:20:25,044 INFO core: _init_accounts coroutine started
2026-08-17 18:20:25,045 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 18:20:25,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:25:50,627 INFO core: Event loop thread started, running loop forever
2026-08-17 18:25:50,928 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 18:25:50,932 INFO core: _init_accounts coroutine started
2026-08-17 18:25:50,934 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 18:25:50,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:30:38,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 18:30:38,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 18:30:38,387 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:35:04,807 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 18:35:04,808 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 18:35:04,812 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:40:03,293 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 18:40:03,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:45:21,509 INFO core: Event loop thread started, running loop forever
2026-08-17 18:45:21,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 18:45:21,815 INFO core: _init_accounts coroutine started
2026-08-17 18:45:21,816 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 18:45:21,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:50:33,418 INFO core: Event loop thread started, running loop forever
2026-08-17 18:50:33,719 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 18:50:33,722 INFO core: _init_accounts coroutine started
2026-08-17 18:50:33,724 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 18:50:33,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 18:55:31,801 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 18:55:31,802 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 18:55:31,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:00:05,607 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 19:00:05,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:05:42,507 INFO core: Event loop thread started, running loop forever
2026-08-17 19:05:42,808 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 19:05:42,812 INFO core: _init_accounts coroutine started
2026-08-17 19:05:42,813 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 19:05:42,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:10:22,634 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 19:10:22,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:15:41,964 INFO core: Event loop thread started, running loop forever
2026-08-17 19:15:42,265 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 19:15:42,269 INFO core: _init_accounts coroutine started
2026-08-17 19:15:42,269 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 19:15:42,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:20:25,101 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 19:20:25,101 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 19:20:25,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:25:32,418 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 19:25:37,299 INFO core: Event loop thread started, running loop forever
2026-08-17 19:25:37,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 19:25:37,605 INFO core: _init_accounts coroutine started
2026-08-17 19:25:37,605 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 19:25:37,624 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 19:25:37,625 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 19:25:37,626 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 19:25:37,626 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:30:04,859 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 19:30:04,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:35:39,620 INFO core: Event loop thread started, running loop forever
2026-08-17 19:35:39,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 19:35:39,927 INFO core: _init_accounts coroutine started
2026-08-17 19:35:39,928 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 19:35:39,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:40:46,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 19:40:47,273 INFO core: Event loop thread started, running loop forever
2026-08-17 19:40:47,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 19:40:47,580 INFO core: _init_accounts coroutine started
2026-08-17 19:40:47,581 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 19:40:47,598 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:45:07,454 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:50:14,435 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 19:50:28,885 INFO core: Event loop thread started, running loop forever
2026-08-17 19:50:29,186 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 19:50:29,195 INFO core: _init_accounts coroutine started
2026-08-17 19:50:29,196 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 19:50:29,199 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 19:55:15,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:00:53,977 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 20:00:53,977 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 20:00:53,980 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 20:00:53,982 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 20:00:53,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:05:39,929 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 20:05:39,930 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 20:05:39,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:10:40,981 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 20:10:40,983 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 20:10:40,992 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:15:03,589 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 20:15:03,589 WARNING core: Account 2: connect timed out after 35s
2026-08-17 20:15:03,592 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-17 20:15:03,593 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-17 20:15:03,595 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 20:15:03,596 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-17 20:15:03,596 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-17 20:15:03,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:20:10,451 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 20:20:10,452 WARNING core: Account 2: connect timed out after 35s
2026-08-17 20:20:10,453 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-17 20:20:10,453 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-17 20:20:10,454 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 20:20:10,455 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-17 20:20:10,456 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-17 20:20:30,605 INFO core: Event loop thread started, running loop forever
2026-08-17 20:20:30,906 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 20:20:30,909 INFO core: _init_accounts coroutine started
2026-08-17 20:20:30,910 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 20:20:30,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:25:36,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 20:25:47,631 INFO core: Event loop thread started, running loop forever
2026-08-17 20:25:47,932 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 20:25:47,936 INFO core: _init_accounts coroutine started
2026-08-17 20:25:47,938 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 20:25:47,949 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:30:12,468 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:35:03,952 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 20:35:03,953 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 20:35:03,956 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 20:35:03,959 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 20:35:03,979 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 20:35:03,979 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 20:35:03,986 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 20:35:03,987 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 20:35:04,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:40:10,380 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 20:40:10,382 WARNING core: Account 2: connect timed out after 35s
2026-08-17 20:40:52,956 INFO core: Event loop thread started, running loop forever
2026-08-17 20:40:53,257 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 20:40:53,264 INFO core: _init_accounts coroutine started
2026-08-17 20:40:53,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 20:40:53,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:45:51,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:50:19,047 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 20:50:19,048 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 20:50:19,053 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 20:50:19,054 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:55:26,411 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 20:55:26,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-17 20:55:26,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 20:55:26,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 20:55:39,342 INFO core: Event loop thread started, running loop forever
2026-08-17 20:55:39,643 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 20:55:39,649 INFO core: _init_accounts coroutine started
2026-08-17 20:55:39,650 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 20:55:39,660 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 20:55:39,660 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 20:55:39,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 20:55:39,662 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 21:00:21,996 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 21:00:22,010 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:05:17,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:05:17,196 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 21:05:17,205 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 21:10:24,415 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 21:10:37,982 INFO core: Event loop thread started, running loop forever
2026-08-17 21:10:38,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 21:10:38,286 INFO core: _init_accounts coroutine started
2026-08-17 21:10:38,287 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 21:10:38,299 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:15:18,718 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:20:25,346 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-17 21:20:36,419 INFO core: Event loop thread started, running loop forever
2026-08-17 21:20:36,720 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 21:20:36,724 INFO core: _init_accounts coroutine started
2026-08-17 21:20:36,726 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 21:20:36,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:25:13,931 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-17 21:25:13,952 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:30:07,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:35:05,777 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-17 21:35:05,782 INFO core: _init_accounts coroutine started
2026-08-17 21:35:05,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 21:35:05,792 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:40:48,375 INFO core: Event loop thread started, running loop forever
2026-08-17 21:40:48,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 21:40:48,681 INFO core: _init_accounts coroutine started
2026-08-17 21:40:48,682 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 21:40:48,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:45:36,588 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:50:44,371 INFO core: Event loop thread started, running loop forever
2026-08-17 21:50:44,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 21:50:44,676 INFO core: _init_accounts coroutine started
2026-08-17 21:50:44,677 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 21:50:44,683 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 21:55:13,414 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:00:35,432 INFO core: Event loop thread started, running loop forever
2026-08-17 22:00:35,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 22:00:35,737 INFO core: _init_accounts coroutine started
2026-08-17 22:00:35,738 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 22:00:35,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:05:52,214 INFO core: Event loop thread started, running loop forever
2026-08-17 22:05:52,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 22:05:52,519 INFO core: _init_accounts coroutine started
2026-08-17 22:05:52,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 22:05:52,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:10:45,180 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 22:10:45,181 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 22:10:45,183 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 22:10:45,184 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 22:10:45,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:15:13,370 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:20:20,404 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 22:20:20,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 22:20:20,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 22:20:29,181 INFO core: Event loop thread started, running loop forever
2026-08-17 22:20:29,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 22:20:29,486 INFO core: _init_accounts coroutine started
2026-08-17 22:20:29,488 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 22:20:29,497 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:25:36,379 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-17 22:25:42,055 INFO core: Event loop thread started, running loop forever
2026-08-17 22:25:42,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 22:25:42,362 INFO core: _init_accounts coroutine started
2026-08-17 22:25:42,362 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 22:25:42,376 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:30:29,739 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 22:30:29,740 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 22:30:29,777 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:35:04,019 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 22:35:04,043 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:40:07,180 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:45:33,091 INFO core: Event loop thread started, running loop forever
2026-08-17 22:45:33,392 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 22:45:33,397 INFO core: _init_accounts coroutine started
2026-08-17 22:45:33,398 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 22:45:33,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:50:48,989 INFO core: Event loop thread started, running loop forever
2026-08-17 22:50:49,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 22:50:49,294 INFO core: _init_accounts coroutine started
2026-08-17 22:50:49,295 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 22:50:49,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 22:50:49,308 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 22:50:49,308 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 22:50:49,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 22:50:49,311 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 22:55:39,186 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 22:55:39,187 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 22:55:39,200 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-17 22:55:39,200 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-17 22:55:39,206 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:00:23,233 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 23:00:23,233 WARNING core: Account 2: connect timed out after 35s
2026-08-17 23:00:23,234 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-17 23:00:23,234 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-17 23:00:23,236 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-17 23:00:23,238 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-17 23:00:23,238 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-17 23:00:23,244 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:05:30,369 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-17 23:05:39,536 INFO core: Event loop thread started, running loop forever
2026-08-17 23:05:39,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 23:05:39,842 INFO core: _init_accounts coroutine started
2026-08-17 23:05:39,843 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 23:05:39,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:10:05,284 INFO core: Event loop thread started, running loop forever
2026-08-17 23:10:05,585 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 23:10:05,591 INFO core: _init_accounts coroutine started
2026-08-17 23:10:05,592 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 23:10:05,604 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:10:46,333 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-08-17 23:15:53,409 INFO core: Event loop thread started, running loop forever
2026-08-17 23:15:53,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 23:15:53,715 INFO core: _init_accounts coroutine started
2026-08-17 23:15:53,716 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 23:15:53,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:20:46,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:25:08,763 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 23:25:08,764 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 23:25:08,770 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:30:14,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 23:30:14,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-17 23:30:14,409 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 23:30:14,410 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-17 23:30:14,410 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 23:30:14,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-17 23:30:31,170 INFO core: Event loop thread started, running loop forever
2026-08-17 23:30:31,471 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 23:30:31,477 INFO core: _init_accounts coroutine started
2026-08-17 23:30:31,478 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 23:30:31,488 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:35:36,351 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:35:36,352 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-17 23:35:36,353 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-17 23:35:36,355 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-17 23:40:34,927 INFO core: _init_accounts_inner: reloading LLM config
2026-08-17 23:40:34,937 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:45:23,914 INFO core: Event loop thread started, running loop forever
2026-08-17 23:45:24,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 23:45:24,221 INFO core: _init_accounts coroutine started
2026-08-17 23:45:24,223 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 23:45:24,233 INFO core: status() clients=0 connected=False forwarding=False
2026-08-17 23:45:41,939 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-17 23:45:41,941 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-17 23:50:28,779 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-17 23:50:28,789 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-17 23:55:42,318 INFO core: Event loop thread started, running loop forever
2026-08-17 23:55:42,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-17 23:55:42,622 INFO core: _init_accounts coroutine started
2026-08-17 23:55:42,624 INFO core: _init_accounts_inner: starting DB migrations
2026-08-17 23:55:42,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:00:44,445 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:05:34,989 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 00:05:34,989 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 00:05:35,002 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 00:05:35,004 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 00:05:35,019 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 00:05:35,020 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 00:05:35,024 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 00:05:35,025 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 00:05:35,027 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:10:48,090 INFO core: Event loop thread started, running loop forever
2026-08-18 00:10:48,391 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 00:10:48,397 INFO core: _init_accounts coroutine started
2026-08-18 00:10:48,399 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 00:10:48,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:10:48,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 00:10:48,413 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 00:10:48,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 00:15:48,607 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 00:15:48,623 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:20:36,522 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:25:51,227 INFO core: Event loop thread started, running loop forever
2026-08-18 00:25:51,528 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 00:25:51,535 INFO core: _init_accounts coroutine started
2026-08-18 00:25:51,535 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 00:25:51,542 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:30:17,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:35:45,040 INFO core: Event loop thread started, running loop forever
2026-08-18 00:35:45,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 00:35:45,348 INFO core: _init_accounts coroutine started
2026-08-18 00:35:45,348 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 00:35:45,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:40:35,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:45:05,429 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:50:35,700 INFO core: Event loop thread started, running loop forever
2026-08-18 00:50:36,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 00:50:36,007 INFO core: _init_accounts coroutine started
2026-08-18 00:50:36,008 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 00:50:36,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:55:42,368 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 00:55:48,121 INFO core: Event loop thread started, running loop forever
2026-08-18 00:55:48,422 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 00:55:48,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 00:55:48,435 INFO core: _init_accounts coroutine started
2026-08-18 01:00:38,349 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 01:00:38,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:05:27,939 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 01:05:27,939 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 01:05:27,939 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:10:51,123 INFO core: Event loop thread started, running loop forever
2026-08-18 01:10:51,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 01:10:51,429 INFO core: _init_accounts coroutine started
2026-08-18 01:10:51,429 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 01:10:51,440 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:15:22,213 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 01:15:22,214 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 01:15:22,217 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:20:03,969 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 01:20:03,978 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 01:20:04,018 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 01:20:04,018 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 01:20:04,020 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:25:10,426 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 01:25:10,427 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 01:25:48,738 INFO core: Event loop thread started, running loop forever
2026-08-18 01:25:49,041 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 01:25:49,054 INFO core: _init_accounts coroutine started
2026-08-18 01:25:49,054 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 01:25:49,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:30:17,390 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 01:30:17,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:35:50,005 INFO core: Event loop thread started, running loop forever
2026-08-18 01:35:50,306 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 01:35:50,312 INFO core: _init_accounts coroutine started
2026-08-18 01:35:50,313 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 01:35:50,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:40:13,599 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:45:20,429 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 01:45:36,369 INFO core: Event loop thread started, running loop forever
2026-08-18 01:45:36,670 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 01:45:36,674 INFO core: _init_accounts coroutine started
2026-08-18 01:45:36,674 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 01:45:36,684 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:50:38,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 01:50:38,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 01:50:38,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 01:50:38,446 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:55:28,207 INFO core: Event loop thread started, running loop forever
2026-08-18 01:55:28,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 01:55:28,512 INFO core: _init_accounts coroutine started
2026-08-18 01:55:28,513 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 01:55:28,523 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 01:55:45,221 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 01:55:45,251 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 02:00:34,600 INFO core: Event loop thread started, running loop forever
2026-08-18 02:00:34,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 02:00:34,918 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:00:34,919 INFO core: _init_accounts coroutine started
2026-08-18 02:00:34,919 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 02:05:06,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:10:04,501 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 02:10:04,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:10:04,503 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 02:15:10,376 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-18 02:15:24,520 INFO core: Event loop thread started, running loop forever
2026-08-18 02:15:24,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 02:15:24,825 INFO core: _init_accounts coroutine started
2026-08-18 02:15:24,825 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 02:15:24,844 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:20:46,289 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 02:20:46,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:25:19,484 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:30:19,669 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-18 02:30:19,670 INFO core: _init_accounts coroutine started
2026-08-18 02:30:19,670 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 02:30:19,681 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 02:30:19,681 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 02:30:19,686 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 02:30:19,687 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 02:30:19,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:35:46,636 INFO core: Event loop thread started, running loop forever
2026-08-18 02:35:46,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 02:35:46,942 INFO core: _init_accounts coroutine started
2026-08-18 02:35:46,943 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 02:35:46,953 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:40:43,578 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 02:40:43,579 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 02:40:43,582 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 02:40:43,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:45:26,340 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:50:05,829 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 02:50:05,838 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 02:55:11,511 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 02:55:26,125 INFO core: Event loop thread started, running loop forever
2026-08-18 02:55:26,426 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 02:55:26,431 INFO core: _init_accounts coroutine started
2026-08-18 02:55:26,432 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 02:55:26,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:00:07,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:05:14,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 03:05:14,413 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 03:05:23,768 INFO core: Event loop thread started, running loop forever
2026-08-18 03:05:24,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 03:05:24,074 INFO core: _init_accounts coroutine started
2026-08-18 03:05:24,076 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 03:05:24,079 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:10:05,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:20:30,806 INFO core: Event loop thread started, running loop forever
2026-08-18 03:20:31,107 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 03:20:31,111 INFO core: _init_accounts coroutine started
2026-08-18 03:20:31,112 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 03:20:31,118 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:25:04,350 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:30:11,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 03:30:48,522 INFO core: Event loop thread started, running loop forever
2026-08-18 03:30:48,824 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 03:30:48,831 INFO core: _init_accounts coroutine started
2026-08-18 03:30:48,833 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 03:30:48,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:35:27,168 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 03:35:27,169 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 03:35:27,170 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:40:12,150 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 03:40:12,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:40:12,158 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 03:45:13,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:50:07,570 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:55:14,429 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 03:55:14,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 03:55:14,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 03:55:21,957 INFO core: Event loop thread started, running loop forever
2026-08-18 03:55:22,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 03:55:22,263 INFO core: _init_accounts coroutine started
2026-08-18 03:55:22,263 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 03:55:22,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 03:55:22,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 03:55:22,279 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 03:55:22,283 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 03:55:22,285 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 04:00:36,786 INFO core: Event loop thread started, running loop forever
2026-08-18 04:00:37,088 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:00:37,094 INFO core: _init_accounts coroutine started
2026-08-18 04:00:37,095 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:00:37,105 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:05:14,206 INFO core: Event loop thread started, running loop forever
2026-08-18 04:05:14,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:05:14,511 INFO core: _init_accounts coroutine started
2026-08-18 04:05:14,511 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:05:14,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:10:48,619 INFO core: Event loop thread started, running loop forever
2026-08-18 04:10:48,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:10:48,927 INFO core: _init_accounts coroutine started
2026-08-18 04:10:48,928 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:10:48,938 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:15:41,722 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:15:41,722 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 04:15:41,724 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 04:20:48,795 INFO core: Event loop thread started, running loop forever
2026-08-18 04:20:49,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:20:49,114 INFO core: _init_accounts coroutine started
2026-08-18 04:20:49,114 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:20:49,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:25:14,486 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 04:25:14,486 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 04:25:14,488 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 04:25:14,490 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 04:25:14,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:30:21,388 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 04:30:21,390 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 04:30:47,658 INFO core: Event loop thread started, running loop forever
2026-08-18 04:30:47,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:30:47,963 INFO core: _init_accounts coroutine started
2026-08-18 04:30:47,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:30:47,972 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:35:24,573 INFO core: Event loop thread started, running loop forever
2026-08-18 04:35:24,875 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:35:24,880 INFO core: _init_accounts coroutine started
2026-08-18 04:35:24,880 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:35:24,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:40:05,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:45:13,198 INFO core: Event loop thread started, running loop forever
2026-08-18 04:45:13,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:45:13,505 INFO core: _init_accounts coroutine started
2026-08-18 04:45:13,505 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:45:13,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:50:20,286 INFO core: Event loop thread started, running loop forever
2026-08-18 04:50:20,285 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 04:50:20,587 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:50:20,593 INFO core: _init_accounts coroutine started
2026-08-18 04:50:20,594 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:50:20,601 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 04:55:27,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 04:55:45,148 INFO core: Event loop thread started, running loop forever
2026-08-18 04:55:45,450 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 04:55:45,454 INFO core: _init_accounts coroutine started
2026-08-18 04:55:45,455 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 04:55:45,464 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:00:20,325 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:05:27,440 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 05:05:38,272 INFO core: Event loop thread started, running loop forever
2026-08-18 05:05:38,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 05:05:38,580 INFO core: _init_accounts coroutine started
2026-08-18 05:05:38,580 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 05:05:38,589 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:10:45,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 05:10:52,472 INFO core: Event loop thread started, running loop forever
2026-08-18 05:10:52,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 05:10:52,777 INFO core: _init_accounts coroutine started
2026-08-18 05:10:52,779 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 05:10:52,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:15:48,715 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 05:15:48,715 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 05:15:48,717 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 05:15:48,721 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 05:15:48,733 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:20:21,770 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 05:20:21,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:20:21,772 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 05:25:35,631 INFO core: Event loop thread started, running loop forever
2026-08-18 05:25:35,932 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 05:25:35,937 INFO core: _init_accounts coroutine started
2026-08-18 05:25:35,938 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 05:25:35,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:25:35,959 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 05:25:35,959 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 05:25:35,964 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 05:30:20,049 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:35:46,050 INFO core: Event loop thread started, running loop forever
2026-08-18 05:35:46,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 05:35:46,356 INFO core: _init_accounts coroutine started
2026-08-18 05:35:46,359 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 05:35:46,370 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:40:33,035 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 05:40:33,037 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 05:40:33,039 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 05:40:33,040 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 05:40:33,036 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:45:17,738 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:50:22,358 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 05:50:22,360 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 05:50:22,365 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 05:50:22,367 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 05:50:22,373 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 05:55:29,375 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-18 05:55:29,375 WARNING core: Account 2: connect timed out after 35s
2026-08-18 05:55:29,376 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-18 05:55:29,377 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-18 05:55:29,384 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-18 05:55:29,385 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-18 05:55:29,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-18 05:55:35,434 INFO core: Event loop thread started, running loop forever
2026-08-18 05:55:35,735 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 05:55:35,742 INFO core: _init_accounts coroutine started
2026-08-18 05:55:35,742 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 05:55:35,752 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:00:42,362 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 06:00:49,854 INFO core: Event loop thread started, running loop forever
2026-08-18 06:00:50,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 06:00:50,159 INFO core: _init_accounts coroutine started
2026-08-18 06:00:50,160 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 06:00:50,173 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:05:33,834 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:05:33,835 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 06:05:33,836 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 06:10:14,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 06:10:14,314 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 06:10:14,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:15:22,054 INFO core: Event loop thread started, running loop forever
2026-08-18 06:15:22,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 06:15:22,360 INFO core: _init_accounts coroutine started
2026-08-18 06:15:22,361 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 06:15:22,373 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 06:15:22,373 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 06:15:22,374 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 06:15:22,376 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 06:15:22,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:20:23,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:25:24,597 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:30:30,448 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 06:30:30,457 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 06:30:40,990 INFO core: Event loop thread started, running loop forever
2026-08-18 06:30:41,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 06:30:41,296 INFO core: _init_accounts coroutine started
2026-08-18 06:30:41,297 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 06:30:41,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:35:27,034 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 06:35:27,035 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 06:35:27,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:40:34,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 06:40:37,673 INFO core: Event loop thread started, running loop forever
2026-08-18 06:40:37,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 06:40:37,981 INFO core: _init_accounts coroutine started
2026-08-18 06:40:37,982 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 06:40:37,993 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:45:10,355 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 06:45:19,063 INFO core: Event loop thread started, running loop forever
2026-08-18 06:45:19,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 06:45:19,367 INFO core: _init_accounts coroutine started
2026-08-18 06:45:19,368 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 06:45:19,373 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:50:47,855 INFO core: Event loop thread started, running loop forever
2026-08-18 06:50:48,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 06:50:48,161 INFO core: _init_accounts coroutine started
2026-08-18 06:50:48,162 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 06:50:48,171 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 06:55:04,584 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 06:55:04,603 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:00:41,302 INFO core: Event loop thread started, running loop forever
2026-08-18 07:00:41,603 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 07:00:41,609 INFO core: _init_accounts coroutine started
2026-08-18 07:00:41,610 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 07:00:41,620 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:05:48,392 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 07:05:49,701 INFO core: Event loop thread started, running loop forever
2026-08-18 07:05:50,002 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 07:05:50,009 INFO core: _init_accounts coroutine started
2026-08-18 07:05:50,010 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 07:05:50,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:10:23,628 INFO core: Event loop thread started, running loop forever
2026-08-18 07:10:23,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 07:10:23,933 INFO core: _init_accounts coroutine started
2026-08-18 07:10:23,934 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 07:10:23,942 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:15:05,849 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 07:15:05,850 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 07:15:05,851 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 07:15:05,853 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 07:15:05,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:20:11,419 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 07:20:28,339 INFO core: Event loop thread started, running loop forever
2026-08-18 07:20:28,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 07:20:28,650 INFO core: _init_accounts coroutine started
2026-08-18 07:20:28,650 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 07:20:28,660 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:23:20,112 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 07:23:20,112 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 07:23:20,115 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 07:23:20,118 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 07:23:20,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:25:49,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:30:40,315 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 07:30:40,316 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 07:30:40,319 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:35:11,921 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 07:35:11,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:40:39,928 INFO core: Event loop thread started, running loop forever
2026-08-18 07:40:40,229 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 07:40:40,240 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:45:35,039 INFO core: _init_accounts coroutine started
2026-08-18 07:45:35,042 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 07:45:35,055 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:50:38,003 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 07:50:38,017 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 07:55:15,348 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:00:54,175 INFO core: Event loop thread started, running loop forever
2026-08-18 08:00:54,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 08:00:54,482 INFO core: _init_accounts coroutine started
2026-08-18 08:00:54,483 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 08:00:54,498 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:05:36,831 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 08:05:36,832 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 08:05:36,834 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 08:05:36,835 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 08:05:36,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:10:30,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:15:42,109 INFO core: Event loop thread started, running loop forever
2026-08-18 08:15:42,410 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 08:15:42,416 INFO core: _init_accounts coroutine started
2026-08-18 08:15:42,417 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 08:15:42,427 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:20:49,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 08:20:52,683 INFO core: Event loop thread started, running loop forever
2026-08-18 08:20:52,984 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 08:20:52,990 INFO core: _init_accounts coroutine started
2026-08-18 08:20:52,991 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 08:20:53,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:25:38,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:30:54,038 INFO core: Event loop thread started, running loop forever
2026-08-18 08:30:54,340 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 08:30:54,349 INFO core: _init_accounts coroutine started
2026-08-18 08:30:54,350 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 08:30:54,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:35:29,857 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 08:35:29,857 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 08:35:29,859 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 08:35:29,865 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 08:35:29,865 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:40:28,632 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:45:28,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:50:19,172 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 08:50:19,174 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 08:50:19,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 08:55:09,456 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 08:55:09,458 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 08:55:09,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:00:11,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-18 09:00:11,399 WARNING core: Account 2: connect timed out after 35s
2026-08-18 09:00:53,532 INFO core: Event loop thread started, running loop forever
2026-08-18 09:00:53,833 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 09:00:53,837 INFO core: _init_accounts coroutine started
2026-08-18 09:00:53,839 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 09:00:53,842 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:05:08,994 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:10:13,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:15:20,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 09:15:20,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 09:15:20,435 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-18 09:15:20,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 09:15:20,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-18 09:15:20,436 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 09:15:20,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 09:15:20,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 09:15:20,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 09:15:25,130 INFO core: Event loop thread started, running loop forever
2026-08-18 09:15:25,431 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 09:15:25,437 INFO core: _init_accounts coroutine started
2026-08-18 09:15:25,437 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 09:15:25,447 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:20:05,749 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 09:20:05,749 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 09:20:05,751 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 09:20:05,753 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 09:20:05,769 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:25:11,454 INFO core: Event loop thread started, running loop forever
2026-08-18 09:25:11,755 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 09:25:11,760 INFO core: _init_accounts coroutine started
2026-08-18 09:25:11,761 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 09:25:11,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:30:12,779 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 683, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2060, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-18 09:30:12,800 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:35:13,296 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:40:50,388 INFO core: Event loop thread started, running loop forever
2026-08-18 09:40:50,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 09:40:50,696 INFO core: _init_accounts coroutine started
2026-08-18 09:40:50,696 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 09:40:50,705 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:45:49,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:50:39,166 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 09:50:39,170 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 09:50:39,172 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 09:50:39,173 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 09:50:39,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 09:55:25,858 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:00:23,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:05:35,858 INFO core: Event loop thread started, running loop forever
2026-08-18 10:05:36,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 10:05:36,162 INFO core: _init_accounts coroutine started
2026-08-18 10:05:36,162 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 10:05:36,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:10:10,634 INFO core: Event loop thread started, running loop forever
2026-08-18 10:10:10,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 10:10:10,949 INFO core: _init_accounts coroutine started
2026-08-18 10:10:10,949 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 10:10:10,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:15:43,815 INFO core: Event loop thread started, running loop forever
2026-08-18 10:15:44,116 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 10:15:44,121 INFO core: _init_accounts coroutine started
2026-08-18 10:15:44,121 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 10:15:44,134 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:20:24,794 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 10:20:24,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 10:20:24,799 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 10:20:24,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:25:28,162 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 10:25:28,168 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:30:17,533 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:35:12,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:40:18,453 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 10:40:18,454 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 10:40:18,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 10:40:24,414 INFO core: Event loop thread started, running loop forever
2026-08-18 10:40:24,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 10:40:24,720 INFO core: _init_accounts coroutine started
2026-08-18 10:40:24,722 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 10:40:24,739 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 10:40:24,739 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 10:40:24,741 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:40:24,743 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 10:45:25,789 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 10:45:25,792 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:50:19,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 10:55:27,945 INFO core: Event loop thread started, running loop forever
2026-08-18 10:55:28,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 10:55:28,251 INFO core: _init_accounts coroutine started
2026-08-18 10:55:28,252 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 10:55:28,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:00:15,921 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 11:00:15,922 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 11:00:15,924 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 11:00:15,926 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 11:00:15,942 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 11:00:15,942 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 11:00:15,954 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:05:22,444 INFO core: Event loop thread started, running loop forever
2026-08-18 11:05:22,746 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 11:05:22,754 INFO core: _init_accounts coroutine started
2026-08-18 11:05:22,755 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 11:05:22,768 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:10:43,713 INFO core: Event loop thread started, running loop forever
2026-08-18 11:10:44,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 11:10:44,024 INFO core: _init_accounts coroutine started
2026-08-18 11:10:44,025 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 11:10:44,030 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:15:33,677 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 11:15:33,677 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 11:15:33,681 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 11:15:33,685 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 11:15:33,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:20:34,696 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 11:20:34,697 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 11:20:34,705 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 11:20:34,706 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 11:20:34,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:25:33,965 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-18 11:25:33,965 WARNING core: Account 2: connect timed out after 35s
2026-08-18 11:25:33,966 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-18 11:25:33,967 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-18 11:25:33,970 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:30:31,803 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-18 11:30:31,806 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-18 11:30:31,807 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-18 11:30:31,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:35:47,292 INFO core: Event loop thread started, running loop forever
2026-08-18 11:35:47,593 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 11:35:47,600 INFO core: _init_accounts coroutine started
2026-08-18 11:35:47,601 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 11:35:47,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:40:05,219 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 11:40:05,220 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 11:40:05,222 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 11:40:05,224 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 11:40:05,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:45:26,423 INFO core: Event loop thread started, running loop forever
2026-08-18 11:45:26,724 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 11:45:26,727 INFO core: _init_accounts coroutine started
2026-08-18 11:45:26,728 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 11:45:26,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:50:38,801 INFO core: Event loop thread started, running loop forever
2026-08-18 11:50:39,103 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 11:50:39,154 INFO core: _init_accounts coroutine started
2026-08-18 11:50:39,154 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 11:50:39,171 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:55:20,100 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 11:55:20,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 11:55:20,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 12:00:38,582 INFO core: Event loop thread started, running loop forever
2026-08-18 12:00:38,883 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 12:00:38,887 INFO core: _init_accounts coroutine started
2026-08-18 12:00:38,887 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 12:00:38,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:05:04,839 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 12:05:04,852 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:10:12,311 INFO core: Event loop thread started, running loop forever
2026-08-18 12:10:12,613 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 12:10:12,617 INFO core: _init_accounts coroutine started
2026-08-18 12:10:12,619 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 12:10:12,629 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:15:11,477 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 12:15:49,270 INFO core: Event loop thread started, running loop forever
2026-08-18 12:15:49,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 12:15:49,576 INFO core: _init_accounts coroutine started
2026-08-18 12:15:49,577 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 12:15:49,583 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:20:16,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:25:50,232 INFO core: Event loop thread started, running loop forever
2026-08-18 12:25:50,533 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 12:25:50,540 INFO core: _init_accounts coroutine started
2026-08-18 12:25:50,542 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 12:25:50,549 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:30:43,315 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 12:30:43,316 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 12:30:43,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:35:44,640 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:40:40,703 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 12:40:40,745 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:45:10,309 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 12:45:10,326 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:50:09,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 12:55:25,690 INFO core: Event loop thread started, running loop forever
2026-08-18 12:55:25,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 12:55:25,997 INFO core: _init_accounts coroutine started
2026-08-18 12:55:25,997 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 12:55:26,005 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:00:23,621 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:00:23,622 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 13:05:25,596 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 13:05:25,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:10:23,766 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:15:29,422 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 13:15:47,852 INFO core: Event loop thread started, running loop forever
2026-08-18 13:15:48,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 13:15:48,159 INFO core: _init_accounts coroutine started
2026-08-18 13:15:48,159 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 13:15:48,168 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:20:31,153 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:25:06,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:30:13,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 13:30:13,399 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 13:30:13,399 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-18 13:30:13,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 13:30:13,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-18 13:30:13,401 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 13:30:13,401 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 13:30:13,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 13:30:13,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 13:30:36,543 INFO core: Event loop thread started, running loop forever
2026-08-18 13:30:36,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 13:30:36,850 INFO core: _init_accounts coroutine started
2026-08-18 13:30:36,851 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 13:30:36,860 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:35:29,913 INFO core: Event loop thread started, running loop forever
2026-08-18 13:35:30,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 13:35:30,224 INFO core: _init_accounts coroutine started
2026-08-18 13:35:30,224 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 13:35:30,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:35:43,922 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 13:40:21,398 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:45:11,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 13:45:11,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 13:45:11,443 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:50:12,781 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 13:50:12,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 13:55:18,454 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 13:55:18,456 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 13:55:18,457 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 13:55:18,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 13:55:30,779 INFO core: Event loop thread started, running loop forever
2026-08-18 13:55:31,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 13:55:31,087 INFO core: _init_accounts coroutine started
2026-08-18 13:55:31,088 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 13:55:31,094 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:00:37,422 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 14:00:50,305 INFO core: Event loop thread started, running loop forever
2026-08-18 14:00:50,606 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 14:00:50,616 INFO core: _init_accounts coroutine started
2026-08-18 14:00:50,617 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 14:00:50,625 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:05:09,599 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:10:22,035 INFO core: Event loop thread started, running loop forever
2026-08-18 14:10:22,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 14:10:22,343 INFO core: _init_accounts coroutine started
2026-08-18 14:10:22,343 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 14:10:22,353 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:15:29,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 14:15:50,228 INFO core: Event loop thread started, running loop forever
2026-08-18 14:15:50,529 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 14:15:50,534 INFO core: _init_accounts coroutine started
2026-08-18 14:15:50,536 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 14:15:50,548 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:20:53,060 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 14:20:53,061 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 14:20:53,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:25:42,930 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 14:25:42,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:30:11,370 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 14:30:11,371 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 14:30:11,372 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 14:30:11,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 14:30:46,018 INFO core: Event loop thread started, running loop forever
2026-08-18 14:30:46,319 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 14:30:46,324 INFO core: _init_accounts coroutine started
2026-08-18 14:30:46,324 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 14:30:46,328 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:35:35,443 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:40:22,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:45:13,517 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:45:13,518 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 14:45:13,519 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 14:50:35,065 INFO core: Event loop thread started, running loop forever
2026-08-18 14:50:35,366 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 14:50:35,375 INFO core: _init_accounts coroutine started
2026-08-18 14:50:35,375 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 14:50:35,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 14:55:42,370 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 14:55:49,576 INFO core: Event loop thread started, running loop forever
2026-08-18 14:55:49,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 14:55:49,882 INFO core: _init_accounts coroutine started
2026-08-18 14:55:49,883 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 14:55:49,890 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:00:45,893 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:05:10,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:10:17,336 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 15:10:47,961 INFO core: Event loop thread started, running loop forever
2026-08-18 15:10:48,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 15:10:48,268 INFO core: _init_accounts coroutine started
2026-08-18 15:10:48,269 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 15:10:48,284 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:15:25,744 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 15:15:25,745 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 15:15:25,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:20:08,352 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 15:20:08,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:20:08,362 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 15:25:09,513 INFO core: Event loop thread started, running loop forever
2026-08-18 15:25:09,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 15:25:09,819 INFO core: _init_accounts coroutine started
2026-08-18 15:25:09,820 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 15:25:09,831 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:30:14,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:30:14,524 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 15:30:14,524 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 15:35:53,371 INFO core: Event loop thread started, running loop forever
2026-08-18 15:35:53,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 15:35:53,675 INFO core: _init_accounts coroutine started
2026-08-18 15:35:53,676 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 15:35:53,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:40:50,813 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 15:40:50,813 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 15:40:50,815 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 15:40:50,817 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 15:40:50,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:45:14,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:50:14,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 15:55:20,403 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 15:55:20,403 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 15:55:20,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 15:55:50,141 INFO core: Event loop thread started, running loop forever
2026-08-18 15:55:50,443 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 15:55:50,449 INFO core: _init_accounts coroutine started
2026-08-18 15:55:50,449 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 15:55:50,455 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:00:27,562 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:05:09,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:10:16,611 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 16:10:21,936 INFO core: Event loop thread started, running loop forever
2026-08-18 16:10:22,238 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 16:10:22,250 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:15:22,080 INFO core: _init_accounts coroutine started
2026-08-18 16:15:22,081 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 16:15:22,098 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:20:29,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 16:20:29,417 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 16:20:29,417 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-18 16:20:29,418 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 16:20:29,418 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-18 16:20:29,418 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 16:20:29,418 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 16:20:29,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 16:20:29,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 16:20:38,843 INFO core: Event loop thread started, running loop forever
2026-08-18 16:20:39,144 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 16:20:39,151 INFO core: _init_accounts coroutine started
2026-08-18 16:20:39,151 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 16:20:39,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:25:20,397 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 16:25:20,397 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 16:25:20,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 16:25:20,402 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 16:25:20,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:30:52,498 INFO core: Event loop thread started, running loop forever
2026-08-18 16:30:52,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 16:30:52,805 INFO core: _init_accounts coroutine started
2026-08-18 16:30:52,807 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 16:30:52,819 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:35:48,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:40:23,085 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 16:40:23,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 16:40:23,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:45:31,864 INFO core: Event loop thread started, running loop forever
2026-08-18 16:45:32,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 16:45:32,171 INFO core: _init_accounts coroutine started
2026-08-18 16:45:32,171 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 16:45:32,184 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 16:45:32,184 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 16:45:32,189 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 16:45:32,191 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 16:45:32,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:50:48,059 INFO core: Event loop thread started, running loop forever
2026-08-18 16:50:48,360 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 16:50:48,365 INFO core: _init_accounts coroutine started
2026-08-18 16:50:48,365 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 16:50:48,375 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 16:55:02,982 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:00:42,238 INFO core: Event loop thread started, running loop forever
2026-08-18 17:00:42,539 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 17:00:42,550 INFO core: _init_accounts coroutine started
2026-08-18 17:00:42,550 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 17:00:42,562 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:05:35,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 17:05:35,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 17:05:35,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:10:42,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 17:10:42,434 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-18 17:10:42,435 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 17:10:42,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 17:10:51,031 INFO core: Event loop thread started, running loop forever
2026-08-18 17:10:51,332 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 17:10:51,338 INFO core: _init_accounts coroutine started
2026-08-18 17:10:51,339 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 17:10:51,349 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:15:45,828 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 17:15:45,828 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 17:15:45,833 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 17:15:45,834 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 17:15:45,844 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:20:29,145 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:20:29,145 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 17:20:29,146 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 17:25:36,400 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 17:25:45,886 INFO core: Event loop thread started, running loop forever
2026-08-18 17:25:46,187 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 17:25:46,192 INFO core: _init_accounts coroutine started
2026-08-18 17:25:46,194 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 17:25:46,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:30:41,187 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 17:30:41,188 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 17:30:41,189 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 17:30:41,189 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:35:17,073 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 17:35:17,091 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:35:17,092 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 17:35:17,099 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 17:35:17,104 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 17:35:17,105 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 17:40:24,362 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-18 17:40:32,615 INFO core: Event loop thread started, running loop forever
2026-08-18 17:40:32,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 17:40:32,923 INFO core: _init_accounts coroutine started
2026-08-18 17:40:32,925 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 17:40:32,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:45:47,035 INFO core: Event loop thread started, running loop forever
2026-08-18 17:45:47,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 17:45:47,342 INFO core: _init_accounts coroutine started
2026-08-18 17:45:47,343 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 17:45:47,354 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:50:37,585 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 17:50:37,586 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 17:50:37,589 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 17:50:37,592 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 17:50:37,595 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 17:55:50,407 INFO core: Event loop thread started, running loop forever
2026-08-18 17:55:50,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 17:55:50,713 INFO core: _init_accounts coroutine started
2026-08-18 17:55:50,715 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 17:55:50,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:00:47,329 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 18:00:47,330 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 18:00:47,333 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 18:00:47,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:00:47,336 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 18:05:36,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:10:28,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:15:35,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 18:15:41,671 INFO core: Event loop thread started, running loop forever
2026-08-18 18:15:41,972 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 18:15:41,978 INFO core: _init_accounts coroutine started
2026-08-18 18:15:41,979 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 18:15:41,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:20:19,911 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 18:20:19,913 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 18:20:19,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:20:19,916 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 18:25:18,765 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 18:25:18,778 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:30:43,125 INFO core: Event loop thread started, running loop forever
2026-08-18 18:30:43,427 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 18:30:43,431 INFO core: _init_accounts coroutine started
2026-08-18 18:30:43,432 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 18:30:43,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:35:34,857 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:40:40,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 18:40:40,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 18:40:40,399 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 18:40:50,710 INFO core: Event loop thread started, running loop forever
2026-08-18 18:40:51,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 18:40:51,018 INFO core: _init_accounts coroutine started
2026-08-18 18:40:51,019 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 18:40:51,030 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:45:10,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:45:10,245 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 18:45:10,245 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 18:50:16,192 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 18:50:16,196 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 18:50:16,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 18:50:16,214 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 18:50:16,215 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 18:55:33,626 INFO core: Event loop thread started, running loop forever
2026-08-18 18:55:33,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 18:55:33,935 INFO core: _init_accounts coroutine started
2026-08-18 18:55:33,936 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 18:55:33,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:00:55,674 INFO core: Event loop thread started, running loop forever
2026-08-18 19:00:55,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 19:00:55,979 INFO core: _init_accounts coroutine started
2026-08-18 19:00:55,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:00:55,985 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 19:00:56,001 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 19:00:56,001 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 19:00:56,003 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 19:00:56,004 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 19:05:08,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:10:17,079 INFO core: Event loop thread started, running loop forever
2026-08-18 19:10:17,380 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 19:10:17,384 INFO core: _init_accounts coroutine started
2026-08-18 19:10:17,384 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 19:10:17,398 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:15:18,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:20:25,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 19:20:51,715 INFO core: Event loop thread started, running loop forever
2026-08-18 19:20:52,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 19:20:52,020 INFO core: _init_accounts coroutine started
2026-08-18 19:20:52,021 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 19:20:52,037 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 19:20:52,037 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 19:20:52,039 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 19:20:52,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:20:52,043 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 19:25:19,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:30:03,974 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:35:10,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 19:35:10,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 19:35:10,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 19:35:46,073 INFO core: Event loop thread started, running loop forever
2026-08-18 19:35:46,374 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 19:35:46,380 INFO core: _init_accounts coroutine started
2026-08-18 19:35:46,382 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 19:35:46,390 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:40:40,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:45:42,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:50:33,967 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 19:50:33,967 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 19:50:33,971 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 19:50:33,974 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 19:50:33,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 19:55:24,994 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:00:21,138 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 20:00:21,139 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 20:00:21,149 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 20:00:21,150 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 20:00:21,153 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:05:27,419 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-18 20:05:27,419 WARNING core: Account 2: connect timed out after 35s
2026-08-18 20:05:27,420 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-18 20:05:27,420 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-18 20:05:27,421 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-18 20:05:27,422 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-18 20:05:27,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-18 20:05:32,532 INFO core: Event loop thread started, running loop forever
2026-08-18 20:05:32,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 20:05:32,838 INFO core: _init_accounts coroutine started
2026-08-18 20:05:32,840 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 20:05:32,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:10:24,487 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 20:10:24,489 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:10:24,489 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 20:15:28,670 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 20:15:28,674 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 20:15:28,677 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:20:36,863 INFO core: Event loop thread started, running loop forever
2026-08-18 20:20:37,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 20:20:37,175 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:20:37,176 INFO core: _init_accounts coroutine started
2026-08-18 20:20:37,177 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 20:25:46,007 INFO core: Event loop thread started, running loop forever
2026-08-18 20:25:46,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 20:25:46,313 INFO core: _init_accounts coroutine started
2026-08-18 20:25:46,314 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 20:25:46,328 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 20:25:46,329 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 20:25:46,330 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 20:25:46,332 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 20:25:46,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:25:46,350 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 20:25:46,350 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 20:30:47,337 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:35:11,883 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 20:35:11,886 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 20:35:11,898 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:40:17,937 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-18 20:40:17,938 WARNING core: Account 2: connect timed out after 35s
2026-08-18 20:40:17,939 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-18 20:40:17,939 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-18 20:40:17,940 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-18 20:40:17,942 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-18 20:40:17,942 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-18 20:40:36,883 INFO core: Event loop thread started, running loop forever
2026-08-18 20:40:37,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 20:40:37,188 INFO core: _init_accounts coroutine started
2026-08-18 20:40:37,189 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 20:40:37,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:45:44,142 INFO core: Event loop thread started, running loop forever
2026-08-18 20:45:44,443 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 20:45:44,448 INFO core: _init_accounts coroutine started
2026-08-18 20:45:44,449 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 20:45:44,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:50:42,915 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 20:50:42,915 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 20:50:42,923 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 20:50:42,926 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 20:50:42,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 20:55:21,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:00:18,012 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:05:16,636 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 21:05:16,637 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 21:05:16,642 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-18 21:05:16,643 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-18 21:05:16,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:10:22,384 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-18 21:10:22,385 WARNING core: Account 2: connect timed out after 35s
2026-08-18 21:10:22,389 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-18 21:10:22,389 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-18 21:10:51,890 INFO core: Event loop thread started, running loop forever
2026-08-18 21:10:52,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 21:10:52,198 INFO core: _init_accounts coroutine started
2026-08-18 21:10:52,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 21:10:52,209 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:15:04,297 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 21:15:32,437 INFO core: Event loop thread started, running loop forever
2026-08-18 21:15:32,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 21:15:32,743 INFO core: _init_accounts coroutine started
2026-08-18 21:15:32,744 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 21:15:32,750 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:20:27,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:20:27,807 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 21:25:04,349 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:30:06,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:35:45,130 INFO core: Event loop thread started, running loop forever
2026-08-18 21:35:45,431 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 21:35:45,437 INFO core: _init_accounts coroutine started
2026-08-18 21:35:45,438 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 21:35:45,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:40:07,846 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 21:40:07,847 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 21:40:07,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:45:19,224 INFO core: Event loop thread started, running loop forever
2026-08-18 21:45:19,526 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 21:45:19,532 INFO core: _init_accounts coroutine started
2026-08-18 21:45:19,533 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 21:45:19,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:50:22,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 21:55:28,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 21:55:28,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 21:55:28,402 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-18 21:55:28,402 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 21:55:28,403 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-18 21:55:28,403 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 21:55:28,403 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 21:55:28,403 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 21:55:28,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 21:55:28,629 INFO core: Event loop thread started, running loop forever
2026-08-18 21:55:28,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 21:55:28,935 INFO core: _init_accounts coroutine started
2026-08-18 21:55:28,936 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 21:55:28,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:00:14,366 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:05:07,338 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 22:05:07,339 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 22:05:07,347 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 22:05:07,350 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:10:05,529 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 22:10:05,539 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:15:11,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 22:15:50,618 INFO core: Event loop thread started, running loop forever
2026-08-18 22:15:50,919 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 22:15:50,928 INFO core: _init_accounts coroutine started
2026-08-18 22:15:50,928 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 22:15:50,939 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:20:26,853 INFO core: Event loop thread started, running loop forever
2026-08-18 22:20:27,154 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 22:20:27,159 INFO core: _init_accounts coroutine started
2026-08-18 22:20:27,160 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 22:20:27,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:25:05,086 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 22:25:05,087 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 22:25:05,090 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 22:25:05,092 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 22:25:05,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:30:26,552 INFO core: Event loop thread started, running loop forever
2026-08-18 22:30:26,853 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 22:30:26,861 INFO core: _init_accounts coroutine started
2026-08-18 22:30:26,862 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 22:30:26,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:35:29,540 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 22:35:29,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:40:11,908 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:45:37,832 INFO core: Event loop thread started, running loop forever
2026-08-18 22:45:38,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 22:45:38,137 INFO core: _init_accounts coroutine started
2026-08-18 22:45:38,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 22:45:38,149 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:50:33,630 INFO core: Event loop thread started, running loop forever
2026-08-18 22:50:33,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 22:50:33,935 INFO core: _init_accounts coroutine started
2026-08-18 22:50:33,938 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 22:50:33,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 22:55:07,465 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 22:55:07,480 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:00:14,510 INFO core: Event loop thread started, running loop forever
2026-08-18 23:00:14,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:00:14,816 INFO core: _init_accounts coroutine started
2026-08-18 23:00:14,818 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:00:14,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:05:20,440 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-18 23:05:50,293 INFO core: Event loop thread started, running loop forever
2026-08-18 23:05:50,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:05:50,600 INFO core: _init_accounts coroutine started
2026-08-18 23:05:50,601 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:05:50,612 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:05:50,614 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 23:05:50,615 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 23:05:50,616 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 23:10:09,475 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 23:10:09,491 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:15:36,340 INFO core: Event loop thread started, running loop forever
2026-08-18 23:15:36,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:15:36,645 INFO core: _init_accounts coroutine started
2026-08-18 23:15:36,646 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:15:36,656 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:20:19,877 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:25:52,088 INFO core: Event loop thread started, running loop forever
2026-08-18 23:25:52,390 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:25:52,394 INFO core: _init_accounts coroutine started
2026-08-18 23:25:52,396 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:25:52,404 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:30:13,851 INFO core: Event loop thread started, running loop forever
2026-08-18 23:30:14,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:30:14,157 INFO core: _init_accounts coroutine started
2026-08-18 23:30:14,157 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:30:14,167 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:35:13,538 INFO core: Event loop thread started, running loop forever
2026-08-18 23:35:13,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:35:13,845 INFO core: _init_accounts coroutine started
2026-08-18 23:35:13,846 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:35:13,855 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:40:05,052 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 23:40:05,053 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 23:40:05,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:45:12,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 23:45:12,394 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-18 23:45:12,395 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 23:45:12,395 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-18 23:45:12,395 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 23:45:12,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 23:45:13,465 INFO core: Event loop thread started, running loop forever
2026-08-18 23:45:13,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:45:13,771 INFO core: _init_accounts coroutine started
2026-08-18 23:45:13,773 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:45:13,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:50:05,656 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-18 23:50:05,656 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-18 23:50:05,658 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-18 23:50:05,660 INFO core: _init_accounts_inner: reloading LLM config
2026-08-18 23:50:05,664 INFO core: status() clients=0 connected=False forwarding=False
2026-08-18 23:55:11,455 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-18 23:55:11,455 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-18 23:55:11,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-18 23:55:32,243 INFO core: Event loop thread started, running loop forever
2026-08-18 23:55:32,544 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-18 23:55:32,548 INFO core: _init_accounts coroutine started
2026-08-18 23:55:32,550 INFO core: _init_accounts_inner: starting DB migrations
2026-08-18 23:55:32,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:00:39,366 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 00:00:54,281 INFO core: Event loop thread started, running loop forever
2026-08-19 00:00:54,583 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 00:00:54,589 INFO core: _init_accounts coroutine started
2026-08-19 00:00:54,589 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 00:00:54,594 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:05:26,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:10:20,910 INFO core: Event loop thread started, running loop forever
2026-08-19 00:10:21,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 00:10:21,216 INFO core: _init_accounts coroutine started
2026-08-19 00:10:21,217 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 00:10:21,226 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:15:28,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 00:15:50,604 INFO core: Event loop thread started, running loop forever
2026-08-19 00:15:50,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 00:15:50,909 INFO core: _init_accounts coroutine started
2026-08-19 00:15:50,909 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 00:15:50,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:20:09,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:25:16,375 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 00:25:48,347 INFO core: Event loop thread started, running loop forever
2026-08-19 00:25:48,648 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 00:25:48,658 INFO core: _init_accounts coroutine started
2026-08-19 00:25:48,659 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 00:25:48,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:25:48,672 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 00:25:48,673 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 00:30:31,063 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 00:30:31,068 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:35:06,159 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 00:35:06,167 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:40:06,104 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:45:51,694 INFO core: Event loop thread started, running loop forever
2026-08-19 00:45:51,995 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 00:45:52,000 INFO core: _init_accounts coroutine started
2026-08-19 00:45:52,001 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 00:45:52,013 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:50:25,217 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 00:55:32,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 00:55:51,322 INFO core: Event loop thread started, running loop forever
2026-08-19 00:55:51,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 00:55:51,628 INFO core: _init_accounts coroutine started
2026-08-19 00:55:51,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 00:55:51,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:00:21,901 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 01:00:21,901 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 01:00:21,902 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 01:00:21,904 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 01:00:21,909 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:05:27,407 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 01:05:27,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 01:05:27,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 01:05:42,365 INFO core: Event loop thread started, running loop forever
2026-08-19 01:05:42,666 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 01:05:42,670 INFO core: _init_accounts coroutine started
2026-08-19 01:05:42,671 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 01:05:42,682 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:10:40,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:15:16,783 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 01:15:16,817 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:20:20,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:25:30,266 INFO core: Event loop thread started, running loop forever
2026-08-19 01:25:30,567 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 01:25:30,571 INFO core: _init_accounts coroutine started
2026-08-19 01:25:30,573 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 01:25:30,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:30:04,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:35:10,038 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 01:35:10,041 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 01:35:10,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:40:23,609 INFO core: Event loop thread started, running loop forever
2026-08-19 01:40:23,911 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 01:40:23,916 INFO core: _init_accounts coroutine started
2026-08-19 01:40:23,917 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 01:40:23,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:45:04,336 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 01:45:15,182 INFO core: Event loop thread started, running loop forever
2026-08-19 01:45:15,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 01:45:15,494 INFO core: _init_accounts coroutine started
2026-08-19 01:45:15,494 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 01:45:15,500 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:50:08,673 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 01:55:04,784 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 01:55:04,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 01:55:04,803 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 01:55:04,806 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:00:46,607 INFO core: Event loop thread started, running loop forever
2026-08-19 02:00:46,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 02:00:46,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:05:05,597 INFO core: _init_accounts coroutine started
2026-08-19 02:05:05,598 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 02:05:05,623 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:10:12,559 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 02:10:36,409 INFO core: Event loop thread started, running loop forever
2026-08-19 02:10:36,711 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 02:10:36,721 INFO core: _init_accounts coroutine started
2026-08-19 02:10:36,722 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 02:10:36,734 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:15:13,304 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 02:15:13,304 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 02:15:13,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:20:19,539 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 02:20:52,239 INFO core: Event loop thread started, running loop forever
2026-08-19 02:20:52,540 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 02:20:52,549 INFO core: _init_accounts coroutine started
2026-08-19 02:20:52,549 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 02:20:52,570 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:25:16,953 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 02:25:16,955 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 02:25:16,957 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 02:25:16,959 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 02:25:16,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:30:31,795 INFO core: Event loop thread started, running loop forever
2026-08-19 02:30:32,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 02:30:32,109 INFO core: _init_accounts coroutine started
2026-08-19 02:30:32,109 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 02:30:32,123 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:35:27,392 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 02:35:27,433 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:40:36,113 INFO core: Event loop thread started, running loop forever
2026-08-19 02:40:36,422 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 02:40:36,430 INFO core: _init_accounts coroutine started
2026-08-19 02:40:36,431 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 02:40:36,440 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:45:43,495 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 02:45:49,671 INFO core: Event loop thread started, running loop forever
2026-08-19 02:45:49,972 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 02:45:49,978 INFO core: _init_accounts coroutine started
2026-08-19 02:45:49,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 02:45:49,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:50:29,245 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 02:55:21,174 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 02:55:21,175 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 02:55:21,185 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 02:55:21,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:00:16,249 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 03:00:16,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:05:25,253 INFO core: Event loop thread started, running loop forever
2026-08-19 03:05:25,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 03:05:25,561 INFO core: _init_accounts coroutine started
2026-08-19 03:05:25,561 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 03:05:25,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:10:44,315 INFO core: Event loop thread started, running loop forever
2026-08-19 03:10:44,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 03:10:44,621 INFO core: _init_accounts coroutine started
2026-08-19 03:10:44,621 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 03:10:44,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:15:26,773 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:20:31,171 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:25:11,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:25:11,504 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 03:30:17,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 03:30:17,508 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 03:30:17,508 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-19 03:30:17,509 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 03:30:17,509 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-19 03:30:17,509 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 03:30:17,510 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 03:30:30,620 INFO core: Event loop thread started, running loop forever
2026-08-19 03:30:30,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 03:30:30,929 INFO core: _init_accounts coroutine started
2026-08-19 03:30:30,930 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 03:30:30,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:35:10,923 INFO core: Event loop thread started, running loop forever
2026-08-19 03:35:11,225 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 03:35:11,231 INFO core: _init_accounts coroutine started
2026-08-19 03:35:11,231 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 03:35:11,238 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:40:41,517 INFO core: Event loop thread started, running loop forever
2026-08-19 03:40:41,818 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 03:40:41,823 INFO core: _init_accounts coroutine started
2026-08-19 03:40:41,824 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 03:40:41,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:45:26,179 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 03:45:26,198 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:50:40,996 INFO core: Event loop thread started, running loop forever
2026-08-19 03:50:41,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 03:50:41,301 INFO core: _init_accounts coroutine started
2026-08-19 03:50:41,302 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 03:50:41,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 03:55:51,690 INFO core: Event loop thread started, running loop forever
2026-08-19 03:55:51,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 03:55:51,996 INFO core: _init_accounts coroutine started
2026-08-19 03:55:51,997 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 03:55:52,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:00:26,808 INFO core: Event loop thread started, running loop forever
2026-08-19 04:00:27,109 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 04:00:27,113 INFO core: _init_accounts coroutine started
2026-08-19 04:00:27,114 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 04:00:27,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:00:59,835 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 04:05:10,922 INFO core: Event loop thread started, running loop forever
2026-08-19 04:05:11,226 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 04:05:11,239 INFO core: _init_accounts coroutine started
2026-08-19 04:05:11,240 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 04:05:11,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:10:17,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 04:10:49,468 INFO core: Event loop thread started, running loop forever
2026-08-19 04:10:49,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 04:10:49,774 INFO core: _init_accounts coroutine started
2026-08-19 04:10:49,775 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 04:10:49,786 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:15:18,925 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 04:15:18,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:15:18,927 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 04:20:42,941 INFO core: Event loop thread started, running loop forever
2026-08-19 04:20:43,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 04:20:43,247 INFO core: _init_accounts coroutine started
2026-08-19 04:20:43,248 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 04:20:43,264 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:25:11,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:30:47,891 INFO core: Event loop thread started, running loop forever
2026-08-19 04:30:48,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 04:30:48,198 INFO core: _init_accounts coroutine started
2026-08-19 04:30:48,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 04:30:48,206 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:35:36,180 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:40:43,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 04:40:45,131 INFO core: Event loop thread started, running loop forever
2026-08-19 04:40:45,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 04:40:45,436 INFO core: _init_accounts coroutine started
2026-08-19 04:40:45,437 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 04:40:45,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:45:44,945 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 04:45:44,946 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 04:45:44,953 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:50:21,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 04:55:16,610 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 04:55:16,613 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 04:55:16,617 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 04:55:16,635 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:00:22,650 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 05:00:22,650 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 05:00:22,651 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 05:00:49,901 INFO core: Event loop thread started, running loop forever
2026-08-19 05:00:50,202 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 05:00:50,205 INFO core: _init_accounts coroutine started
2026-08-19 05:00:50,206 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 05:00:50,215 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:05:16,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:10:23,098 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 05:10:26,590 INFO core: Event loop thread started, running loop forever
2026-08-19 05:10:26,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 05:10:26,897 INFO core: _init_accounts coroutine started
2026-08-19 05:10:26,899 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 05:10:26,911 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:10:26,915 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 05:10:26,915 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 05:15:17,672 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 05:15:17,676 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 05:15:17,678 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:20:49,323 INFO core: Event loop thread started, running loop forever
2026-08-19 05:20:49,624 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 05:20:49,629 INFO core: _init_accounts coroutine started
2026-08-19 05:20:49,631 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 05:20:49,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:25:20,525 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:30:49,363 INFO core: Event loop thread started, running loop forever
2026-08-19 05:30:49,664 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 05:30:49,669 INFO core: _init_accounts coroutine started
2026-08-19 05:30:49,670 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 05:30:49,683 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:35:04,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 05:35:04,398 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 05:35:04,431 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:40:11,127 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 05:40:21,275 INFO core: Event loop thread started, running loop forever
2026-08-19 05:40:21,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 05:40:21,581 INFO core: _init_accounts coroutine started
2026-08-19 05:40:21,582 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 05:40:21,592 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:45:49,703 INFO core: Event loop thread started, running loop forever
2026-08-19 05:45:50,004 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 05:45:50,009 INFO core: _init_accounts coroutine started
2026-08-19 05:45:50,010 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 05:45:50,017 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:50:50,377 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 05:55:50,945 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 05:55:50,953 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:00:53,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:05:43,991 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-19 06:05:43,992 INFO core: _init_accounts coroutine started
2026-08-19 06:05:43,992 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 06:05:44,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:05:44,002 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 06:05:44,003 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 06:10:20,671 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 06:10:20,678 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 06:10:20,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:10:20,704 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 06:10:20,704 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 06:15:11,437 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 06:15:11,439 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 06:15:41,688 INFO core: Event loop thread started, running loop forever
2026-08-19 06:15:41,990 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 06:15:41,996 INFO core: _init_accounts coroutine started
2026-08-19 06:15:41,998 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 06:15:42,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:20:24,294 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:25:18,265 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 06:25:18,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:30:22,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:35:23,074 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-19 06:35:23,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:40:29,493 INFO core: _init_accounts coroutine started
2026-08-19 06:40:29,494 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 06:40:29,494 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 06:40:41,509 INFO core: Event loop thread started, running loop forever
2026-08-19 06:40:41,810 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 06:40:41,816 INFO core: _init_accounts coroutine started
2026-08-19 06:40:41,817 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 06:40:41,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:45:31,186 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:50:38,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 06:50:38,409 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 06:50:40,246 INFO core: Event loop thread started, running loop forever
2026-08-19 06:50:40,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 06:50:40,553 INFO core: _init_accounts coroutine started
2026-08-19 06:50:40,553 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 06:50:40,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 06:55:34,099 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:00:29,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:05:12,174 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 07:05:12,174 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 07:05:12,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:10:48,905 INFO core: Event loop thread started, running loop forever
2026-08-19 07:10:49,213 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 07:10:49,218 INFO core: _init_accounts coroutine started
2026-08-19 07:10:49,218 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 07:10:49,237 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 07:10:49,238 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 07:10:49,241 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 07:10:49,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:10:49,247 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 07:15:22,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:20:23,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:25:10,615 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 07:25:10,616 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 07:25:10,623 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 07:25:10,624 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 07:25:10,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:30:07,825 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 07:30:07,827 WARNING core: Account 2: connect timed out after 35s
2026-08-19 07:30:07,827 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-19 07:30:07,828 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-19 07:30:07,829 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 07:30:07,829 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-19 07:30:07,830 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-19 07:30:07,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:35:05,332 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 07:35:05,332 WARNING core: Account 2: connect timed out after 35s
2026-08-19 07:35:05,334 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-19 07:35:05,334 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-19 07:35:05,336 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 07:35:05,338 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-19 07:35:05,339 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-19 07:35:05,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:40:12,359 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 07:40:12,361 WARNING core: Account 2: connect timed out after 35s
2026-08-19 07:40:43,542 INFO core: Event loop thread started, running loop forever
2026-08-19 07:40:43,843 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 07:40:43,846 INFO core: _init_accounts coroutine started
2026-08-19 07:40:43,847 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 07:40:43,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:45:46,081 INFO core: Event loop thread started, running loop forever
2026-08-19 07:45:46,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 07:45:46,388 INFO core: _init_accounts coroutine started
2026-08-19 07:45:46,389 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 07:45:46,398 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:45:50,084 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 07:50:51,684 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 07:50:51,707 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 07:55:45,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:00:52,839 INFO core: Event loop thread started, running loop forever
2026-08-19 08:00:53,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 08:00:53,144 INFO core: _init_accounts coroutine started
2026-08-19 08:00:53,146 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 08:00:53,154 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:05:41,887 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 08:05:41,888 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 08:05:41,891 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 08:05:41,891 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:05:41,894 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 08:10:38,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:15:35,181 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 08:15:35,183 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 08:15:35,191 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 08:15:35,192 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 08:15:35,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:20:11,638 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 08:20:11,638 WARNING core: Account 2: connect timed out after 35s
2026-08-19 08:20:11,638 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-19 08:20:11,639 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-19 08:20:11,639 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 08:20:11,640 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-19 08:20:11,640 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-19 08:20:11,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:20:28,823 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 08:20:28,823 ERROR core: Account 2 init failed on 91.108.56.181: Connection to Telegram failed 0 time(s)
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 285, in _start_account_client
    await self._bounded(
        lambda: client.connect(), 35, "connect", account_id
    )
  File "/home/wovewbge/quill.nx.kg/core.py", line 225, in _bounded
    return task.result()
           ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/client/telegrambaseclient.py", line 560, in connect
    if not await self._sender.connect(self._connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
    )):
    ^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 133, in connect
    await self._connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/telethon/network/mtprotosender.py", line 266, in _connect
    raise ConnectionError('Connection to Telegram failed {} time(s)'.format(self._retries))
ConnectionError: Connection to Telegram failed 0 time(s)
2026-08-19 08:20:28,835 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-19 08:20:28,836 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-19 08:20:28,837 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-19 08:20:28,838 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-19 08:20:28,841 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:25:07,057 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 08:25:07,058 WARNING core: Account 2: connect timed out after 35s
2026-08-19 08:25:07,059 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-19 08:25:07,059 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-19 08:25:07,060 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 08:25:07,062 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-19 08:25:07,062 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-19 08:25:07,066 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:30:04,575 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 08:30:04,576 WARNING core: Account 2: connect timed out after 35s
2026-08-19 08:30:04,577 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-19 08:30:04,578 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-19 08:30:04,578 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 08:30:04,580 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-19 08:30:04,580 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-19 08:30:04,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:30:10,650 INFO telethon.network.mtprotosender: Connection to 91.108.56.187:443/TcpAbridged complete!
2026-08-19 08:35:48,074 INFO core: Event loop thread started, running loop forever
2026-08-19 08:35:48,375 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 08:35:48,378 INFO core: _init_accounts coroutine started
2026-08-19 08:35:48,380 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 08:35:48,390 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 08:35:48,390 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 08:35:48,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 08:35:48,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:35:48,396 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 08:40:26,316 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:45:22,943 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 08:45:22,944 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 08:45:22,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:50:48,030 INFO core: Event loop thread started, running loop forever
2026-08-19 08:50:48,332 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 08:50:48,337 INFO core: _init_accounts coroutine started
2026-08-19 08:50:48,338 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 08:50:48,344 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 08:55:42,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:00:45,254 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 09:00:45,255 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 09:00:45,259 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 09:00:45,261 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 09:00:45,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:05:04,964 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:10:37,187 INFO core: Event loop thread started, running loop forever
2026-08-19 09:10:37,488 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 09:10:37,493 INFO core: _init_accounts coroutine started
2026-08-19 09:10:37,494 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 09:10:37,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:15:08,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:15:08,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 09:15:08,695 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 09:20:14,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 09:20:14,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-19 09:20:14,402 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 09:20:14,402 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-19 09:20:14,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 09:20:14,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 09:20:31,489 INFO core: Event loop thread started, running loop forever
2026-08-19 09:20:31,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 09:20:31,796 INFO core: _init_accounts coroutine started
2026-08-19 09:20:31,797 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 09:20:31,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:25:25,110 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 09:25:25,110 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 09:25:25,114 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 09:25:25,117 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 09:25:25,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:30:09,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:35:16,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 09:35:41,359 INFO core: Event loop thread started, running loop forever
2026-08-19 09:35:41,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 09:35:41,668 INFO core: _init_accounts coroutine started
2026-08-19 09:35:41,669 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 09:35:41,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:40:30,376 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 09:40:30,377 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 09:40:30,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:45:32,567 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 09:45:32,577 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:50:04,119 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 09:50:04,165 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 09:50:04,165 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 09:50:04,170 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 09:55:11,444 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 09:55:11,447 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 09:56:29,143 INFO core: Event loop thread started, running loop forever
2026-08-19 09:56:29,450 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 09:56:29,458 INFO core: _init_accounts coroutine started
2026-08-19 09:56:29,461 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 09:56:29,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:00:47,566 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 10:00:47,567 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 10:00:47,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:05:32,682 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 10:05:32,696 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:05:32,698 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 10:10:05,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:15:07,242 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 10:15:07,243 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 10:15:07,255 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 10:15:07,256 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 10:15:07,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:20:06,570 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 10:20:06,571 WARNING core: Account 2: connect timed out after 35s
2026-08-19 10:20:06,572 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-19 10:20:06,573 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-19 10:20:06,575 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 10:20:06,578 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-19 10:20:06,579 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-19 10:20:06,582 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:25:13,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 10:25:13,418 WARNING core: Account 2: connect timed out after 35s
2026-08-19 10:25:13,418 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-19 10:25:13,419 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-19 10:25:13,419 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 10:25:13,420 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-19 10:25:13,420 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-19 10:25:25,702 INFO core: Event loop thread started, running loop forever
2026-08-19 10:25:26,004 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 10:25:26,009 INFO core: _init_accounts coroutine started
2026-08-19 10:25:26,010 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 10:25:26,019 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:30:33,215 INFO core: Event loop thread started, running loop forever
2026-08-19 10:30:33,516 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 10:30:33,520 INFO core: _init_accounts coroutine started
2026-08-19 10:30:33,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 10:30:33,536 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 10:30:33,536 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 10:30:33,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:30:33,538 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 10:35:18,827 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 10:35:18,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:40:15,249 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:45:51,843 INFO core: Event loop thread started, running loop forever
2026-08-19 10:45:52,144 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 10:45:52,147 INFO core: _init_accounts coroutine started
2026-08-19 10:45:52,151 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 10:45:52,153 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:50:08,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 10:55:25,138 INFO core: Event loop thread started, running loop forever
2026-08-19 10:55:25,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 10:55:25,448 INFO core: _init_accounts coroutine started
2026-08-19 10:55:25,448 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 10:55:25,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:00:17,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:05:24,417 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-19 11:05:33,907 INFO core: Event loop thread started, running loop forever
2026-08-19 11:05:34,208 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 11:05:34,214 INFO core: _init_accounts coroutine started
2026-08-19 11:05:34,214 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 11:05:34,224 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:10:46,275 INFO core: Event loop thread started, running loop forever
2026-08-19 11:10:46,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 11:10:46,586 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:15:23,266 INFO core: _init_accounts coroutine started
2026-08-19 11:15:23,267 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 11:15:23,273 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:20:50,471 INFO core: Event loop thread started, running loop forever
2026-08-19 11:20:50,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 11:20:50,779 INFO core: _init_accounts coroutine started
2026-08-19 11:20:50,780 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 11:20:50,790 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:25:26,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:30:19,695 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 11:30:19,695 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 11:30:19,702 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 11:30:19,708 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:35:05,322 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 11:35:05,331 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:40:12,371 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 11:40:28,235 INFO core: Event loop thread started, running loop forever
2026-08-19 11:40:28,536 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 11:40:28,540 INFO core: _init_accounts coroutine started
2026-08-19 11:40:28,542 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 11:40:28,552 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:45:14,340 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 11:45:14,341 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 11:45:14,345 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 11:45:14,348 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 11:45:14,350 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:50:34,026 INFO core: Event loop thread started, running loop forever
2026-08-19 11:50:34,327 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 11:50:34,343 INFO core: _init_accounts coroutine started
2026-08-19 11:50:34,354 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 11:50:34,376 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 11:55:37,708 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:00:09,500 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 12:00:09,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:05:11,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:10:33,797 INFO core: Event loop thread started, running loop forever
2026-08-19 12:10:34,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 12:10:34,104 INFO core: _init_accounts coroutine started
2026-08-19 12:10:34,105 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 12:10:34,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:15:50,094 INFO core: Event loop thread started, running loop forever
2026-08-19 12:15:50,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 12:15:50,400 INFO core: _init_accounts coroutine started
2026-08-19 12:15:50,401 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 12:15:50,412 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:20:46,602 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 12:20:46,603 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 12:20:46,606 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 12:20:46,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:20:46,608 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 12:25:14,903 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:30:15,740 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:35:21,570 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 12:35:21,570 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 12:35:21,570 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 12:35:37,769 INFO core: Event loop thread started, running loop forever
2026-08-19 12:35:38,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 12:35:38,078 INFO core: _init_accounts coroutine started
2026-08-19 12:35:38,078 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 12:35:38,082 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:40:38,388 INFO core: Event loop thread started, running loop forever
2026-08-19 12:40:38,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 12:40:38,701 INFO core: _init_accounts coroutine started
2026-08-19 12:40:38,701 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 12:40:38,711 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:40:45,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 12:45:44,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 12:45:49,198 INFO core: Event loop thread started, running loop forever
2026-08-19 12:45:49,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 12:45:49,505 INFO core: _init_accounts coroutine started
2026-08-19 12:45:49,506 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 12:45:49,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:50:17,176 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 12:50:17,177 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 12:50:17,181 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 12:50:17,182 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 12:50:17,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 12:55:33,943 INFO core: Event loop thread started, running loop forever
2026-08-19 12:55:34,244 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 12:55:34,249 INFO core: _init_accounts coroutine started
2026-08-19 12:55:34,250 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 12:55:34,258 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:00:08,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 13:00:54,806 INFO core: Event loop thread started, running loop forever
2026-08-19 13:00:55,107 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 13:00:55,110 INFO core: _init_accounts coroutine started
2026-08-19 13:00:55,111 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 13:00:55,116 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:05:04,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:10:38,165 INFO core: Event loop thread started, running loop forever
2026-08-19 13:10:38,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 13:10:38,470 INFO core: _init_accounts coroutine started
2026-08-19 13:10:38,470 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 13:10:38,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:15:40,555 INFO core: Event loop thread started, running loop forever
2026-08-19 13:15:40,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 13:15:40,860 INFO core: _init_accounts coroutine started
2026-08-19 13:15:40,861 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 13:15:40,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:20:17,400 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 13:20:17,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:20:17,400 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 13:25:05,574 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 13:25:05,604 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 13:25:05,622 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 13:25:05,622 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 13:25:05,626 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 13:25:05,627 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 13:25:05,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:30:11,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 13:30:11,418 WARNING core: Account 2: connect timed out after 35s
2026-08-19 13:30:49,949 INFO core: Event loop thread started, running loop forever
2026-08-19 13:30:50,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 13:30:50,257 INFO core: _init_accounts coroutine started
2026-08-19 13:30:50,258 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 13:30:50,268 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:35:49,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:40:44,106 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 13:40:44,109 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 13:40:44,115 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 13:40:44,119 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 13:40:44,126 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:45:07,207 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:50:14,381 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 13:50:37,347 INFO core: Event loop thread started, running loop forever
2026-08-19 13:50:37,648 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 13:50:37,654 INFO core: _init_accounts coroutine started
2026-08-19 13:50:37,656 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 13:50:37,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 13:55:04,952 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 13:55:05,002 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:00:30,779 INFO core: Event loop thread started, running loop forever
2026-08-19 14:00:31,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 14:00:31,086 INFO core: _init_accounts coroutine started
2026-08-19 14:00:31,087 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 14:00:31,095 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:05:13,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:10:23,741 INFO core: Event loop thread started, running loop forever
2026-08-19 14:10:24,042 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 14:10:24,050 INFO core: _init_accounts coroutine started
2026-08-19 14:10:24,051 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 14:10:24,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:15:30,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 14:15:38,644 INFO core: Event loop thread started, running loop forever
2026-08-19 14:15:38,945 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 14:15:38,951 INFO core: _init_accounts coroutine started
2026-08-19 14:15:38,951 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 14:15:39,013 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:20:47,042 INFO core: Event loop thread started, running loop forever
2026-08-19 14:20:47,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 14:20:47,347 INFO core: _init_accounts coroutine started
2026-08-19 14:20:47,347 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 14:20:47,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:25:49,261 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 14:25:49,262 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 14:25:49,263 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:30:30,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 14:30:30,444 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 14:30:30,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:35:37,369 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 14:35:37,370 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 14:35:37,370 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 14:35:45,884 INFO core: Event loop thread started, running loop forever
2026-08-19 14:35:46,185 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 14:35:46,193 INFO core: _init_accounts coroutine started
2026-08-19 14:35:46,194 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 14:35:46,200 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:40:30,430 INFO core: Event loop thread started, running loop forever
2026-08-19 14:40:30,731 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 14:40:30,739 INFO core: _init_accounts coroutine started
2026-08-19 14:40:30,740 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 14:40:30,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:45:05,569 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 14:45:05,570 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 14:45:05,571 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 14:45:05,573 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 14:45:05,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:50:12,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 14:50:12,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 14:50:29,785 INFO core: Event loop thread started, running loop forever
2026-08-19 14:50:30,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 14:50:30,099 INFO core: _init_accounts coroutine started
2026-08-19 14:50:30,099 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 14:50:30,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:55:16,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 14:55:16,647 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 14:55:16,647 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 15:00:22,376 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 15:00:22,380 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 15:00:33,449 INFO core: Event loop thread started, running loop forever
2026-08-19 15:00:33,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 15:00:33,754 INFO core: _init_accounts coroutine started
2026-08-19 15:00:33,754 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 15:00:33,765 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:05:18,880 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 15:05:18,880 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 15:05:18,884 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:10:24,351 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 15:10:24,351 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-19 15:10:24,352 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 15:10:24,352 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-19 15:10:24,352 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 15:10:24,353 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 15:10:36,997 INFO core: Event loop thread started, running loop forever
2026-08-19 15:10:37,298 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 15:10:37,301 INFO core: _init_accounts coroutine started
2026-08-19 15:10:37,302 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 15:10:37,311 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:15:31,546 INFO core: Event loop thread started, running loop forever
2026-08-19 15:15:31,849 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 15:15:31,855 INFO core: _init_accounts coroutine started
2026-08-19 15:15:31,855 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 15:15:31,862 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:20:05,532 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 15:20:05,532 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 15:20:05,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:20:05,535 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 15:25:39,533 INFO core: Event loop thread started, running loop forever
2026-08-19 15:25:39,835 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 15:25:39,840 INFO core: _init_accounts coroutine started
2026-08-19 15:25:39,841 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 15:25:39,851 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 15:25:39,851 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 15:25:39,853 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 15:25:39,855 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 15:25:39,859 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:30:32,542 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:35:19,747 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:40:25,374 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 15:40:25,375 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 15:40:25,376 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 15:40:31,371 INFO core: Event loop thread started, running loop forever
2026-08-19 15:40:31,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 15:40:31,677 INFO core: _init_accounts coroutine started
2026-08-19 15:40:31,677 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 15:40:31,690 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 15:40:31,690 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 15:40:31,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:45:06,010 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 15:45:06,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:50:20,607 INFO core: Event loop thread started, running loop forever
2026-08-19 15:50:20,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 15:50:20,914 INFO core: _init_accounts coroutine started
2026-08-19 15:50:20,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 15:50:20,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 15:55:20,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:00:12,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:05:19,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 16:05:19,421 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 16:05:19,922 INFO core: Event loop thread started, running loop forever
2026-08-19 16:05:20,224 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 16:05:20,233 INFO core: _init_accounts coroutine started
2026-08-19 16:05:20,233 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 16:05:20,248 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 16:05:20,248 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 16:05:20,249 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:05:20,250 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 16:10:26,366 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 16:10:38,904 INFO core: Event loop thread started, running loop forever
2026-08-19 16:10:39,205 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 16:10:39,215 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:15:47,480 INFO core: Event loop thread started, running loop forever
2026-08-19 16:15:47,783 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 16:15:47,788 INFO core: _init_accounts coroutine started
2026-08-19 16:15:47,788 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 16:15:47,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:20:29,364 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 16:20:29,365 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 16:20:29,373 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:25:39,240 INFO core: Event loop thread started, running loop forever
2026-08-19 16:25:39,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 16:25:39,549 INFO core: _init_accounts coroutine started
2026-08-19 16:25:39,549 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 16:25:39,558 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:30:12,430 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:35:19,431 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 16:35:40,874 INFO core: Event loop thread started, running loop forever
2026-08-19 16:35:41,176 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 16:35:41,183 INFO core: _init_accounts coroutine started
2026-08-19 16:35:41,183 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 16:35:41,197 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 16:35:41,197 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 16:35:41,199 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 16:35:41,201 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 16:35:41,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:40:26,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:45:32,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 16:45:46,511 INFO core: Event loop thread started, running loop forever
2026-08-19 16:45:46,812 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 16:45:46,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:50:11,875 INFO core: _init_accounts coroutine started
2026-08-19 16:50:11,876 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 16:50:11,886 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 16:55:27,945 INFO core: Event loop thread started, running loop forever
2026-08-19 16:55:28,247 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 16:55:28,252 INFO core: _init_accounts coroutine started
2026-08-19 16:55:28,252 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 16:55:28,260 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:00:34,390 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 17:00:40,705 INFO core: Event loop thread started, running loop forever
2026-08-19 17:00:41,006 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 17:00:41,012 INFO core: _init_accounts coroutine started
2026-08-19 17:00:41,013 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 17:00:41,024 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:05:24,311 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:05:24,313 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 17:10:12,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 17:10:12,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 17:10:12,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:10:12,113 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 17:15:19,497 INFO core: Event loop thread started, running loop forever
2026-08-19 17:15:19,798 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 17:15:19,804 INFO core: _init_accounts coroutine started
2026-08-19 17:15:19,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 17:15:19,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:20:29,923 INFO core: Event loop thread started, running loop forever
2026-08-19 17:20:30,224 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 17:20:30,228 INFO core: _init_accounts coroutine started
2026-08-19 17:20:30,228 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 17:20:30,244 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 17:20:30,245 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 17:20:30,247 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 17:20:30,250 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 17:20:30,256 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:25:34,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:30:23,104 INFO core: Event loop thread started, running loop forever
2026-08-19 17:30:23,405 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 17:30:23,409 INFO core: _init_accounts coroutine started
2026-08-19 17:30:23,409 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 17:30:23,416 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:35:39,206 INFO core: Event loop thread started, running loop forever
2026-08-19 17:35:39,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 17:35:39,510 INFO core: _init_accounts coroutine started
2026-08-19 17:35:39,511 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 17:35:39,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:40:32,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:40:32,592 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 17:45:03,839 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 17:45:03,858 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 17:45:03,876 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 17:45:03,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:50:25,065 INFO core: Event loop thread started, running loop forever
2026-08-19 17:50:25,366 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 17:50:25,373 INFO core: _init_accounts coroutine started
2026-08-19 17:50:25,373 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 17:50:25,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:55:32,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 17:55:46,733 INFO core: Event loop thread started, running loop forever
2026-08-19 17:55:47,036 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 17:55:47,042 INFO core: _init_accounts coroutine started
2026-08-19 17:55:47,053 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 17:55:47,056 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 18:00:39,503 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:05:51,435 INFO core: Event loop thread started, running loop forever
2026-08-19 18:05:51,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 18:05:51,755 INFO core: _init_accounts coroutine started
2026-08-19 18:05:51,755 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 18:05:51,760 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:10:05,387 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:15:12,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 18:15:12,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 18:15:29,146 INFO core: Event loop thread started, running loop forever
2026-08-19 18:15:29,450 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 18:15:29,456 INFO core: _init_accounts coroutine started
2026-08-19 18:15:29,456 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 18:15:29,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:20:36,465 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 18:20:45,288 INFO core: Event loop thread started, running loop forever
2026-08-19 18:20:45,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 18:20:45,596 INFO core: _init_accounts coroutine started
2026-08-19 18:20:45,596 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 18:20:45,610 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:25:23,704 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 18:25:23,704 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 18:25:23,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:25:23,709 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 18:30:11,107 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 18:30:11,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:35:18,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 18:35:18,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 18:35:18,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 18:35:20,375 INFO core: Event loop thread started, running loop forever
2026-08-19 18:35:20,677 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 18:35:20,683 INFO core: _init_accounts coroutine started
2026-08-19 18:35:20,683 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 18:35:20,695 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:40:11,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:40:11,086 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 18:40:11,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 18:45:11,628 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 18:45:11,635 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:50:28,610 INFO core: Event loop thread started, running loop forever
2026-08-19 18:50:28,911 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 18:50:28,915 INFO core: _init_accounts coroutine started
2026-08-19 18:50:28,915 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 18:50:28,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 18:55:35,345 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 18:55:35,345 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 18:55:35,345 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-19 18:55:35,346 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 18:55:35,346 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-19 18:55:35,346 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 18:55:35,346 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-19 18:55:35,347 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 18:55:35,347 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 18:55:44,665 INFO core: Event loop thread started, running loop forever
2026-08-19 18:55:44,967 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 18:55:44,972 INFO core: _init_accounts coroutine started
2026-08-19 18:55:44,973 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 18:55:44,982 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:00:29,230 INFO core: Event loop thread started, running loop forever
2026-08-19 19:00:29,532 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 19:00:29,537 INFO core: _init_accounts coroutine started
2026-08-19 19:00:29,539 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 19:00:29,547 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:00:50,282 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 19:05:36,278 INFO core: Event loop thread started, running loop forever
2026-08-19 19:05:36,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 19:05:36,586 INFO core: _init_accounts coroutine started
2026-08-19 19:05:36,587 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 19:05:36,597 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 19:05:36,598 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 19:05:36,599 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 19:05:36,601 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 19:05:36,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:10:39,819 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:15:29,983 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 19:15:29,984 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 19:15:29,986 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:20:33,414 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 19:20:33,415 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 19:20:33,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:25:17,235 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 19:25:17,235 WARNING core: Account 2: connect timed out after 35s
2026-08-19 19:25:17,236 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-19 19:25:17,236 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-19 19:25:17,237 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 19:25:17,238 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-19 19:25:17,238 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-19 19:25:17,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:30:24,374 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 19:30:24,375 WARNING core: Account 2: connect timed out after 35s
2026-08-19 19:30:24,376 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-19 19:30:24,376 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-19 19:30:24,377 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 19:30:24,378 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-19 19:30:24,379 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-19 19:30:35,576 INFO core: Event loop thread started, running loop forever
2026-08-19 19:30:35,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 19:30:35,887 INFO core: _init_accounts coroutine started
2026-08-19 19:30:35,891 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:30:35,893 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 19:35:42,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 19:35:49,346 INFO core: Event loop thread started, running loop forever
2026-08-19 19:35:49,648 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 19:35:49,653 INFO core: _init_accounts coroutine started
2026-08-19 19:35:49,654 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 19:35:49,662 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:40:11,566 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:45:05,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 19:45:20,942 INFO core: Event loop thread started, running loop forever
2026-08-19 19:45:21,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 19:45:21,246 INFO core: _init_accounts coroutine started
2026-08-19 19:45:21,247 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 19:45:21,257 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:50:09,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 19:50:09,294 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 19:50:09,294 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 19:55:41,328 INFO core: Event loop thread started, running loop forever
2026-08-19 19:55:41,629 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 19:55:41,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:00:43,433 INFO core: _init_accounts coroutine started
2026-08-19 20:00:43,434 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 20:00:43,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:05:24,261 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 20:05:24,262 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 20:05:24,267 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 20:05:24,270 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 20:05:24,270 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:10:09,930 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:15:31,371 INFO core: Event loop thread started, running loop forever
2026-08-19 20:15:31,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 20:15:31,680 INFO core: _init_accounts coroutine started
2026-08-19 20:15:31,681 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 20:15:31,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:20:40,773 INFO core: Event loop thread started, running loop forever
2026-08-19 20:20:41,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 20:20:41,078 INFO core: _init_accounts coroutine started
2026-08-19 20:20:41,079 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 20:20:41,090 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:25:48,318 INFO core: Event loop thread started, running loop forever
2026-08-19 20:25:48,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 20:25:48,624 INFO core: _init_accounts coroutine started
2026-08-19 20:25:48,625 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 20:25:48,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:30:52,617 INFO core: Event loop thread started, running loop forever
2026-08-19 20:30:52,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 20:30:52,922 INFO core: _init_accounts coroutine started
2026-08-19 20:30:52,923 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 20:30:52,932 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:35:34,632 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 20:35:34,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:35:34,634 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 20:40:28,184 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 20:40:28,191 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 20:40:28,201 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:45:35,363 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 20:45:50,044 INFO core: Event loop thread started, running loop forever
2026-08-19 20:45:50,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 20:45:50,352 INFO core: _init_accounts coroutine started
2026-08-19 20:45:50,353 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 20:45:50,362 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:50:33,916 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 20:50:33,916 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 20:50:33,916 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 20:55:33,717 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 20:55:33,729 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:00:36,101 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 21:00:36,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:05:04,938 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-19 21:05:04,939 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 21:05:04,950 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 21:05:04,951 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 21:05:04,956 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:10:10,453 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 21:10:10,455 WARNING core: Account 2: connect timed out after 35s
2026-08-19 21:10:10,456 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-19 21:10:25,317 INFO core: Event loop thread started, running loop forever
2026-08-19 21:10:25,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 21:10:25,623 INFO core: _init_accounts coroutine started
2026-08-19 21:10:25,625 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 21:10:25,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:15:14,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:15:14,846 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 21:15:14,846 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 21:15:14,847 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 21:20:07,542 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 21:20:07,546 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:25:07,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:30:39,292 INFO core: Event loop thread started, running loop forever
2026-08-19 21:30:39,593 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 21:30:39,599 INFO core: _init_accounts coroutine started
2026-08-19 21:30:39,599 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 21:30:39,609 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:35:47,799 INFO core: Event loop thread started, running loop forever
2026-08-19 21:35:48,100 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 21:35:48,109 INFO core: _init_accounts coroutine started
2026-08-19 21:35:48,109 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 21:35:48,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:35:48,127 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 21:35:48,128 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 21:40:37,671 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 21:40:37,678 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 21:40:37,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:45:43,376 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 21:45:43,377 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 21:45:43,377 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 21:45:50,818 INFO core: Event loop thread started, running loop forever
2026-08-19 21:45:51,123 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 21:45:51,129 INFO core: _init_accounts coroutine started
2026-08-19 21:45:51,129 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 21:45:51,135 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:50:07,254 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 21:50:07,259 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 21:50:07,266 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 21:55:50,291 INFO core: Event loop thread started, running loop forever
2026-08-19 21:55:50,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 21:55:50,597 INFO core: _init_accounts coroutine started
2026-08-19 21:55:50,598 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 21:55:50,604 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:00:44,543 INFO core: Event loop thread started, running loop forever
2026-08-19 22:00:44,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 22:00:44,851 INFO core: _init_accounts coroutine started
2026-08-19 22:00:44,853 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 22:00:44,862 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:05:17,562 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 22:05:17,562 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 22:05:17,570 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:05:17,571 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 22:10:42,725 INFO core: Event loop thread started, running loop forever
2026-08-19 22:10:43,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 22:10:43,040 INFO core: _init_accounts coroutine started
2026-08-19 22:10:43,041 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 22:10:43,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:15:05,944 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 22:15:05,945 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 22:15:05,955 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 22:15:05,957 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:15:05,959 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 22:20:11,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 22:20:11,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 22:20:35,094 INFO core: Event loop thread started, running loop forever
2026-08-19 22:20:35,396 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 22:20:35,402 INFO core: _init_accounts coroutine started
2026-08-19 22:20:35,403 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 22:20:35,414 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:25:11,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:30:18,476 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 22:30:18,477 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 22:30:22,739 INFO core: Event loop thread started, running loop forever
2026-08-19 22:30:23,041 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 22:30:23,045 INFO core: _init_accounts coroutine started
2026-08-19 22:30:23,045 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 22:30:23,060 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 22:30:23,060 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 22:30:23,061 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 22:30:23,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:35:29,422 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 22:35:47,936 INFO core: Event loop thread started, running loop forever
2026-08-19 22:35:48,237 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 22:35:48,245 INFO core: _init_accounts coroutine started
2026-08-19 22:35:48,245 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 22:35:48,260 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:35:48,261 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 22:35:48,262 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 22:35:48,263 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 22:35:48,265 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 22:40:24,597 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:45:19,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:45:19,830 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 22:45:19,831 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 22:50:53,216 INFO core: Event loop thread started, running loop forever
2026-08-19 22:50:53,518 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 22:50:53,523 INFO core: _init_accounts coroutine started
2026-08-19 22:50:53,524 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 22:50:53,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 22:50:53,535 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 22:50:53,536 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 22:50:53,537 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 22:50:53,548 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 22:50:53,549 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 22:50:53,553 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 22:50:53,554 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 22:50:53,557 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 22:55:38,621 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 22:55:38,623 WARNING core: Account 2: connect timed out after 35s
2026-08-19 22:55:38,624 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-19 22:55:38,625 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-19 22:55:38,626 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 22:55:38,628 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-19 22:55:38,629 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-19 22:55:38,631 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:00:06,371 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 23:00:06,372 WARNING core: Account 2: connect timed out after 35s
2026-08-19 23:00:06,372 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-19 23:00:06,373 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-19 23:00:06,373 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 23:00:06,374 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-19 23:00:06,375 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-19 23:00:06,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:05:09,587 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-19 23:05:09,587 WARNING core: Account 2: connect timed out after 35s
2026-08-19 23:05:09,588 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-19 23:05:09,588 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-19 23:05:09,588 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-19 23:05:09,589 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-19 23:05:09,589 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-19 23:05:09,609 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:10:32,729 INFO core: Event loop thread started, running loop forever
2026-08-19 23:10:33,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 23:10:33,037 INFO core: _init_accounts coroutine started
2026-08-19 23:10:33,038 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 23:10:33,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:15:40,203 INFO core: Event loop thread started, running loop forever
2026-08-19 23:15:40,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 23:15:40,513 INFO core: _init_accounts coroutine started
2026-08-19 23:15:40,514 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 23:15:40,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:20:51,513 INFO core: Event loop thread started, running loop forever
2026-08-19 23:20:51,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 23:20:51,820 INFO core: _init_accounts coroutine started
2026-08-19 23:20:51,821 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 23:20:51,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:25:30,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 23:25:30,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 23:25:30,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 23:25:30,475 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 23:25:30,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:30:07,738 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-19 23:30:07,739 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-19 23:30:07,747 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-19 23:30:07,748 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-19 23:30:07,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:35:15,220 INFO core: Event loop thread started, running loop forever
2026-08-19 23:35:15,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 23:35:15,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:40:16,315 INFO core: _init_accounts coroutine started
2026-08-19 23:40:16,318 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 23:40:16,328 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 23:40:16,328 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 23:40:16,332 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 23:40:16,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:45:23,364 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 23:45:23,365 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-19 23:45:23,741 INFO core: Event loop thread started, running loop forever
2026-08-19 23:45:24,042 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 23:45:24,046 INFO core: _init_accounts coroutine started
2026-08-19 23:45:24,046 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 23:45:24,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:50:28,324 INFO core: Event loop thread started, running loop forever
2026-08-19 23:50:28,627 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-19 23:50:28,633 INFO core: _init_accounts coroutine started
2026-08-19 23:50:28,635 INFO core: _init_accounts_inner: starting DB migrations
2026-08-19 23:50:28,640 INFO core: status() clients=0 connected=False forwarding=False
2026-08-19 23:50:31,325 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-19 23:55:30,262 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-19 23:55:30,263 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-19 23:55:30,264 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-19 23:55:30,267 INFO core: _init_accounts_inner: reloading LLM config
2026-08-19 23:55:30,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:00:37,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 00:00:37,407 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 00:00:37,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 00:00:50,610 INFO core: Event loop thread started, running loop forever
2026-08-20 00:00:50,912 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 00:00:50,917 INFO core: _init_accounts coroutine started
2026-08-20 00:00:50,918 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 00:00:50,930 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:05:43,565 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 00:05:43,565 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 00:05:43,570 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 00:05:43,570 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:10:18,771 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 00:10:18,779 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:15:06,374 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 00:15:42,793 INFO core: Event loop thread started, running loop forever
2026-08-20 00:15:43,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 00:15:43,099 INFO core: _init_accounts coroutine started
2026-08-20 00:15:43,099 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 00:15:43,105 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:20:51,885 INFO core: Event loop thread started, running loop forever
2026-08-20 00:20:52,186 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 00:20:52,192 INFO core: _init_accounts coroutine started
2026-08-20 00:20:52,193 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 00:20:52,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:25:11,013 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 00:25:11,013 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 00:25:11,022 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 00:25:11,026 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:30:17,463 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 00:30:29,261 INFO core: Event loop thread started, running loop forever
2026-08-20 00:30:29,563 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 00:30:29,570 INFO core: _init_accounts coroutine started
2026-08-20 00:30:29,572 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 00:30:29,583 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:35:23,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:40:14,776 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 00:40:14,788 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:45:31,011 INFO core: Event loop thread started, running loop forever
2026-08-20 00:45:31,316 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 00:45:31,321 INFO core: _init_accounts coroutine started
2026-08-20 00:45:31,321 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 00:45:31,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:45:31,336 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 00:45:31,337 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 00:50:18,700 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 00:50:18,706 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 00:50:18,707 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 00:55:09,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:00:49,566 INFO core: Event loop thread started, running loop forever
2026-08-20 01:00:49,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 01:00:49,876 INFO core: _init_accounts coroutine started
2026-08-20 01:00:49,877 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 01:00:49,883 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:05:06,209 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 01:05:06,210 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 01:05:06,211 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 01:05:06,213 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 01:05:06,225 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 01:05:06,226 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 01:05:06,232 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-20 01:05:06,233 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-20 01:05:06,243 INFO core: status() clients=0 connected=False forwarding=False
[UID:1957][3947736] packetLen < 0
2026-08-20 01:10:08,601 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 01:10:08,601 WARNING core: Account 2: connect timed out after 35s
2026-08-20 01:10:08,602 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-20 01:10:08,602 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-20 01:10:08,603 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-20 01:10:08,603 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-20 01:10:08,604 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-20 01:10:13,071 INFO core: Event loop thread started, running loop forever
2026-08-20 01:10:13,372 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 01:10:13,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:15:20,394 INFO core: _init_accounts coroutine started
2026-08-20 01:15:20,394 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 01:15:20,395 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-20 01:15:33,970 INFO core: Event loop thread started, running loop forever
2026-08-20 01:15:34,271 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 01:15:34,278 INFO core: _init_accounts coroutine started
2026-08-20 01:15:34,280 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 01:15:34,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:20:04,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:25:35,026 INFO core: Event loop thread started, running loop forever
2026-08-20 01:25:35,327 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 01:25:35,331 INFO core: _init_accounts coroutine started
2026-08-20 01:25:35,335 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 01:25:35,343 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:30:06,773 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:30:06,775 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 01:30:06,775 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 01:35:09,847 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 01:35:09,848 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:40:15,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 01:40:15,406 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 01:40:15,407 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 01:40:15,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 01:40:22,058 INFO core: Event loop thread started, running loop forever
2026-08-20 01:40:22,360 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 01:40:22,368 INFO core: _init_accounts coroutine started
2026-08-20 01:40:22,368 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 01:40:22,377 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:45:29,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 01:45:35,332 INFO core: Event loop thread started, running loop forever
2026-08-20 01:45:35,634 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 01:45:35,639 INFO core: _init_accounts coroutine started
2026-08-20 01:45:35,640 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 01:45:35,659 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 01:45:35,659 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 01:45:35,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:50:16,568 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 01:50:16,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:55:32,047 INFO core: Event loop thread started, running loop forever
2026-08-20 01:55:32,348 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 01:55:32,353 INFO core: _init_accounts coroutine started
2026-08-20 01:55:32,355 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 01:55:32,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 01:55:32,375 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 01:55:32,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 01:55:32,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 01:55:32,378 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 02:00:17,752 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:05:31,747 INFO core: Event loop thread started, running loop forever
2026-08-20 02:05:32,050 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 02:05:32,052 INFO core: _init_accounts coroutine started
2026-08-20 02:05:32,054 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 02:05:32,082 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 02:05:32,083 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 02:05:32,084 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:10:32,096 INFO core: Event loop thread started, running loop forever
2026-08-20 02:10:32,397 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 02:10:32,404 INFO core: _init_accounts coroutine started
2026-08-20 02:10:32,405 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 02:10:32,419 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:10:39,097 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 02:15:12,558 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:20:08,629 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 02:20:08,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:25:15,591 INFO core: Event loop thread started, running loop forever
2026-08-20 02:25:15,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 02:25:15,902 INFO core: _init_accounts coroutine started
2026-08-20 02:25:15,902 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 02:25:15,912 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:30:06,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 02:30:51,688 INFO core: Event loop thread started, running loop forever
2026-08-20 02:30:51,989 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 02:30:51,994 INFO core: _init_accounts coroutine started
2026-08-20 02:30:51,994 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 02:30:52,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:35:06,731 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 02:35:06,733 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 02:35:06,735 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 02:35:06,737 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 02:35:06,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:40:12,443 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 02:40:12,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 02:40:12,444 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 901, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 02:40:27,421 INFO core: Event loop thread started, running loop forever
2026-08-20 02:40:27,722 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 02:40:27,728 INFO core: _init_accounts coroutine started
2026-08-20 02:40:27,730 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 02:40:27,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:45:23,243 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 02:45:23,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:50:38,200 INFO core: Event loop thread started, running loop forever
2026-08-20 02:50:38,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 02:50:38,508 INFO core: _init_accounts coroutine started
2026-08-20 02:50:38,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 02:50:38,523 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 02:55:45,365 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 02:55:50,881 INFO core: Event loop thread started, running loop forever
2026-08-20 02:55:51,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 02:55:51,189 INFO core: _init_accounts coroutine started
2026-08-20 02:55:51,189 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 02:55:51,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:00:53,492 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:05:23,044 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 03:05:23,045 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 03:05:23,050 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:05:23,051 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 03:10:27,064 INFO core: Event loop thread started, running loop forever
2026-08-20 03:10:27,371 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 03:10:27,379 INFO core: _init_accounts coroutine started
2026-08-20 03:10:27,379 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 03:10:27,392 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:15:19,850 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 03:15:19,876 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:20:47,717 INFO core: Event loop thread started, running loop forever
2026-08-20 03:20:48,018 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 03:20:48,026 INFO core: _init_accounts coroutine started
2026-08-20 03:20:48,028 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 03:20:48,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:25:18,267 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 03:25:18,272 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 03:25:18,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:30:04,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 03:30:04,454 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 03:30:04,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:35:39,393 INFO core: Event loop thread started, running loop forever
2026-08-20 03:35:39,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 03:35:39,700 INFO core: _init_accounts coroutine started
2026-08-20 03:35:39,700 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 03:35:39,705 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:40:34,383 INFO core: Event loop thread started, running loop forever
2026-08-20 03:40:34,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 03:40:34,697 INFO core: _init_accounts coroutine started
2026-08-20 03:40:34,697 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 03:40:34,706 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:45:33,675 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 03:45:33,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:50:19,276 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 03:55:14,410 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-20 03:55:14,412 INFO core: _init_accounts coroutine started
2026-08-20 03:55:14,413 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 03:55:14,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:00:20,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 04:00:33,393 INFO core: Event loop thread started, running loop forever
2026-08-20 04:00:33,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:00:33,703 INFO core: _init_accounts coroutine started
2026-08-20 04:00:33,704 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:00:33,710 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:05:27,423 INFO core: Event loop thread started, running loop forever
2026-08-20 04:05:27,724 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:05:27,728 INFO core: _init_accounts coroutine started
2026-08-20 04:05:27,730 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:05:27,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:10:47,378 INFO core: Event loop thread started, running loop forever
2026-08-20 04:10:47,682 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:10:47,691 INFO core: _init_accounts coroutine started
2026-08-20 04:10:47,692 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:10:47,703 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:15:11,452 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 04:15:11,453 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 04:15:11,455 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 04:15:11,456 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 04:15:11,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:20:18,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 04:20:18,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 04:20:18,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 04:20:26,472 INFO core: Event loop thread started, running loop forever
2026-08-20 04:20:26,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:20:26,782 INFO core: _init_accounts coroutine started
2026-08-20 04:20:26,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:20:26,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:25:29,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:30:35,443 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 04:30:39,143 INFO core: Event loop thread started, running loop forever
2026-08-20 04:30:39,444 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:30:39,448 INFO core: _init_accounts coroutine started
2026-08-20 04:30:39,450 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:30:39,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:35:17,361 INFO core: Event loop thread started, running loop forever
2026-08-20 04:35:17,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:35:17,669 INFO core: _init_accounts coroutine started
2026-08-20 04:35:17,670 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:35:17,683 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:40:19,975 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 04:40:19,976 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 04:40:19,978 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 04:40:19,979 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:45:26,189 INFO core: Event loop thread started, running loop forever
2026-08-20 04:45:26,491 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:45:26,498 INFO core: _init_accounts coroutine started
2026-08-20 04:45:26,501 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:45:26,505 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:50:32,175 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-20 04:50:32,868 INFO core: Event loop thread started, running loop forever
2026-08-20 04:50:33,170 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 04:50:33,180 INFO core: _init_accounts coroutine started
2026-08-20 04:50:33,182 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 04:50:33,182 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 04:55:27,031 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:00:28,250 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 05:00:28,251 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 05:00:28,255 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:00:28,258 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 05:05:04,829 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:10:10,429 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 05:10:12,112 INFO core: Event loop thread started, running loop forever
2026-08-20 05:10:12,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 05:10:12,418 INFO core: _init_accounts coroutine started
2026-08-20 05:10:12,419 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 05:10:12,427 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:15:18,495 INFO core: Event loop thread started, running loop forever
2026-08-20 05:15:18,796 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 05:15:18,802 INFO core: _init_accounts coroutine started
2026-08-20 05:15:18,802 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 05:15:18,818 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 05:15:18,819 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 05:15:18,821 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 05:15:18,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:20:19,322 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 05:20:19,330 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:25:07,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:30:14,488 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 05:30:14,490 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 05:30:14,490 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 05:30:24,117 INFO core: Event loop thread started, running loop forever
2026-08-20 05:30:24,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 05:30:24,428 INFO core: _init_accounts coroutine started
2026-08-20 05:30:24,429 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 05:30:24,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:35:15,356 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 05:35:15,377 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:40:40,585 INFO core: Event loop thread started, running loop forever
2026-08-20 05:40:40,886 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 05:40:40,889 INFO core: _init_accounts coroutine started
2026-08-20 05:40:40,890 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 05:40:40,905 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:45:20,352 INFO core: Event loop thread started, running loop forever
2026-08-20 05:45:20,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 05:45:20,659 INFO core: _init_accounts coroutine started
2026-08-20 05:45:20,660 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 05:45:20,678 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:45:47,402 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 05:50:27,419 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 05:50:27,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 05:50:27,420 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-20 05:50:27,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 05:50:27,421 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 05:50:27,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 05:50:27,421 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 05:50:27,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 05:50:27,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 05:50:34,295 INFO core: Event loop thread started, running loop forever
2026-08-20 05:50:34,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 05:50:34,610 INFO core: _init_accounts coroutine started
2026-08-20 05:50:34,610 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 05:50:34,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 05:55:26,329 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 05:55:26,331 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 05:55:26,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:00:32,424 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 06:00:32,429 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 06:00:32,430 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 06:00:32,430 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 06:00:32,430 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 06:00:32,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 06:00:37,236 INFO core: Event loop thread started, running loop forever
2026-08-20 06:00:37,538 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 06:00:37,543 INFO core: _init_accounts coroutine started
2026-08-20 06:00:37,545 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 06:00:37,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:05:33,711 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:05:33,714 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 06:05:33,715 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 06:10:24,731 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:15:10,403 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 06:15:10,405 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 06:15:10,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 06:15:10,407 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 06:15:10,407 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 06:15:10,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 06:15:15,823 INFO core: Event loop thread started, running loop forever
2026-08-20 06:15:16,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 06:15:16,129 INFO core: _init_accounts coroutine started
2026-08-20 06:15:16,129 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 06:15:16,138 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:20:05,241 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 06:20:05,242 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 06:20:05,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:25:51,085 INFO core: Event loop thread started, running loop forever
2026-08-20 06:25:51,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 06:25:51,392 INFO core: _init_accounts coroutine started
2026-08-20 06:25:51,395 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 06:25:51,399 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:30:34,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:35:18,427 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:40:31,825 INFO core: Event loop thread started, running loop forever
2026-08-20 06:40:32,126 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 06:40:32,137 INFO core: _init_accounts coroutine started
2026-08-20 06:40:32,138 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 06:40:32,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:45:38,477 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 06:45:44,155 INFO core: Event loop thread started, running loop forever
2026-08-20 06:45:44,456 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 06:45:44,463 INFO core: _init_accounts coroutine started
2026-08-20 06:45:44,464 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 06:45:44,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:50:22,599 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 06:50:22,600 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 06:50:22,602 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 06:50:22,604 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 06:50:22,607 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 06:55:29,422 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 06:55:29,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 06:55:29,425 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 06:55:38,203 INFO core: Event loop thread started, running loop forever
2026-08-20 06:55:38,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 06:55:38,511 INFO core: _init_accounts coroutine started
2026-08-20 06:55:38,512 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 06:55:38,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:00:37,998 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 07:00:38,023 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:05:20,815 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:10:33,198 INFO core: Event loop thread started, running loop forever
2026-08-20 07:10:33,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 07:10:33,504 INFO core: _init_accounts coroutine started
2026-08-20 07:10:33,505 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 07:10:33,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:15:47,397 INFO core: Event loop thread started, running loop forever
2026-08-20 07:15:47,699 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 07:15:47,706 INFO core: _init_accounts coroutine started
2026-08-20 07:15:47,707 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 07:15:47,716 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:20:44,811 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 07:20:44,827 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:25:15,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:30:09,155 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-20 07:30:09,157 INFO core: _init_accounts coroutine started
2026-08-20 07:30:09,159 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 07:30:09,176 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 07:30:09,176 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 07:30:09,207 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 07:30:09,213 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 07:30:09,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:35:34,572 INFO core: Event loop thread started, running loop forever
2026-08-20 07:35:34,875 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 07:35:34,880 INFO core: _init_accounts coroutine started
2026-08-20 07:35:34,882 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 07:35:34,888 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:40:37,291 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 07:40:37,292 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 07:40:37,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:45:47,026 INFO core: Event loop thread started, running loop forever
2026-08-20 07:45:47,329 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 07:45:47,337 INFO core: _init_accounts coroutine started
2026-08-20 07:45:47,338 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 07:45:47,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:50:23,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 07:55:29,427 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 07:55:29,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 07:55:29,428 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-20 07:55:29,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 07:55:29,429 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 07:55:29,429 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 07:55:29,429 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 07:55:29,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 07:55:29,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 07:55:30,483 INFO core: Event loop thread started, running loop forever
2026-08-20 07:55:30,788 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 07:55:30,794 INFO core: _init_accounts coroutine started
2026-08-20 07:55:30,796 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 07:55:30,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:00:12,185 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:05:45,944 INFO core: Event loop thread started, running loop forever
2026-08-20 08:05:46,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 08:05:46,251 INFO core: _init_accounts coroutine started
2026-08-20 08:05:46,252 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:05:46,262 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:10:52,428 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 08:10:52,428 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 08:10:52,429 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-20 08:10:52,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 08:10:52,430 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 08:10:52,430 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 08:10:52,430 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 08:10:52,431 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 08:10:52,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 08:10:57,935 INFO core: Event loop thread started, running loop forever
2026-08-20 08:10:58,236 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 08:10:58,239 INFO core: _init_accounts coroutine started
2026-08-20 08:10:58,239 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:10:58,253 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:15:29,490 INFO core: Event loop thread started, running loop forever
2026-08-20 08:15:29,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 08:15:29,797 INFO core: _init_accounts coroutine started
2026-08-20 08:15:29,797 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:15:29,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:20:36,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 08:20:41,742 INFO core: Event loop thread started, running loop forever
2026-08-20 08:20:42,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 08:20:42,046 INFO core: _init_accounts coroutine started
2026-08-20 08:20:42,048 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:20:42,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:25:48,323 INFO core: Event loop thread started, running loop forever
2026-08-20 08:25:48,312 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 08:25:48,624 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 08:25:48,630 INFO core: _init_accounts coroutine started
2026-08-20 08:25:48,631 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:25:48,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:30:08,372 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 08:30:52,221 INFO core: Event loop thread started, running loop forever
2026-08-20 08:30:52,523 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 08:30:52,527 INFO core: _init_accounts coroutine started
2026-08-20 08:30:52,528 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:30:52,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:35:51,887 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 08:35:51,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:40:41,909 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:45:21,225 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-20 08:45:21,226 INFO core: _init_accounts coroutine started
2026-08-20 08:45:21,226 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:45:21,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:50:28,436 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-20 08:50:45,632 INFO core: Event loop thread started, running loop forever
2026-08-20 08:50:45,934 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 08:50:45,939 INFO core: _init_accounts coroutine started
2026-08-20 08:50:45,940 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 08:50:45,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 08:50:45,952 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 08:50:45,952 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 08:55:11,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 08:55:11,383 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 08:55:11,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:00:47,729 INFO core: Event loop thread started, running loop forever
2026-08-20 09:00:48,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 09:00:48,041 INFO core: _init_accounts coroutine started
2026-08-20 09:00:48,041 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 09:00:48,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:05:43,837 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:10:48,447 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 09:10:48,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:15:13,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:20:20,208 INFO core: Event loop thread started, running loop forever
2026-08-20 09:20:20,509 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 09:20:20,517 INFO core: _init_accounts coroutine started
2026-08-20 09:20:20,517 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 09:20:20,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:25:07,475 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 09:25:07,476 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 09:25:07,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:25:07,479 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 09:30:14,394 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 09:30:14,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 09:30:14,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 09:30:14,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 09:30:48,119 INFO core: Event loop thread started, running loop forever
2026-08-20 09:30:48,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 09:30:48,429 INFO core: _init_accounts coroutine started
2026-08-20 09:30:48,431 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 09:30:48,450 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:35:40,026 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 09:35:40,027 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 09:35:40,034 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 09:35:40,035 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:40:30,889 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 09:40:30,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:45:38,205 INFO core: Event loop thread started, running loop forever
2026-08-20 09:45:38,506 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 09:45:38,513 INFO core: _init_accounts coroutine started
2026-08-20 09:45:38,513 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 09:45:38,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:50:19,010 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 09:50:19,010 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 09:50:19,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 09:50:19,017 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 09:55:20,105 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 09:55:20,110 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:00:27,455 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 10:00:27,455 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 10:00:27,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 10:00:30,593 INFO core: Event loop thread started, running loop forever
2026-08-20 10:00:30,893 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:00:30,898 INFO core: _init_accounts coroutine started
2026-08-20 10:00:30,898 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:00:30,912 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:05:32,898 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 10:05:32,899 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:05:32,899 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 10:10:14,035 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 10:10:14,038 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 10:10:14,043 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:10:14,044 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 10:15:16,134 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:20:09,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:25:18,790 INFO core: Event loop thread started, running loop forever
2026-08-20 10:25:19,091 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:25:19,099 INFO core: _init_accounts coroutine started
2026-08-20 10:25:19,101 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:25:19,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:30:25,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 10:30:48,632 INFO core: Event loop thread started, running loop forever
2026-08-20 10:30:48,933 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:30:48,938 INFO core: _init_accounts coroutine started
2026-08-20 10:30:48,940 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:30:48,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:35:06,669 INFO core: Event loop thread started, running loop forever
2026-08-20 10:35:06,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:35:06,981 INFO core: _init_accounts coroutine started
2026-08-20 10:35:06,981 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:35:06,987 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:35:54,745 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 10:40:37,605 INFO core: Event loop thread started, running loop forever
2026-08-20 10:40:37,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:40:37,912 INFO core: _init_accounts coroutine started
2026-08-20 10:40:37,913 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:40:37,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:45:14,323 INFO core: Event loop thread started, running loop forever
2026-08-20 10:45:14,624 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:45:14,628 INFO core: _init_accounts coroutine started
2026-08-20 10:45:14,628 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:45:14,638 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 10:45:14,638 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 10:45:14,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:45:14,639 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 10:45:14,647 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 10:50:21,674 INFO core: Event loop thread started, running loop forever
2026-08-20 10:50:21,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:50:21,979 INFO core: _init_accounts coroutine started
2026-08-20 10:50:21,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:50:21,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 10:50:21,993 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 10:50:21,993 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 10:50:21,994 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 10:50:21,995 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 10:55:47,086 INFO core: Event loop thread started, running loop forever
2026-08-20 10:55:47,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 10:55:47,392 INFO core: _init_accounts coroutine started
2026-08-20 10:55:47,392 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 10:55:47,401 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:00:13,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:05:19,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 11:05:33,386 INFO core: Event loop thread started, running loop forever
2026-08-20 11:05:33,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 11:05:33,693 INFO core: _init_accounts coroutine started
2026-08-20 11:05:33,695 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 11:05:33,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:10:36,950 INFO core: Event loop thread started, running loop forever
2026-08-20 11:10:37,251 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 11:10:37,256 INFO core: _init_accounts coroutine started
2026-08-20 11:10:37,257 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 11:10:37,267 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:10:40,952 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 11:15:34,131 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 11:15:34,131 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 11:15:34,133 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:20:10,918 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 11:20:10,923 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 11:20:10,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:25:49,139 INFO core: Event loop thread started, running loop forever
2026-08-20 11:25:49,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 11:25:49,446 INFO core: _init_accounts coroutine started
2026-08-20 11:25:49,449 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 11:25:49,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:30:18,104 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:35:20,903 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 11:35:20,903 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 11:35:20,912 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 11:35:20,915 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 11:35:20,917 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:40:12,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:45:05,323 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 11:45:05,323 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 11:45:05,331 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-20 11:45:05,332 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-20 11:45:05,340 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:50:12,429 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 11:50:49,972 INFO core: Event loop thread started, running loop forever
2026-08-20 11:50:50,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 11:50:50,279 INFO core: _init_accounts coroutine started
2026-08-20 11:50:50,281 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 11:50:50,291 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 11:55:06,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:00:12,167 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 12:00:12,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:05:11,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:10:19,664 INFO core: Event loop thread started, running loop forever
2026-08-20 12:10:19,968 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 12:10:19,978 INFO core: _init_accounts coroutine started
2026-08-20 12:10:19,979 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 12:10:20,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:15:26,594 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 12:15:27,481 INFO core: Event loop thread started, running loop forever
2026-08-20 12:15:27,783 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 12:15:27,790 INFO core: _init_accounts coroutine started
2026-08-20 12:15:27,791 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 12:15:27,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:20:34,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 12:20:51,426 INFO core: Event loop thread started, running loop forever
2026-08-20 12:20:51,728 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 12:20:51,734 INFO core: _init_accounts coroutine started
2026-08-20 12:20:51,735 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 12:20:51,754 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:25:34,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:30:42,087 INFO core: Event loop thread started, running loop forever
2026-08-20 12:30:42,388 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 12:30:42,392 INFO core: _init_accounts coroutine started
2026-08-20 12:30:42,394 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 12:30:42,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:35:25,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:40:10,821 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 12:40:10,822 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 12:40:10,825 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 12:40:10,826 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 12:40:10,855 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:45:09,799 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 12:45:09,799 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 12:45:09,809 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:50:15,449 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-20 12:50:15,450 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-20 12:50:34,914 INFO core: Event loop thread started, running loop forever
2026-08-20 12:50:35,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 12:50:35,222 INFO core: _init_accounts coroutine started
2026-08-20 12:50:35,222 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 12:50:35,238 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 12:55:16,499 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 12:55:16,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 12:55:16,503 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 12:55:16,506 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 12:55:16,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:00:06,499 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 13:00:06,500 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 13:00:06,500 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 13:00:25,355 INFO core: Event loop thread started, running loop forever
2026-08-20 13:00:25,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:00:25,662 INFO core: _init_accounts coroutine started
2026-08-20 13:00:25,663 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:00:25,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:05:49,381 INFO core: Event loop thread started, running loop forever
2026-08-20 13:05:49,682 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:05:49,686 INFO core: _init_accounts coroutine started
2026-08-20 13:05:49,686 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:05:49,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:10:05,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:15:11,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 13:15:11,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 13:15:11,395 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-20 13:15:48,334 INFO core: Event loop thread started, running loop forever
2026-08-20 13:15:48,635 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:15:48,642 INFO core: _init_accounts coroutine started
2026-08-20 13:15:48,643 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:15:48,654 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:20:47,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:25:03,861 INFO core: Event loop thread started, running loop forever
2026-08-20 13:25:04,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:25:04,172 INFO core: _init_accounts coroutine started
2026-08-20 13:25:04,172 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:25:04,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:30:34,816 INFO core: Event loop thread started, running loop forever
2026-08-20 13:30:35,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:30:35,121 INFO core: _init_accounts coroutine started
2026-08-20 13:30:35,122 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:30:35,130 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:35:50,953 INFO core: Event loop thread started, running loop forever
2026-08-20 13:35:51,255 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:35:51,258 INFO core: _init_accounts coroutine started
2026-08-20 13:35:51,260 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:35:51,275 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:35:51,280 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 13:40:23,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 13:40:23,452 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 13:40:23,454 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 13:40:23,469 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:45:33,058 INFO core: Event loop thread started, running loop forever
2026-08-20 13:45:33,360 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:45:33,366 INFO core: _init_accounts coroutine started
2026-08-20 13:45:33,367 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:45:33,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:50:40,492 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-20 13:50:50,378 INFO core: Event loop thread started, running loop forever
2026-08-20 13:50:50,679 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 13:50:50,690 INFO core: _init_accounts coroutine started
2026-08-20 13:50:50,690 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 13:50:50,698 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 13:55:20,344 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 13:55:20,364 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:00:50,769 INFO core: Event loop thread started, running loop forever
2026-08-20 14:00:51,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 14:00:51,077 INFO core: _init_accounts coroutine started
2026-08-20 14:00:51,078 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 14:00:51,088 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:05:45,789 INFO core: Event loop thread started, running loop forever
2026-08-20 14:05:46,091 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 14:05:46,097 INFO core: _init_accounts coroutine started
2026-08-20 14:05:46,101 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 14:05:46,116 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:10:21,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:15:38,356 INFO core: Event loop thread started, running loop forever
2026-08-20 14:15:38,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 14:15:38,663 INFO core: _init_accounts coroutine started
2026-08-20 14:15:38,663 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 14:15:38,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:20:11,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:25:12,902 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 14:25:12,902 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 14:25:12,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:25:12,912 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 14:25:12,915 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 14:30:18,509 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 14:30:18,509 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 14:30:18,510 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 14:30:22,003 INFO core: Event loop thread started, running loop forever
2026-08-20 14:30:22,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 14:30:22,310 INFO core: _init_accounts coroutine started
2026-08-20 14:30:22,311 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 14:30:22,325 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:35:08,566 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:40:14,507 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 14:40:14,508 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 14:40:14,508 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-20 14:40:14,509 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 14:40:14,509 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 14:40:14,509 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 14:40:14,510 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 14:40:14,510 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 14:40:14,510 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 14:40:47,940 INFO core: Event loop thread started, running loop forever
2026-08-20 14:40:48,244 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 14:40:48,249 INFO core: _init_accounts coroutine started
2026-08-20 14:40:48,250 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 14:40:48,257 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:45:30,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:45:30,474 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 14:50:35,240 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 14:50:35,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 14:55:13,222 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 14:55:13,225 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:00:32,864 INFO core: Event loop thread started, running loop forever
2026-08-20 15:00:33,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 15:00:33,179 INFO core: _init_accounts coroutine started
2026-08-20 15:00:33,180 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 15:00:33,186 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:05:39,463 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 15:05:49,129 INFO core: Event loop thread started, running loop forever
2026-08-20 15:05:49,431 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 15:05:49,445 INFO core: _init_accounts coroutine started
2026-08-20 15:05:49,446 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 15:05:49,466 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:10:45,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:10:45,256 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 15:15:07,340 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 15:15:07,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 15:15:07,474 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 15:15:07,475 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 15:15:07,475 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 15:15:07,475 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 15:15:07,476 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 15:15:54,200 INFO core: Event loop thread started, running loop forever
2026-08-20 15:15:54,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 15:15:54,508 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:20:27,420 INFO core: _init_accounts coroutine started
2026-08-20 15:20:27,423 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 15:20:27,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 15:20:27,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 15:20:27,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 15:20:27,442 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 15:20:27,447 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:25:33,483 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 15:25:33,490 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 15:25:40,203 INFO core: Event loop thread started, running loop forever
2026-08-20 15:25:40,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 15:25:40,510 INFO core: _init_accounts coroutine started
2026-08-20 15:25:40,510 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 15:25:40,532 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 15:25:40,532 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 15:25:40,534 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 15:25:40,537 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 15:25:40,552 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:30:48,663 INFO core: Event loop thread started, running loop forever
2026-08-20 15:30:48,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 15:30:48,969 INFO core: _init_accounts coroutine started
2026-08-20 15:30:48,970 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 15:30:48,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:35:43,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:40:30,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:45:29,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:50:16,905 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 15:50:16,906 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 15:50:16,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 15:55:22,503 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 15:55:51,887 INFO core: Event loop thread started, running loop forever
2026-08-20 15:55:52,191 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 15:55:52,215 INFO core: _init_accounts coroutine started
2026-08-20 15:55:52,215 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 15:55:52,231 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:00:34,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:05:16,325 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 16:05:16,325 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 16:05:16,328 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:10:23,189 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 16:10:42,136 INFO core: Event loop thread started, running loop forever
2026-08-20 16:10:42,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 16:10:42,445 INFO core: _init_accounts coroutine started
2026-08-20 16:10:42,445 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 16:10:42,456 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:15:12,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:20:08,120 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 16:20:08,120 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 16:20:08,130 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:25:03,424 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 16:25:03,448 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 16:25:03,460 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:30:14,400 INFO core: Event loop thread started, running loop forever
2026-08-20 16:30:14,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 16:30:14,715 INFO core: _init_accounts coroutine started
2026-08-20 16:30:14,715 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 16:30:14,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:35:21,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 16:35:21,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 16:35:21,434 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-20 16:35:21,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 16:35:21,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 16:35:21,436 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 16:35:21,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 16:35:21,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 16:35:21,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 16:35:48,157 INFO core: Event loop thread started, running loop forever
2026-08-20 16:35:48,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 16:35:48,467 INFO core: _init_accounts coroutine started
2026-08-20 16:35:48,468 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 16:35:48,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:40:11,342 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 16:40:11,343 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 16:40:11,348 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 16:40:11,353 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 16:40:11,367 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 16:40:11,368 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 16:40:11,372 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-20 16:40:11,374 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-20 16:40:11,377 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:45:54,167 INFO core: Event loop thread started, running loop forever
2026-08-20 16:45:54,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 16:45:54,473 INFO core: _init_accounts coroutine started
2026-08-20 16:45:54,477 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 16:45:54,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:50:08,000 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 16:50:08,001 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 16:50:08,023 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 16:50:08,034 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 16:50:08,067 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 16:50:08,067 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 16:50:08,075 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-20 16:50:08,077 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-20 16:50:08,077 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 16:55:11,121 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 16:55:11,122 WARNING core: Account 2: connect timed out after 35s
2026-08-20 16:55:11,122 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-20 16:55:11,123 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-20 16:55:11,124 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-20 16:55:11,125 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-20 16:55:11,126 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-20 16:55:11,149 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:00:18,429 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 17:00:18,430 WARNING core: Account 2: connect timed out after 35s
2026-08-20 17:00:18,430 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-20 17:00:18,431 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-20 17:00:18,431 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-20 17:00:18,433 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-20 17:00:18,433 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-20 17:00:51,283 INFO core: Event loop thread started, running loop forever
2026-08-20 17:00:51,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 17:00:51,590 INFO core: _init_accounts coroutine started
2026-08-20 17:00:51,592 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 17:00:51,603 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:05:47,813 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 17:05:47,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:10:22,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:15:43,785 INFO core: Event loop thread started, running loop forever
2026-08-20 17:15:44,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 17:15:44,094 INFO core: _init_accounts coroutine started
2026-08-20 17:15:44,094 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 17:15:44,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:20:37,192 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 17:20:37,192 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 17:20:37,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:25:43,022 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 17:25:43,023 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 17:25:43,028 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:30:19,336 INFO core: Event loop thread started, running loop forever
2026-08-20 17:30:19,643 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 17:30:19,648 INFO core: _init_accounts coroutine started
2026-08-20 17:30:19,648 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 17:30:19,678 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:35:20,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:40:29,107 INFO core: Event loop thread started, running loop forever
2026-08-20 17:40:29,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 17:40:29,421 INFO core: _init_accounts coroutine started
2026-08-20 17:40:29,421 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 17:40:29,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:45:52,164 INFO core: Event loop thread started, running loop forever
2026-08-20 17:45:52,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 17:45:52,471 INFO core: _init_accounts coroutine started
2026-08-20 17:45:52,472 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 17:45:52,484 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:50:47,812 INFO core: Event loop thread started, running loop forever
2026-08-20 17:50:48,114 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 17:50:48,119 INFO core: _init_accounts coroutine started
2026-08-20 17:50:48,119 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 17:50:48,127 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:50:59,823 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 17:55:26,556 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 17:55:26,557 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 17:55:26,560 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 17:55:26,560 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 17:55:26,563 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 18:00:15,888 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:05:04,030 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:10:06,528 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 18:10:06,529 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 18:10:06,534 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-20 18:10:06,535 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-20 18:10:06,541 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:15:10,772 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 18:15:10,773 WARNING core: Account 2: connect timed out after 35s
2026-08-20 18:15:10,773 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-20 18:15:10,774 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-20 18:15:10,774 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-20 18:15:10,775 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-20 18:15:10,776 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-20 18:15:10,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:20:16,442 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 18:20:16,443 WARNING core: Account 2: connect timed out after 35s
2026-08-20 18:20:16,444 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-20 18:20:16,444 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-20 18:20:16,445 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-20 18:20:16,446 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-20 18:20:16,446 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-20 18:20:22,100 INFO core: Event loop thread started, running loop forever
2026-08-20 18:20:22,403 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 18:20:22,410 INFO core: _init_accounts coroutine started
2026-08-20 18:20:22,410 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 18:20:22,425 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:25:08,861 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 18:25:08,861 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 18:25:08,863 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 18:25:08,863 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:25:08,864 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 18:25:08,876 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 18:25:08,877 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 18:30:38,613 INFO core: Event loop thread started, running loop forever
2026-08-20 18:30:38,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 18:30:38,919 INFO core: _init_accounts coroutine started
2026-08-20 18:30:38,921 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 18:30:38,932 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:35:24,652 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:40:22,491 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 18:40:22,492 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 18:40:22,492 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:45:12,383 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 18:45:12,391 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 18:45:12,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 18:45:12,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:45:12,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 18:50:14,299 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 18:55:43,909 INFO core: Event loop thread started, running loop forever
2026-08-20 18:55:44,210 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 18:55:44,218 INFO core: _init_accounts coroutine started
2026-08-20 18:55:44,220 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 18:55:44,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:00:13,606 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 19:00:13,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:05:52,501 INFO core: Event loop thread started, running loop forever
2026-08-20 19:05:52,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 19:05:52,807 INFO core: _init_accounts coroutine started
2026-08-20 19:05:52,809 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 19:05:52,817 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:10:09,806 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 19:10:09,821 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:15:34,956 INFO core: Event loop thread started, running loop forever
2026-08-20 19:15:35,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 19:15:35,263 INFO core: _init_accounts coroutine started
2026-08-20 19:15:35,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 19:15:35,275 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 19:15:35,275 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 19:15:35,275 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:20:05,629 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:20:05,631 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 19:25:35,029 INFO core: Event loop thread started, running loop forever
2026-08-20 19:25:35,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 19:25:35,338 INFO core: _init_accounts coroutine started
2026-08-20 19:25:35,339 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 19:25:35,347 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:30:52,721 INFO core: Event loop thread started, running loop forever
2026-08-20 19:30:53,022 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 19:30:53,027 INFO core: _init_accounts coroutine started
2026-08-20 19:30:53,028 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 19:30:53,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:30:53,051 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 19:35:26,700 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 19:35:26,707 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 19:35:26,707 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:40:32,361 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 19:40:37,228 INFO core: Event loop thread started, running loop forever
2026-08-20 19:40:37,529 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 19:40:37,536 INFO core: _init_accounts coroutine started
2026-08-20 19:40:37,537 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 19:40:37,545 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:45:15,686 INFO core: Event loop thread started, running loop forever
2026-08-20 19:45:15,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 19:45:15,991 INFO core: _init_accounts coroutine started
2026-08-20 19:45:15,992 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 19:45:15,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:50:10,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 19:55:37,236 INFO core: Event loop thread started, running loop forever
2026-08-20 19:55:37,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 19:55:37,542 INFO core: _init_accounts coroutine started
2026-08-20 19:55:37,542 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 19:55:37,550 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:00:50,603 INFO core: Event loop thread started, running loop forever
2026-08-20 20:00:50,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 20:00:50,918 INFO core: _init_accounts coroutine started
2026-08-20 20:00:50,918 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 20:00:50,927 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:05:23,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:10:29,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 20:10:51,637 INFO core: Event loop thread started, running loop forever
2026-08-20 20:10:51,938 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 20:10:51,943 INFO core: _init_accounts coroutine started
2026-08-20 20:10:51,944 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 20:10:51,952 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:15:28,475 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:15:28,477 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 20:15:28,477 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 20:20:27,350 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 20:20:27,362 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 20:20:27,366 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:25:13,872 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:30:19,466 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 20:30:19,467 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 20:30:19,467 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 20:30:23,664 INFO core: Event loop thread started, running loop forever
2026-08-20 20:30:23,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 20:30:23,972 INFO core: _init_accounts coroutine started
2026-08-20 20:30:23,973 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 20:30:23,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:35:12,648 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 20:35:12,648 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 20:35:12,651 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 20:35:12,653 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:40:18,273 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 20:40:18,273 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 20:40:18,275 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 20:40:18,275 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 20:40:39,773 INFO core: Event loop thread started, running loop forever
2026-08-20 20:40:40,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 20:40:40,078 INFO core: _init_accounts coroutine started
2026-08-20 20:40:40,079 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 20:40:40,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:45:13,375 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:50:20,411 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 20:50:36,490 INFO core: Event loop thread started, running loop forever
2026-08-20 20:50:36,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 20:50:36,796 INFO core: _init_accounts coroutine started
2026-08-20 20:50:36,797 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 20:50:36,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 20:55:17,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:00:07,854 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 21:00:07,855 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 21:00:07,856 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:05:10,624 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 21:05:10,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:05:10,629 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 21:10:16,276 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 21:10:16,277 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 21:10:16,277 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 21:10:22,957 INFO core: Event loop thread started, running loop forever
2026-08-20 21:10:23,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 21:10:23,264 INFO core: _init_accounts coroutine started
2026-08-20 21:10:23,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 21:10:23,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:15:42,862 INFO core: Event loop thread started, running loop forever
2026-08-20 21:15:43,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 21:15:43,169 INFO core: _init_accounts coroutine started
2026-08-20 21:15:43,169 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 21:15:43,177 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:20:49,416 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-20 21:20:49,733 INFO core: Event loop thread started, running loop forever
2026-08-20 21:20:50,034 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 21:20:50,048 INFO core: _init_accounts coroutine started
2026-08-20 21:20:50,048 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 21:20:50,070 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:25:30,640 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 21:25:30,641 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 21:25:30,649 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:25:30,649 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 21:25:30,653 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 21:30:45,969 INFO core: Event loop thread started, running loop forever
2026-08-20 21:30:46,270 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 21:30:46,275 INFO core: _init_accounts coroutine started
2026-08-20 21:30:46,275 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 21:30:46,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:35:43,110 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 21:35:43,115 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:35:43,117 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 21:40:10,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:45:12,517 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 21:45:12,530 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 21:45:12,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:50:11,051 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 21:50:11,051 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 21:50:11,058 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-20 21:50:11,060 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-20 21:50:11,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 21:55:16,512 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 21:55:16,514 WARNING core: Account 2: connect timed out after 35s
2026-08-20 21:55:16,515 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-20 21:55:16,516 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-20 21:55:16,517 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-20 21:55:16,519 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-20 21:55:16,520 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-20 21:55:16,532 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:00:04,369 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-20 22:00:04,370 WARNING core: Account 2: connect timed out after 35s
2026-08-20 22:00:04,371 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-20 22:00:04,371 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-20 22:00:04,371 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-20 22:00:04,372 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-20 22:00:04,373 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-20 22:00:50,129 INFO core: Event loop thread started, running loop forever
2026-08-20 22:00:50,430 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 22:00:50,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:05:31,279 INFO core: _init_accounts coroutine started
2026-08-20 22:05:31,280 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 22:05:31,296 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 22:05:31,296 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 22:05:31,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 22:05:31,298 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 22:05:31,300 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:10:15,838 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:15:37,244 INFO core: Event loop thread started, running loop forever
2026-08-20 22:15:37,549 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 22:15:37,556 INFO core: _init_accounts coroutine started
2026-08-20 22:15:37,556 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 22:15:37,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:20:23,106 INFO core: Event loop thread started, running loop forever
2026-08-20 22:20:23,407 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 22:20:23,412 INFO core: _init_accounts coroutine started
2026-08-20 22:20:23,413 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 22:20:23,423 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:25:08,221 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 22:25:08,222 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 22:25:08,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:30:15,444 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 22:30:15,444 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-20 22:30:15,445 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 22:30:15,445 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-20 22:30:15,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 22:30:15,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 22:30:18,605 INFO core: Event loop thread started, running loop forever
2026-08-20 22:30:18,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 22:30:18,913 INFO core: _init_accounts coroutine started
2026-08-20 22:30:18,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 22:30:18,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:35:04,908 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 22:35:04,911 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 22:35:04,913 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 22:35:04,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:40:44,041 INFO core: Event loop thread started, running loop forever
2026-08-20 22:40:44,342 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 22:40:44,349 INFO core: _init_accounts coroutine started
2026-08-20 22:40:44,350 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 22:40:44,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:45:24,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:50:30,459 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-20 22:50:50,612 INFO core: Event loop thread started, running loop forever
2026-08-20 22:50:50,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 22:50:50,918 INFO core: _init_accounts coroutine started
2026-08-20 22:50:50,919 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 22:50:50,927 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:55:51,134 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 22:55:51,135 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 22:55:51,137 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 22:55:51,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 22:55:51,140 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 23:00:48,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:05:25,151 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:10:35,613 INFO core: Event loop thread started, running loop forever
2026-08-20 23:10:35,917 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 23:10:35,926 INFO core: _init_accounts coroutine started
2026-08-20 23:10:35,927 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 23:10:35,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:15:32,464 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-20 23:15:32,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:20:38,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:25:31,757 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-20 23:25:31,758 INFO core: _init_accounts coroutine started
2026-08-20 23:25:31,759 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 23:25:31,766 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:25:31,768 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 23:25:31,769 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 23:25:31,770 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 23:25:31,771 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 23:30:16,270 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:35:04,415 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-20 23:35:04,415 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-20 23:35:04,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:40:39,134 INFO core: Event loop thread started, running loop forever
2026-08-20 23:40:39,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 23:40:39,440 INFO core: _init_accounts coroutine started
2026-08-20 23:40:39,440 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 23:40:39,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:45:08,734 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 23:45:08,735 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 23:45:08,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:45:08,738 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 23:50:44,916 INFO core: Event loop thread started, running loop forever
2026-08-20 23:50:45,217 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-20 23:50:45,223 INFO core: _init_accounts coroutine started
2026-08-20 23:50:45,225 INFO core: _init_accounts_inner: starting DB migrations
2026-08-20 23:50:45,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-20 23:55:27,076 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-20 23:55:27,076 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-20 23:55:27,078 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-20 23:55:27,091 INFO core: _init_accounts_inner: reloading LLM config
2026-08-20 23:55:27,091 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:00:42,727 INFO core: Event loop thread started, running loop forever
2026-08-21 00:00:43,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:00:43,032 INFO core: _init_accounts coroutine started
2026-08-21 00:00:43,033 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:00:43,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:05:31,351 INFO core: Event loop thread started, running loop forever
2026-08-21 00:05:31,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:05:31,660 INFO core: _init_accounts coroutine started
2026-08-21 00:05:31,660 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:05:31,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:10:36,470 INFO core: Event loop thread started, running loop forever
2026-08-21 00:10:36,772 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:10:36,778 INFO core: _init_accounts coroutine started
2026-08-21 00:10:36,780 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:10:36,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:10:38,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 00:10:38,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 00:10:38,479 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-21 00:15:46,797 INFO core: Event loop thread started, running loop forever
2026-08-21 00:15:47,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:15:47,101 INFO core: _init_accounts coroutine started
2026-08-21 00:15:47,102 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:15:47,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:20:11,727 INFO core: Event loop thread started, running loop forever
2026-08-21 00:20:12,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:20:12,034 INFO core: _init_accounts coroutine started
2026-08-21 00:20:12,035 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:20:12,047 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:20:54,775 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 00:25:36,925 INFO core: Event loop thread started, running loop forever
2026-08-21 00:25:37,226 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:25:37,232 INFO core: _init_accounts coroutine started
2026-08-21 00:25:37,233 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:25:37,240 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:30:30,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:35:37,436 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 00:35:37,437 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 00:35:37,437 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-21 00:35:37,438 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 00:35:37,438 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-21 00:35:37,439 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 00:35:37,439 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-21 00:35:37,439 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 00:35:37,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 00:35:49,301 INFO core: Event loop thread started, running loop forever
2026-08-21 00:35:49,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:35:49,610 INFO core: _init_accounts coroutine started
2026-08-21 00:35:49,611 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:35:49,625 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:35:49,626 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 00:35:49,627 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 00:40:13,300 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:45:15,103 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 00:45:15,104 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 00:45:15,108 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 00:45:15,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:50:05,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 00:55:12,450 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 00:55:12,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 00:55:12,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 00:55:19,581 INFO core: Event loop thread started, running loop forever
2026-08-21 00:55:19,883 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 00:55:19,893 INFO core: _init_accounts coroutine started
2026-08-21 00:55:19,893 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 00:55:19,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:00:25,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 01:00:47,313 INFO core: Event loop thread started, running loop forever
2026-08-21 01:00:47,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 01:00:47,618 INFO core: _init_accounts coroutine started
2026-08-21 01:00:47,619 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 01:00:47,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:05:22,587 INFO core: Event loop thread started, running loop forever
2026-08-21 01:05:22,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 01:05:22,896 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:05:22,897 INFO core: _init_accounts coroutine started
2026-08-21 01:10:29,373 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 01:10:29,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 01:10:51,931 INFO core: Event loop thread started, running loop forever
2026-08-21 01:10:52,232 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 01:10:52,238 INFO core: _init_accounts coroutine started
2026-08-21 01:10:52,238 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 01:10:52,245 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:15:22,404 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:20:49,623 INFO core: Event loop thread started, running loop forever
2026-08-21 01:20:49,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 01:20:49,929 INFO core: _init_accounts coroutine started
2026-08-21 01:20:49,931 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 01:20:49,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:25:31,756 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 01:25:31,757 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:25:31,757 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 01:30:16,715 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 01:30:16,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:35:22,419 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 01:35:22,420 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-21 01:35:22,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 01:35:22,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 01:35:39,424 INFO core: Event loop thread started, running loop forever
2026-08-21 01:35:39,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 01:35:39,730 INFO core: _init_accounts coroutine started
2026-08-21 01:35:39,730 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 01:35:39,747 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:35:39,749 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 01:35:39,752 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 01:40:27,855 INFO core: Event loop thread started, running loop forever
2026-08-21 01:40:28,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 01:40:28,160 INFO core: _init_accounts coroutine started
2026-08-21 01:40:28,161 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 01:40:28,172 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:40:28,174 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-21 01:40:46,873 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-21 01:40:46,875 INFO core: _init_accounts_inner: running ensure_pair_schema
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-21 01:45:52,794 INFO core: Event loop thread started, running loop forever
2026-08-21 01:45:53,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 01:45:53,100 INFO core: _init_accounts coroutine started
2026-08-21 01:45:53,100 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 01:45:53,110 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:50:32,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 01:55:07,442 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 01:55:07,443 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 01:55:07,447 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:00:09,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 02:00:09,113 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 02:00:09,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:05:27,878 INFO core: Event loop thread started, running loop forever
2026-08-21 02:05:28,179 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 02:05:28,185 INFO core: _init_accounts coroutine started
2026-08-21 02:05:28,185 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 02:05:28,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:10:07,713 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:15:50,322 INFO core: Event loop thread started, running loop forever
2026-08-21 02:15:50,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 02:15:50,627 INFO core: _init_accounts coroutine started
2026-08-21 02:15:50,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 02:15:50,637 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:20:41,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:25:19,164 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 02:25:19,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:30:26,687 INFO core: Event loop thread started, running loop forever
2026-08-21 02:30:26,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 02:30:26,996 INFO core: _init_accounts coroutine started
2026-08-21 02:30:26,996 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 02:30:27,009 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:35:29,128 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 02:35:29,157 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:40:35,859 INFO core: Event loop thread started, running loop forever
2026-08-21 02:40:36,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 02:40:36,172 INFO core: _init_accounts coroutine started
2026-08-21 02:40:36,173 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 02:40:36,175 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:45:39,331 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:50:36,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 02:55:22,475 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:00:29,295 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 03:00:29,295 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 03:00:29,296 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-21 03:00:29,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 03:00:29,297 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-21 03:00:29,297 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 03:00:29,297 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-21 03:00:29,297 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 03:00:29,298 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 03:00:45,147 INFO core: Event loop thread started, running loop forever
2026-08-21 03:00:45,452 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 03:00:45,457 INFO core: _init_accounts coroutine started
2026-08-21 03:00:45,459 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 03:00:45,469 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:05:06,631 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:10:55,711 INFO core: Event loop thread started, running loop forever
2026-08-21 03:10:56,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 03:10:56,020 INFO core: _init_accounts coroutine started
2026-08-21 03:10:56,020 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 03:10:56,028 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:15:45,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:20:32,230 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 03:20:32,231 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 03:20:32,233 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 03:20:32,236 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 03:20:32,239 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:25:07,951 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:30:46,489 INFO core: Event loop thread started, running loop forever
2026-08-21 03:30:46,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 03:30:46,796 INFO core: _init_accounts coroutine started
2026-08-21 03:30:46,796 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 03:30:46,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:35:18,060 INFO core: Event loop thread started, running loop forever
2026-08-21 03:35:18,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 03:35:18,369 INFO core: _init_accounts coroutine started
2026-08-21 03:35:18,369 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 03:35:18,373 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:40:20,764 INFO core: Event loop thread started, running loop forever
2026-08-21 03:40:21,065 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 03:40:21,072 INFO core: _init_accounts coroutine started
2026-08-21 03:40:21,072 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 03:40:21,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:45:20,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:50:27,415 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 03:50:32,144 INFO core: Event loop thread started, running loop forever
2026-08-21 03:50:32,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 03:50:32,450 INFO core: _init_accounts coroutine started
2026-08-21 03:50:32,451 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 03:50:32,462 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 03:50:32,462 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 03:50:32,463 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:55:34,928 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 03:55:34,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 03:55:34,937 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 04:00:33,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:05:53,866 INFO core: Event loop thread started, running loop forever
2026-08-21 04:05:54,176 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 04:05:54,181 INFO core: _init_accounts coroutine started
2026-08-21 04:05:54,181 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 04:05:54,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:10:19,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:15:35,698 INFO core: Event loop thread started, running loop forever
2026-08-21 04:15:35,999 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 04:15:36,006 INFO core: _init_accounts coroutine started
2026-08-21 04:15:36,008 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 04:15:36,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:15:36,027 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 04:15:36,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 04:20:10,523 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 04:20:10,529 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 04:20:10,574 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 04:20:10,575 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 04:20:10,584 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-21 04:20:10,586 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-21 04:20:10,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:25:17,439 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 04:25:17,447 WARNING core: Account 2: connect timed out after 35s
2026-08-21 04:25:17,448 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-21 04:25:41,222 INFO core: Event loop thread started, running loop forever
2026-08-21 04:25:41,523 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 04:25:41,531 INFO core: _init_accounts coroutine started
2026-08-21 04:25:41,532 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 04:25:41,555 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 04:25:41,556 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 04:25:41,560 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:25:41,560 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 04:30:29,821 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 04:30:29,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:35:16,104 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:40:26,477 INFO core: Event loop thread started, running loop forever
2026-08-21 04:40:26,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 04:40:26,787 INFO core: _init_accounts coroutine started
2026-08-21 04:40:26,787 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 04:40:26,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:45:05,597 INFO core: Event loop thread started, running loop forever
2026-08-21 04:45:05,899 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 04:45:05,907 INFO core: _init_accounts coroutine started
2026-08-21 04:45:05,908 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 04:45:05,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:45:32,651 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 04:50:12,522 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 04:50:48,711 INFO core: Event loop thread started, running loop forever
2026-08-21 04:50:49,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 04:50:49,024 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 04:55:32,685 INFO core: _init_accounts coroutine started
2026-08-21 04:55:32,687 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 04:55:32,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:00:16,533 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 05:00:16,554 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:05:48,745 INFO core: Event loop thread started, running loop forever
2026-08-21 05:05:49,046 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 05:05:49,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:10:15,145 INFO core: _init_accounts coroutine started
2026-08-21 05:10:15,146 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 05:10:15,157 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 05:10:15,157 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 05:10:15,160 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 05:10:15,163 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 05:10:15,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:15:22,501 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 05:15:22,502 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 05:15:22,502 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 05:15:48,090 INFO core: Event loop thread started, running loop forever
2026-08-21 05:15:48,392 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 05:15:48,397 INFO core: _init_accounts coroutine started
2026-08-21 05:15:48,398 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 05:15:48,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:20:35,588 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 05:20:35,589 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 05:20:35,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:25:17,738 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 05:25:17,759 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:30:39,672 INFO core: Event loop thread started, running loop forever
2026-08-21 05:30:39,973 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 05:30:39,977 INFO core: _init_accounts coroutine started
2026-08-21 05:30:39,978 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 05:30:39,988 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:30:39,989 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 05:30:39,989 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 05:35:40,859 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 05:35:40,865 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 05:35:40,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:40:47,414 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 05:40:49,438 INFO core: Event loop thread started, running loop forever
2026-08-21 05:40:49,740 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 05:40:49,748 INFO core: _init_accounts coroutine started
2026-08-21 05:40:49,748 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 05:40:49,757 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:45:55,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:50:30,862 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 05:50:30,862 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 05:50:30,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:50:30,868 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 05:55:23,806 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 05:55:23,822 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 05:55:23,845 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 05:55:23,846 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 05:55:23,858 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-21 05:55:23,861 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-21 06:00:29,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 06:00:29,416 WARNING core: Account 2: connect timed out after 35s
2026-08-21 06:00:29,417 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-21 06:00:29,417 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-21 06:00:29,418 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-21 06:00:29,419 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-21 06:00:29,420 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-21 06:00:50,762 INFO core: Event loop thread started, running loop forever
2026-08-21 06:00:51,063 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 06:00:51,068 INFO core: _init_accounts coroutine started
2026-08-21 06:00:51,068 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 06:00:51,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:00:51,099 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 06:05:46,304 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 06:05:46,321 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:10:39,788 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 06:10:39,793 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 06:10:39,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:15:08,373 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 06:15:08,374 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 06:15:08,374 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 06:15:32,020 INFO core: Event loop thread started, running loop forever
2026-08-21 06:15:32,321 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 06:15:32,326 INFO core: _init_accounts coroutine started
2026-08-21 06:15:32,326 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 06:15:32,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:20:35,033 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:25:05,783 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 06:25:05,785 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 06:25:05,791 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 06:25:05,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:25:05,795 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 06:30:12,433 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-21 06:30:42,434 INFO core: Event loop thread started, running loop forever
2026-08-21 06:30:42,735 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 06:30:42,740 INFO core: _init_accounts coroutine started
2026-08-21 06:30:42,740 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 06:30:42,753 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:35:47,167 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 06:35:47,168 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 06:35:47,183 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 06:35:47,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:35:47,188 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 06:40:17,712 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:45:25,330 INFO core: Event loop thread started, running loop forever
2026-08-21 06:45:25,631 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 06:45:25,635 INFO core: _init_accounts coroutine started
2026-08-21 06:45:25,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 06:45:25,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:50:24,842 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 06:55:11,261 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 06:55:11,262 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 06:55:11,274 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 06:55:11,276 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 06:55:11,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:00:18,398 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 07:00:18,398 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 07:00:18,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 07:00:33,874 INFO core: Event loop thread started, running loop forever
2026-08-21 07:00:34,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 07:00:34,180 INFO core: _init_accounts coroutine started
2026-08-21 07:00:34,181 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 07:00:34,187 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:05:04,928 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:10:25,291 INFO core: Event loop thread started, running loop forever
2026-08-21 07:10:25,594 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 07:10:25,601 INFO core: _init_accounts coroutine started
2026-08-21 07:10:25,601 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 07:10:25,620 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:15:32,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 07:15:53,404 INFO core: Event loop thread started, running loop forever
2026-08-21 07:15:53,704 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 07:15:53,711 INFO core: _init_accounts coroutine started
2026-08-21 07:15:53,711 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 07:15:53,729 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:20:08,093 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:25:27,336 INFO core: Event loop thread started, running loop forever
2026-08-21 07:25:27,644 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 07:25:27,648 INFO core: _init_accounts coroutine started
2026-08-21 07:25:27,649 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 07:25:27,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:30:22,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:35:41,256 INFO core: Event loop thread started, running loop forever
2026-08-21 07:35:41,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 07:35:41,561 INFO core: _init_accounts coroutine started
2026-08-21 07:35:41,563 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 07:35:41,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:40:17,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:45:24,413 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-21 07:45:43,220 INFO core: Event loop thread started, running loop forever
2026-08-21 07:45:43,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 07:45:43,526 INFO core: _init_accounts coroutine started
2026-08-21 07:45:43,527 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 07:45:43,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:50:09,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 07:55:12,172 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:00:06,546 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 08:00:06,546 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 08:00:06,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:00:06,594 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 08:05:12,472 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 08:05:12,473 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-21 08:05:12,474 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 08:05:12,474 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 08:05:53,317 INFO core: Event loop thread started, running loop forever
2026-08-21 08:05:53,618 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 08:05:53,625 INFO core: _init_accounts coroutine started
2026-08-21 08:05:53,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 08:05:53,637 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:10:31,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:15:37,426 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 08:15:49,877 INFO core: Event loop thread started, running loop forever
2026-08-21 08:15:50,179 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 08:15:50,184 INFO core: _init_accounts coroutine started
2026-08-21 08:15:50,184 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 08:15:50,192 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:20:28,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:20:28,479 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 08:20:28,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 08:25:11,039 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 08:25:11,047 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:30:56,833 INFO core: Event loop thread started, running loop forever
2026-08-21 08:30:57,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 08:30:57,140 INFO core: _init_accounts coroutine started
2026-08-21 08:30:57,142 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 08:30:57,146 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:35:18,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 08:35:18,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:35:18,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 08:40:44,902 INFO core: Event loop thread started, running loop forever
2026-08-21 08:40:45,205 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 08:40:45,208 INFO core: _init_accounts coroutine started
2026-08-21 08:40:45,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 08:40:45,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:45:54,122 INFO core: Event loop thread started, running loop forever
2026-08-21 08:45:54,423 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 08:45:54,430 INFO core: _init_accounts coroutine started
2026-08-21 08:45:54,431 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 08:45:54,439 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:50:49,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 08:55:44,235 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 08:55:44,235 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 08:55:44,238 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 08:55:44,239 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 08:55:44,250 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 08:55:44,251 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 08:55:44,256 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-21 08:55:44,257 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-21 08:55:44,263 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:00:42,265 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 09:00:42,266 WARNING core: Account 2: connect timed out after 35s
2026-08-21 09:00:42,267 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-21 09:00:42,267 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-21 09:00:42,269 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-21 09:00:42,270 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-21 09:00:42,271 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-21 09:00:42,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:05:34,827 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 09:05:34,828 WARNING core: Account 2: connect timed out after 35s
2026-08-21 09:05:34,828 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-21 09:05:34,828 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-21 09:05:34,829 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-21 09:05:34,830 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-21 09:05:34,830 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-21 09:05:34,835 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:10:32,305 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 09:10:32,305 WARNING core: Account 2: connect timed out after 35s
2026-08-21 09:10:32,306 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-21 09:10:32,306 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-21 09:10:32,307 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-21 09:10:32,308 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-21 09:10:32,308 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-21 09:10:32,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:15:05,275 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 09:15:05,276 WARNING core: Account 2: connect timed out after 35s
2026-08-21 09:15:05,276 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-21 09:15:05,276 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-21 09:15:05,277 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-21 09:15:05,278 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-21 09:15:05,278 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-21 09:15:05,321 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:20:21,445 INFO core: Event loop thread started, running loop forever
2026-08-21 09:20:21,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 09:20:21,758 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:25:06,823 INFO core: _init_accounts coroutine started
2026-08-21 09:25:06,824 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 09:25:06,835 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:30:25,379 INFO core: Event loop thread started, running loop forever
2026-08-21 09:30:25,680 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 09:30:25,684 INFO core: _init_accounts coroutine started
2026-08-21 09:30:25,685 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 09:30:25,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:35:10,623 INFO core: Event loop thread started, running loop forever
2026-08-21 09:35:10,926 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 09:35:10,931 INFO core: _init_accounts coroutine started
2026-08-21 09:35:10,931 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 09:35:10,939 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:40:09,905 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:45:15,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 09:45:25,544 INFO core: Event loop thread started, running loop forever
2026-08-21 09:45:25,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 09:45:25,849 INFO core: _init_accounts coroutine started
2026-08-21 09:45:25,850 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 09:45:25,859 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:50:43,069 INFO core: Event loop thread started, running loop forever
2026-08-21 09:50:43,370 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 09:50:43,375 INFO core: _init_accounts coroutine started
2026-08-21 09:50:43,376 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 09:50:43,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 09:55:06,631 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:00:13,374 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 10:00:41,458 INFO core: Event loop thread started, running loop forever
2026-08-21 10:00:41,760 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 10:00:41,774 INFO core: _init_accounts coroutine started
2026-08-21 10:00:41,775 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 10:00:41,779 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:05:19,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:05:19,304 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 10:05:19,304 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 10:10:26,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 10:10:28,832 INFO core: Event loop thread started, running loop forever
2026-08-21 10:10:29,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 10:10:29,142 INFO core: _init_accounts coroutine started
2026-08-21 10:10:29,142 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 10:10:29,394 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:15:20,119 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:20:27,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 10:20:27,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 10:20:27,418 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-21 10:20:27,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 10:20:27,420 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-21 10:20:27,420 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 10:20:27,420 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-21 10:20:27,420 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 10:20:27,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 10:20:45,743 INFO core: Event loop thread started, running loop forever
2026-08-21 10:20:46,046 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 10:20:46,058 INFO core: _init_accounts coroutine started
2026-08-21 10:20:46,059 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 10:20:46,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:25:41,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:25:41,851 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 10:25:41,852 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 10:30:18,322 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 10:30:18,328 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 10:30:18,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:35:15,431 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 10:35:15,433 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:35:15,435 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 10:40:22,394 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-21 10:40:41,510 INFO core: Event loop thread started, running loop forever
2026-08-21 10:40:41,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 10:40:41,822 INFO core: _init_accounts coroutine started
2026-08-21 10:40:41,822 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 10:40:41,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:45:09,336 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 10:45:48,940 INFO core: Event loop thread started, running loop forever
2026-08-21 10:45:49,241 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 10:45:49,245 INFO core: _init_accounts coroutine started
2026-08-21 10:45:49,245 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 10:45:49,251 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:50:21,200 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 10:50:21,219 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 10:55:17,686 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:00:07,737 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-21 11:00:07,738 INFO core: _init_accounts coroutine started
2026-08-21 11:00:07,738 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 11:00:07,751 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 11:00:07,752 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 11:00:07,754 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:00:07,755 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 11:05:38,658 INFO core: Event loop thread started, running loop forever
2026-08-21 11:05:38,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 11:05:38,963 INFO core: _init_accounts coroutine started
2026-08-21 11:05:38,963 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 11:05:38,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:10:35,208 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 11:10:35,209 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 11:10:35,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:15:26,959 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 11:15:26,964 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:20:16,582 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 11:20:16,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:25:31,665 INFO core: Event loop thread started, running loop forever
2026-08-21 11:25:31,972 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 11:25:31,977 INFO core: _init_accounts coroutine started
2026-08-21 11:25:31,979 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 11:25:31,997 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 11:25:31,998 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 11:25:31,999 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 11:25:31,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:25:32,004 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 11:30:49,466 INFO core: Event loop thread started, running loop forever
2026-08-21 11:30:49,768 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 11:30:49,779 INFO core: _init_accounts coroutine started
2026-08-21 11:30:49,779 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 11:30:49,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:30:49,815 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 11:35:24,998 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 11:35:25,009 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:40:05,123 INFO core: Event loop thread started, running loop forever
2026-08-21 11:40:05,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 11:40:05,429 INFO core: _init_accounts coroutine started
2026-08-21 11:40:05,430 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 11:40:05,439 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:45:25,459 INFO core: Event loop thread started, running loop forever
2026-08-21 11:45:25,760 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 11:45:25,764 INFO core: _init_accounts coroutine started
2026-08-21 11:45:25,765 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 11:45:25,774 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:50:32,507 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 11:50:46,243 INFO core: Event loop thread started, running loop forever
2026-08-21 11:50:46,545 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 11:50:46,550 INFO core: _init_accounts coroutine started
2026-08-21 11:50:46,551 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 11:50:46,569 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 11:55:51,312 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:00:17,507 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 12:00:17,508 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 12:00:17,516 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 12:00:17,525 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 12:00:17,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:05:49,842 INFO core: Event loop thread started, running loop forever
2026-08-21 12:05:50,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 12:05:50,148 INFO core: _init_accounts coroutine started
2026-08-21 12:05:50,148 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 12:05:50,158 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:10:23,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:15:20,173 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:20:16,110 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 12:20:16,110 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 12:20:16,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:25:19,317 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 12:25:19,322 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 12:25:19,341 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 12:25:19,341 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 12:25:19,345 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-21 12:25:19,346 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-21 12:25:19,348 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:30:25,463 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 12:30:28,512 INFO core: Event loop thread started, running loop forever
2026-08-21 12:30:28,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 12:30:28,821 INFO core: _init_accounts coroutine started
2026-08-21 12:30:28,824 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 12:30:28,860 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:35:48,923 INFO core: Event loop thread started, running loop forever
2026-08-21 12:35:49,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 12:35:49,240 INFO core: _init_accounts coroutine started
2026-08-21 12:35:49,241 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 12:35:49,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:40:14,394 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:45:28,382 INFO core: Event loop thread started, running loop forever
2026-08-21 12:45:28,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 12:45:28,688 INFO core: _init_accounts coroutine started
2026-08-21 12:45:28,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 12:45:28,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:50:29,989 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 12:55:23,214 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 12:55:23,215 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 12:55:23,217 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 12:55:23,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:00:19,322 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 13:00:19,330 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:05:26,511 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 13:05:42,354 INFO core: Event loop thread started, running loop forever
2026-08-21 13:05:42,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 13:05:42,662 INFO core: _init_accounts coroutine started
2026-08-21 13:05:42,663 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 13:05:42,671 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:10:14,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:10:14,829 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 13:10:14,829 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 13:10:14,830 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 13:10:14,832 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 13:15:20,455 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 13:15:22,632 INFO core: Event loop thread started, running loop forever
2026-08-21 13:15:22,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 13:15:22,943 INFO core: _init_accounts coroutine started
2026-08-21 13:15:22,943 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 13:15:22,950 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:20:51,917 INFO core: Event loop thread started, running loop forever
2026-08-21 13:20:52,218 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 13:20:52,221 INFO core: _init_accounts coroutine started
2026-08-21 13:20:52,224 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 13:20:52,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:25:20,072 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 13:25:20,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:30:41,110 INFO core: Event loop thread started, running loop forever
2026-08-21 13:30:41,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 13:30:41,418 INFO core: _init_accounts coroutine started
2026-08-21 13:30:41,419 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 13:30:41,426 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:35:43,992 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:40:15,301 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 13:40:15,302 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 13:40:15,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 13:40:15,315 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 13:40:15,325 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:45:22,464 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 13:45:22,465 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 13:45:22,465 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 13:45:48,338 INFO core: Event loop thread started, running loop forever
2026-08-21 13:45:48,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 13:45:48,646 INFO core: _init_accounts coroutine started
2026-08-21 13:45:48,646 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 13:45:48,701 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:50:34,731 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 13:55:13,821 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 13:55:13,821 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 13:55:13,823 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 13:55:13,827 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 13:55:13,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:00:42,097 INFO core: Event loop thread started, running loop forever
2026-08-21 14:00:42,399 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 14:00:42,405 INFO core: _init_accounts coroutine started
2026-08-21 14:00:42,406 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 14:00:42,416 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:05:04,923 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 14:05:04,923 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 14:05:04,939 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:10:32,563 INFO core: Event loop thread started, running loop forever
2026-08-21 14:10:32,865 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 14:10:32,870 INFO core: _init_accounts coroutine started
2026-08-21 14:10:32,871 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 14:10:32,882 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:15:38,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 14:15:42,748 INFO core: Event loop thread started, running loop forever
2026-08-21 14:15:43,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 14:15:43,067 INFO core: _init_accounts coroutine started
2026-08-21 14:15:43,067 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 14:15:43,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:20:24,375 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 14:20:24,387 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:25:46,274 INFO core: Event loop thread started, running loop forever
2026-08-21 14:25:46,575 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 14:25:46,579 INFO core: _init_accounts coroutine started
2026-08-21 14:25:46,579 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 14:25:46,594 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:30:35,721 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 14:30:35,722 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 14:30:35,724 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:30:35,727 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 14:35:12,338 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 14:35:12,344 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:40:26,327 INFO core: Event loop thread started, running loop forever
2026-08-21 14:40:26,634 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 14:40:26,639 INFO core: _init_accounts coroutine started
2026-08-21 14:40:26,640 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 14:40:26,651 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:45:18,866 INFO core: Event loop thread started, running loop forever
2026-08-21 14:45:19,170 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 14:45:19,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:45:19,184 INFO core: _init_accounts coroutine started
2026-08-21 14:45:19,184 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 14:50:12,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 14:55:06,874 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 14:55:06,875 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 14:55:06,883 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:00:47,497 INFO core: Event loop thread started, running loop forever
2026-08-21 15:00:47,798 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 15:00:47,802 INFO core: _init_accounts coroutine started
2026-08-21 15:00:47,803 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 15:00:47,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:05:35,921 INFO core: Event loop thread started, running loop forever
2026-08-21 15:05:36,223 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 15:05:36,229 INFO core: _init_accounts coroutine started
2026-08-21 15:05:36,230 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 15:05:36,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:10:18,239 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 15:10:18,251 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:15:18,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:20:07,285 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-21 15:20:07,286 INFO core: _init_accounts coroutine started
2026-08-21 15:20:07,286 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 15:20:07,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:25:05,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 15:25:05,280 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 15:25:05,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:30:29,745 INFO core: Event loop thread started, running loop forever
2026-08-21 15:30:30,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 15:30:30,053 INFO core: _init_accounts coroutine started
2026-08-21 15:30:30,054 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 15:30:30,069 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:35:36,442 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 15:35:42,607 INFO core: Event loop thread started, running loop forever
2026-08-21 15:35:42,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 15:35:42,912 INFO core: _init_accounts coroutine started
2026-08-21 15:35:42,913 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 15:35:42,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:40:37,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:45:09,800 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 15:45:09,819 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:50:53,107 INFO core: Event loop thread started, running loop forever
2026-08-21 15:50:53,409 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 15:50:53,413 INFO core: _init_accounts coroutine started
2026-08-21 15:50:53,414 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 15:50:53,425 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 15:55:25,597 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 15:55:25,598 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 15:55:25,603 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 15:55:25,605 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 15:55:25,616 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 15:55:25,616 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 15:55:25,622 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-21 15:55:25,623 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-21 15:55:25,624 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:00:09,808 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 16:00:09,808 WARNING core: Account 2: connect timed out after 35s
2026-08-21 16:00:09,809 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-21 16:00:09,810 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-21 16:00:09,812 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-21 16:00:09,813 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-21 16:00:09,814 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-21 16:00:09,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:05:15,384 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-21 16:05:15,384 WARNING core: Account 2: connect timed out after 35s
2026-08-21 16:05:15,385 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-21 16:05:15,385 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-21 16:05:15,385 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-21 16:05:15,386 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-21 16:05:15,387 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-21 16:05:45,722 INFO core: Event loop thread started, running loop forever
2026-08-21 16:05:46,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 16:05:46,028 INFO core: _init_accounts coroutine started
2026-08-21 16:05:46,030 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 16:05:46,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:10:06,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:15:13,372 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 16:15:13,373 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 16:15:13,374 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-21 16:15:13,374 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 16:15:13,374 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-21 16:15:13,374 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 16:15:13,375 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-21 16:15:13,375 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 16:15:13,375 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 16:15:19,583 INFO core: Event loop thread started, running loop forever
2026-08-21 16:15:19,884 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 16:15:19,888 INFO core: _init_accounts coroutine started
2026-08-21 16:15:19,889 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 16:15:19,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:20:26,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 16:20:42,092 INFO core: Event loop thread started, running loop forever
2026-08-21 16:20:42,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 16:20:42,399 INFO core: _init_accounts coroutine started
2026-08-21 16:20:42,400 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 16:20:42,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:25:44,865 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:30:35,329 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 16:30:35,343 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:35:24,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:40:30,266 INFO core: Event loop thread started, running loop forever
2026-08-21 16:40:30,568 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 16:40:30,576 INFO core: _init_accounts coroutine started
2026-08-21 16:40:30,576 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 16:40:30,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:45:36,635 INFO core: Event loop thread started, running loop forever
2026-08-21 16:45:36,936 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 16:45:36,943 INFO core: _init_accounts coroutine started
2026-08-21 16:45:36,943 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 16:45:36,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:50:05,850 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 16:50:05,850 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 16:50:05,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 16:50:05,854 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 16:55:10,954 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 16:55:10,961 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:00:16,430 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 17:00:21,455 INFO core: Event loop thread started, running loop forever
2026-08-21 17:00:21,758 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 17:00:21,775 INFO core: _init_accounts coroutine started
2026-08-21 17:00:21,778 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 17:00:21,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:05:24,737 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 17:05:24,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:10:24,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:15:14,690 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-21 17:15:14,691 INFO core: _init_accounts coroutine started
2026-08-21 17:15:14,692 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 17:15:14,694 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:20:21,409 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 17:20:26,751 INFO core: Event loop thread started, running loop forever
2026-08-21 17:20:27,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 17:20:27,061 INFO core: _init_accounts coroutine started
2026-08-21 17:20:27,061 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 17:20:27,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:25:18,026 INFO core: Event loop thread started, running loop forever
2026-08-21 17:25:18,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 17:25:18,332 INFO core: _init_accounts coroutine started
2026-08-21 17:25:18,332 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 17:25:18,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:25:34,043 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 17:30:25,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 17:30:30,042 INFO core: Event loop thread started, running loop forever
2026-08-21 17:30:30,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 17:30:30,348 INFO core: _init_accounts coroutine started
2026-08-21 17:30:30,349 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 17:30:30,355 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:35:09,609 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:40:14,585 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 17:40:14,586 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 17:40:14,592 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 17:40:14,595 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 17:40:14,602 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:45:18,185 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:50:48,025 INFO core: Event loop thread started, running loop forever
2026-08-21 17:50:48,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 17:50:48,348 INFO core: _init_accounts coroutine started
2026-08-21 17:50:48,350 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 17:50:48,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 17:55:42,698 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 17:55:42,711 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:00:42,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:05:47,865 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-21 18:05:47,866 INFO core: _init_accounts coroutine started
2026-08-21 18:05:47,866 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 18:05:47,879 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:05:47,880 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 18:05:47,880 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 18:10:45,201 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 18:10:45,202 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:15:10,790 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 18:15:10,790 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 18:15:10,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:20:45,191 INFO core: Event loop thread started, running loop forever
2026-08-21 18:20:45,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 18:20:45,499 INFO core: _init_accounts coroutine started
2026-08-21 18:20:45,499 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 18:20:45,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:25:40,875 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 18:25:40,892 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:30:49,418 INFO core: Event loop thread started, running loop forever
2026-08-21 18:30:49,719 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 18:30:49,726 INFO core: _init_accounts coroutine started
2026-08-21 18:30:49,726 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 18:30:49,736 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:35:49,705 INFO core: Event loop thread started, running loop forever
2026-08-21 18:35:50,006 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 18:35:50,010 INFO core: _init_accounts coroutine started
2026-08-21 18:35:50,011 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 18:35:50,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:35:56,706 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 18:35:56,707 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 18:40:37,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:40:37,085 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 18:40:37,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 18:45:49,262 INFO core: Event loop thread started, running loop forever
2026-08-21 18:45:49,563 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 18:45:49,568 INFO core: _init_accounts coroutine started
2026-08-21 18:45:49,568 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 18:45:49,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:50:11,131 INFO core: Event loop thread started, running loop forever
2026-08-21 18:50:11,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 18:50:11,438 INFO core: _init_accounts coroutine started
2026-08-21 18:50:11,438 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 18:50:11,454 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 18:55:47,418 INFO core: Event loop thread started, running loop forever
2026-08-21 18:55:47,719 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 18:55:47,725 INFO core: _init_accounts coroutine started
2026-08-21 18:55:47,726 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 18:55:47,733 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:00:43,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:05:45,883 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 19:05:45,883 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 19:05:45,887 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 19:05:45,890 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 19:05:45,891 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:10:37,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:15:43,481 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 19:15:43,482 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 19:15:43,483 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 19:15:46,199 INFO core: Event loop thread started, running loop forever
2026-08-21 19:15:46,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 19:15:46,505 INFO core: _init_accounts coroutine started
2026-08-21 19:15:46,506 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 19:15:46,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:20:34,907 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 19:20:34,908 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 19:20:34,909 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:20:34,910 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 19:25:02,932 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 19:25:02,943 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:30:18,338 INFO core: Event loop thread started, running loop forever
2026-08-21 19:30:18,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 19:30:18,647 INFO core: _init_accounts coroutine started
2026-08-21 19:30:18,648 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 19:30:18,656 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:35:22,829 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 19:35:22,829 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 19:35:22,830 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 19:35:22,831 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:40:10,004 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 19:40:10,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:45:24,896 INFO core: Event loop thread started, running loop forever
2026-08-21 19:45:25,197 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 19:45:25,201 INFO core: _init_accounts coroutine started
2026-08-21 19:45:25,203 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 19:45:25,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:50:48,213 INFO core: Event loop thread started, running loop forever
2026-08-21 19:50:48,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 19:50:48,520 INFO core: _init_accounts coroutine started
2026-08-21 19:50:48,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 19:50:48,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 19:55:33,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:00:40,375 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 20:00:40,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 20:00:40,376 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-21 20:00:46,175 INFO core: Event loop thread started, running loop forever
2026-08-21 20:00:46,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 20:00:46,480 INFO core: _init_accounts coroutine started
2026-08-21 20:00:46,481 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 20:00:46,490 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:00:46,497 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 20:00:46,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 20:05:44,573 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 20:05:44,579 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 20:05:44,592 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:10:51,020 INFO core: Event loop thread started, running loop forever
2026-08-21 20:10:51,024 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 20:10:51,025 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 20:10:51,025 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 20:10:51,321 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 20:10:51,326 INFO core: _init_accounts coroutine started
2026-08-21 20:10:51,328 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 20:10:51,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:15:28,128 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:20:03,791 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 20:20:03,791 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 20:20:03,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:25:10,409 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 20:25:27,491 INFO core: Event loop thread started, running loop forever
2026-08-21 20:25:27,792 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 20:25:27,798 INFO core: _init_accounts coroutine started
2026-08-21 20:25:27,799 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 20:25:27,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:30:14,155 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 20:30:14,155 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 20:30:14,164 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 20:30:14,166 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 20:30:14,177 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:35:24,540 INFO core: Event loop thread started, running loop forever
2026-08-21 20:35:24,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 20:35:24,845 INFO core: _init_accounts coroutine started
2026-08-21 20:35:24,848 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 20:35:24,856 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:40:17,414 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:40:17,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 20:40:17,417 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 20:45:48,383 INFO core: Event loop thread started, running loop forever
2026-08-21 20:45:48,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 20:45:48,693 INFO core: _init_accounts coroutine started
2026-08-21 20:45:48,693 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 20:45:48,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:50:37,695 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 20:55:22,354 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 20:55:22,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:00:38,174 INFO core: Event loop thread started, running loop forever
2026-08-21 21:00:38,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:00:38,482 INFO core: _init_accounts coroutine started
2026-08-21 21:00:38,482 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:00:38,494 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 21:00:38,495 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 21:00:38,499 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 21:00:38,500 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:05:11,366 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 21:05:11,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:10:26,862 INFO core: Event loop thread started, running loop forever
2026-08-21 21:10:27,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:10:27,167 INFO core: _init_accounts coroutine started
2026-08-21 21:10:27,168 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:10:27,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:15:12,159 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:20:24,731 INFO core: Event loop thread started, running loop forever
2026-08-21 21:20:25,032 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:20:25,037 INFO core: _init_accounts coroutine started
2026-08-21 21:20:25,037 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:20:25,048 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:25:20,695 INFO core: Event loop thread started, running loop forever
2026-08-21 21:25:21,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:25:21,004 INFO core: _init_accounts coroutine started
2026-08-21 21:25:21,004 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:25:21,012 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:30:50,186 INFO core: Event loop thread started, running loop forever
2026-08-21 21:30:50,487 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:30:50,492 INFO core: _init_accounts coroutine started
2026-08-21 21:30:50,492 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:30:50,500 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:35:50,982 INFO core: Event loop thread started, running loop forever
2026-08-21 21:35:51,283 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:35:51,288 INFO core: _init_accounts coroutine started
2026-08-21 21:35:51,289 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:35:51,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:40:11,299 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-21 21:40:11,311 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:45:21,567 INFO core: Event loop thread started, running loop forever
2026-08-21 21:45:21,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:45:21,873 INFO core: _init_accounts coroutine started
2026-08-21 21:45:21,873 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:45:21,880 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:50:43,341 INFO core: Event loop thread started, running loop forever
2026-08-21 21:50:43,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 21:50:43,648 INFO core: _init_accounts coroutine started
2026-08-21 21:50:43,650 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 21:50:43,658 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 21:50:43,668 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 21:50:43,678 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 21:55:47,287 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 21:55:47,294 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:00:51,966 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 22:00:51,974 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:05:20,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:10:33,397 INFO core: Event loop thread started, running loop forever
2026-08-21 22:10:33,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 22:10:33,703 INFO core: _init_accounts coroutine started
2026-08-21 22:10:33,705 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 22:10:33,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:15:36,688 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 22:15:36,688 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 22:15:36,690 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 22:15:36,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:20:11,562 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 22:20:11,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:25:29,293 INFO core: Event loop thread started, running loop forever
2026-08-21 22:25:29,594 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 22:25:29,601 INFO core: _init_accounts coroutine started
2026-08-21 22:25:29,601 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 22:25:29,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:30:34,215 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 22:30:34,216 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 22:30:34,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:30:34,219 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 22:35:39,718 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 22:35:39,723 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:40:36,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:45:08,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:50:15,402 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 22:50:52,864 INFO core: Event loop thread started, running loop forever
2026-08-21 22:50:53,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 22:50:53,170 INFO core: _init_accounts coroutine started
2026-08-21 22:50:53,170 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 22:50:53,180 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 22:50:53,181 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 22:50:53,181 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 22:55:28,860 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 22:55:28,865 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 22:55:28,874 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:00:28,766 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:05:46,739 INFO core: Event loop thread started, running loop forever
2026-08-21 23:05:47,041 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 23:05:47,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:05:47,054 INFO core: _init_accounts coroutine started
2026-08-21 23:10:34,817 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 23:10:34,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:15:40,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 23:15:40,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 23:15:40,804 INFO core: Event loop thread started, running loop forever
2026-08-21 23:15:41,105 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 23:15:41,111 INFO core: _init_accounts coroutine started
2026-08-21 23:15:41,111 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 23:15:41,119 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 23:15:41,119 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 23:15:41,120 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 23:15:41,122 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 23:15:41,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:20:40,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:25:33,074 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:30:09,334 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-21 23:30:09,334 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-21 23:30:09,334 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 23:30:27,101 INFO core: Event loop thread started, running loop forever
2026-08-21 23:30:27,402 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 23:30:27,407 INFO core: _init_accounts coroutine started
2026-08-21 23:30:27,407 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 23:30:27,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:35:34,356 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-21 23:35:40,088 INFO core: Event loop thread started, running loop forever
2026-08-21 23:35:40,389 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 23:35:40,394 INFO core: _init_accounts coroutine started
2026-08-21 23:35:40,394 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 23:35:40,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:40:22,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:40:22,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-21 23:40:22,362 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-21 23:45:25,479 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-21 23:45:25,484 INFO core: _init_accounts_inner: reloading LLM config
2026-08-21 23:45:25,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:50:13,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-21 23:55:27,855 INFO core: Event loop thread started, running loop forever
2026-08-21 23:55:28,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-21 23:55:28,162 INFO core: _init_accounts coroutine started
2026-08-21 23:55:28,163 INFO core: _init_accounts_inner: starting DB migrations
2026-08-21 23:55:28,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:00:31,345 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:05:21,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:10:35,474 INFO core: Event loop thread started, running loop forever
2026-08-22 00:10:35,777 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 00:10:35,781 INFO core: _init_accounts coroutine started
2026-08-22 00:10:35,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 00:10:35,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:15:36,781 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:20:20,238 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 00:20:20,239 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 00:20:20,288 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 00:20:20,292 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 00:20:20,295 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:25:45,397 INFO core: Event loop thread started, running loop forever
2026-08-22 00:25:45,701 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 00:25:45,707 INFO core: _init_accounts coroutine started
2026-08-22 00:25:45,707 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 00:25:45,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:30:49,980 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 00:30:49,980 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 00:30:49,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:30:49,983 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 00:30:49,990 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 00:35:45,234 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:40:09,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:45:25,275 INFO core: Event loop thread started, running loop forever
2026-08-22 00:45:25,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 00:45:25,582 INFO core: _init_accounts coroutine started
2026-08-22 00:45:25,584 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 00:45:25,594 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:50:43,673 INFO core: Event loop thread started, running loop forever
2026-08-22 00:50:43,974 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 00:50:43,979 INFO core: _init_accounts coroutine started
2026-08-22 00:50:43,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 00:50:43,988 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:55:39,056 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 00:55:39,057 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 00:55:39,061 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 00:55:39,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 00:55:39,063 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 01:00:14,696 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:05:16,652 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:10:22,397 INFO core: Event loop thread started, running loop forever
2026-08-22 01:10:22,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:10:22,704 INFO core: _init_accounts coroutine started
2026-08-22 01:10:22,706 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:10:22,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:15:30,839 INFO core: Event loop thread started, running loop forever
2026-08-22 01:15:31,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:15:31,145 INFO core: _init_accounts coroutine started
2026-08-22 01:15:31,146 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:15:31,161 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:15:31,161 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 01:15:31,180 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 01:15:31,182 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 01:15:31,184 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 01:20:38,051 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 01:20:38,052 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 01:20:38,052 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 01:20:50,747 INFO core: Event loop thread started, running loop forever
2026-08-22 01:20:51,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:20:51,063 INFO core: _init_accounts coroutine started
2026-08-22 01:20:51,064 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:20:51,225 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:25:13,553 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 01:25:13,554 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 01:25:13,555 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 01:25:13,557 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 01:25:13,569 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 01:25:13,569 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 01:25:13,573 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 01:25:13,574 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 01:25:13,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:30:20,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 01:30:20,418 WARNING core: Account 2: connect timed out after 35s
2026-08-22 01:30:20,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 01:30:20,421 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 01:30:39,546 INFO core: Event loop thread started, running loop forever
2026-08-22 01:30:39,848 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:30:39,854 INFO core: _init_accounts coroutine started
2026-08-22 01:30:39,854 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:30:39,863 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:35:14,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:40:36,939 INFO core: Event loop thread started, running loop forever
2026-08-22 01:40:37,240 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:40:37,246 INFO core: _init_accounts coroutine started
2026-08-22 01:40:37,247 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:40:37,268 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:45:09,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 01:45:14,585 INFO core: Event loop thread started, running loop forever
2026-08-22 01:45:14,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:45:14,891 INFO core: _init_accounts coroutine started
2026-08-22 01:45:14,891 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:45:14,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:50:27,602 INFO core: Event loop thread started, running loop forever
2026-08-22 01:50:27,903 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:50:27,908 INFO core: _init_accounts coroutine started
2026-08-22 01:50:27,909 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:50:27,922 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 01:55:43,759 INFO core: Event loop thread started, running loop forever
2026-08-22 01:55:44,060 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 01:55:44,065 INFO core: _init_accounts coroutine started
2026-08-22 01:55:44,065 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 01:55:44,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:00:41,951 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:05:11,419 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 02:05:11,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 02:05:11,426 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 02:05:11,430 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 02:05:11,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:08:54,339 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 02:10:32,458 INFO core: Event loop thread started, running loop forever
2026-08-22 02:10:32,759 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 02:10:32,763 INFO core: _init_accounts coroutine started
2026-08-22 02:10:32,765 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 02:10:32,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:15:39,445 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 02:15:39,448 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 02:15:49,130 INFO core: Event loop thread started, running loop forever
2026-08-22 02:15:49,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 02:15:49,438 INFO core: _init_accounts coroutine started
2026-08-22 02:15:49,439 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 02:15:49,447 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:20:24,445 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 02:20:24,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 02:20:24,449 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 02:20:24,452 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 02:20:24,463 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:25:30,438 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 02:25:49,723 INFO core: Event loop thread started, running loop forever
2026-08-22 02:25:50,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 02:25:50,029 INFO core: _init_accounts coroutine started
2026-08-22 02:25:50,029 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 02:25:50,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:30:15,626 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:35:32,147 INFO core: Event loop thread started, running loop forever
2026-08-22 02:35:32,448 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 02:35:32,454 INFO core: _init_accounts coroutine started
2026-08-22 02:35:32,454 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 02:35:32,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:40:22,748 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 02:40:22,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:45:37,128 INFO core: Event loop thread started, running loop forever
2026-08-22 02:45:37,429 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 02:45:37,433 INFO core: _init_accounts coroutine started
2026-08-22 02:45:37,434 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 02:45:37,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:50:43,869 INFO core: Event loop thread started, running loop forever
2026-08-22 02:50:44,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 02:50:44,181 INFO core: _init_accounts coroutine started
2026-08-22 02:50:44,182 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 02:50:44,191 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 02:55:09,123 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 02:55:09,124 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 02:55:09,126 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 02:55:09,128 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 02:55:09,149 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 02:55:09,150 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 02:55:09,155 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 02:55:09,157 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 02:55:09,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:00:16,408 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 03:00:16,410 WARNING core: Account 2: connect timed out after 35s
2026-08-22 03:00:16,411 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 03:00:16,412 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 03:00:16,413 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 03:00:16,415 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-22 03:00:16,415 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-22 03:00:50,696 INFO core: Event loop thread started, running loop forever
2026-08-22 03:00:50,998 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 03:00:51,003 INFO core: _init_accounts coroutine started
2026-08-22 03:00:51,003 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 03:00:51,036 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 03:00:51,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 03:00:51,057 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 03:00:51,059 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 03:00:51,071 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:05:50,688 INFO core: Event loop thread started, running loop forever
2026-08-22 03:05:50,989 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 03:05:50,994 INFO core: _init_accounts coroutine started
2026-08-22 03:05:50,995 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 03:05:51,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:10:44,976 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 03:10:44,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:15:08,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:20:22,235 INFO core: Event loop thread started, running loop forever
2026-08-22 03:20:22,536 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 03:20:22,540 INFO core: _init_accounts coroutine started
2026-08-22 03:20:22,541 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 03:20:22,589 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 03:20:22,589 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 03:20:22,592 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 03:20:22,595 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 03:20:22,610 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:25:26,216 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 03:25:26,221 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 03:25:26,229 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 03:25:26,230 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 03:25:26,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:30:33,403 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 03:30:33,406 WARNING core: Account 2: connect timed out after 35s
2026-08-22 03:30:33,406 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 03:30:33,406 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 03:30:33,407 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 03:30:33,408 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-22 03:30:33,408 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-22 03:30:48,317 INFO core: Event loop thread started, running loop forever
2026-08-22 03:30:48,618 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 03:30:48,623 INFO core: _init_accounts coroutine started
2026-08-22 03:30:48,623 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 03:30:48,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:35:11,062 INFO core: Event loop thread started, running loop forever
2026-08-22 03:35:11,364 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 03:35:11,368 INFO core: _init_accounts coroutine started
2026-08-22 03:35:11,371 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 03:35:11,376 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:40:44,158 INFO core: Event loop thread started, running loop forever
2026-08-22 03:40:44,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 03:40:44,464 INFO core: _init_accounts coroutine started
2026-08-22 03:40:44,465 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 03:40:44,471 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:45:50,190 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:45:50,195 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 03:45:50,195 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 03:50:03,709 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 03:50:03,760 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 03:55:37,831 INFO core: Event loop thread started, running loop forever
2026-08-22 03:55:38,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 03:55:38,137 INFO core: _init_accounts coroutine started
2026-08-22 03:55:38,138 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 03:55:38,150 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:00:16,177 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:05:21,016 INFO core: Event loop thread started, running loop forever
2026-08-22 04:05:21,317 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 04:05:21,322 INFO core: _init_accounts coroutine started
2026-08-22 04:05:21,322 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 04:05:21,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:10:28,383 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 04:10:46,045 INFO core: Event loop thread started, running loop forever
2026-08-22 04:10:46,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 04:10:46,350 INFO core: _init_accounts coroutine started
2026-08-22 04:10:46,351 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 04:10:46,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:15:04,684 INFO core: Event loop thread started, running loop forever
2026-08-22 04:15:04,985 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 04:15:04,996 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:15:53,743 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 04:20:09,694 INFO core: _init_accounts coroutine started
2026-08-22 04:20:09,695 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 04:20:09,711 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 04:20:09,712 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 04:20:09,713 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 04:20:09,715 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 04:20:09,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:25:15,551 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 04:25:15,554 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 04:25:15,554 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 04:25:37,082 INFO core: Event loop thread started, running loop forever
2026-08-22 04:25:37,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 04:25:37,389 INFO core: _init_accounts coroutine started
2026-08-22 04:25:37,392 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 04:25:37,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 04:25:37,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 04:25:37,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 04:25:37,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 04:25:37,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:30:53,403 INFO core: Event loop thread started, running loop forever
2026-08-22 04:30:53,704 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 04:30:53,709 INFO core: _init_accounts coroutine started
2026-08-22 04:30:53,711 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 04:30:53,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:35:10,865 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 04:35:10,894 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:40:40,358 INFO core: Event loop thread started, running loop forever
2026-08-22 04:40:40,659 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 04:40:40,667 INFO core: _init_accounts coroutine started
2026-08-22 04:40:40,667 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 04:40:40,676 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:45:08,868 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 04:45:08,870 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 04:45:08,877 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:45:08,879 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 04:50:20,717 INFO core: Event loop thread started, running loop forever
2026-08-22 04:50:21,018 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 04:50:21,024 INFO core: _init_accounts coroutine started
2026-08-22 04:50:21,024 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 04:50:21,036 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 04:50:21,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 04:50:21,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 04:50:21,038 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 04:55:22,155 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 04:55:22,157 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:00:09,918 INFO core: Event loop thread started, running loop forever
2026-08-22 05:00:10,219 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 05:00:10,223 INFO core: _init_accounts coroutine started
2026-08-22 05:00:10,224 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 05:00:10,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:00:29,938 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 05:00:29,939 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 05:00:29,939 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 05:05:17,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 05:05:20,787 INFO core: Event loop thread started, running loop forever
2026-08-22 05:05:21,088 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 05:05:21,092 INFO core: _init_accounts coroutine started
2026-08-22 05:05:21,094 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 05:05:21,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:10:43,896 INFO core: Event loop thread started, running loop forever
2026-08-22 05:10:44,197 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 05:10:44,204 INFO core: _init_accounts coroutine started
2026-08-22 05:10:44,204 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 05:10:44,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:15:26,443 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 05:15:26,443 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 05:15:26,445 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 05:15:26,447 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 05:15:26,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:20:04,865 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:25:08,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:30:50,218 INFO core: Event loop thread started, running loop forever
2026-08-22 05:30:50,519 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 05:30:50,526 INFO core: _init_accounts coroutine started
2026-08-22 05:30:50,528 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 05:30:50,539 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:35:20,954 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:40:25,507 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 05:40:25,510 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 05:40:25,511 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:45:40,856 INFO core: Event loop thread started, running loop forever
2026-08-22 05:45:41,157 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 05:45:41,162 INFO core: _init_accounts coroutine started
2026-08-22 05:45:41,162 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 05:45:41,171 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:50:11,388 INFO core: Event loop thread started, running loop forever
2026-08-22 05:50:11,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 05:50:11,695 INFO core: _init_accounts coroutine started
2026-08-22 05:50:11,695 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 05:50:11,705 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 05:55:17,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 05:55:34,971 INFO core: Event loop thread started, running loop forever
2026-08-22 05:55:35,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 05:55:35,279 INFO core: _init_accounts coroutine started
2026-08-22 05:55:35,279 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 05:55:35,290 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:00:27,210 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 06:00:27,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:05:42,278 INFO core: Event loop thread started, running loop forever
2026-08-22 06:05:42,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 06:05:42,584 INFO core: _init_accounts coroutine started
2026-08-22 06:05:42,585 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 06:05:42,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:10:13,972 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 06:10:13,980 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 06:10:13,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:15:48,132 INFO core: Event loop thread started, running loop forever
2026-08-22 06:15:48,433 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 06:15:48,437 INFO core: _init_accounts coroutine started
2026-08-22 06:15:48,437 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 06:15:48,444 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:20:13,044 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 06:20:13,045 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 06:20:13,047 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 06:20:13,050 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 06:20:13,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:25:20,380 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 06:25:20,381 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 06:25:20,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 06:25:42,856 INFO core: Event loop thread started, running loop forever
2026-08-22 06:25:43,157 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 06:25:43,161 INFO core: _init_accounts coroutine started
2026-08-22 06:25:43,161 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 06:25:43,170 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:30:17,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:35:11,352 INFO core: Event loop thread started, running loop forever
2026-08-22 06:35:11,655 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 06:35:11,658 INFO core: _init_accounts coroutine started
2026-08-22 06:35:11,661 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 06:35:11,704 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-22 06:35:11,718 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-22 06:35:24,360 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 06:35:24,361 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 06:35:24,362 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-22 06:35:24,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 06:35:24,362 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-22 06:35:24,363 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 06:35:24,363 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-08-22 06:35:24,363 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 06:35:24,363 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-22 06:40:28,417 INFO core: Event loop thread started, running loop forever
2026-08-22 06:40:28,718 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 06:40:28,722 INFO core: _init_accounts coroutine started
2026-08-22 06:40:28,724 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 06:40:28,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:45:52,068 INFO core: Event loop thread started, running loop forever
2026-08-22 06:45:52,369 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 06:45:52,373 INFO core: _init_accounts coroutine started
2026-08-22 06:45:52,374 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 06:45:52,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:50:23,315 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 06:50:23,318 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 06:50:23,323 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 06:50:23,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 06:50:23,326 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 06:55:30,370 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-08-22 06:55:30,372 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 06:55:40,243 INFO core: Event loop thread started, running loop forever
2026-08-22 06:55:40,544 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 06:55:40,552 INFO core: _init_accounts coroutine started
2026-08-22 06:55:40,553 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 06:55:40,560 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:00:18,126 INFO core: Event loop thread started, running loop forever
2026-08-22 07:00:18,427 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 07:00:18,430 INFO core: _init_accounts coroutine started
2026-08-22 07:00:18,432 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 07:00:18,440 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:05:07,198 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 07:05:07,208 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:10:14,331 INFO core: Event loop thread started, running loop forever
2026-08-22 07:10:14,632 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 07:10:14,636 INFO core: _init_accounts coroutine started
2026-08-22 07:10:14,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 07:10:14,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:15:14,814 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 07:15:14,829 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:20:18,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:25:46,321 INFO core: Event loop thread started, running loop forever
2026-08-22 07:25:46,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 07:25:46,628 INFO core: _init_accounts coroutine started
2026-08-22 07:25:46,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 07:25:46,637 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:30:45,195 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 07:30:45,196 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 07:30:45,199 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 07:30:45,201 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:35:28,496 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 07:35:28,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:40:20,385 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 07:40:20,386 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 07:40:20,392 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 07:40:20,393 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 07:40:20,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:45:27,478 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 07:45:41,139 INFO core: Event loop thread started, running loop forever
2026-08-22 07:45:41,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 07:45:41,445 INFO core: _init_accounts coroutine started
2026-08-22 07:45:41,446 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 07:45:41,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:50:05,947 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 07:50:05,975 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 07:55:06,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:00:38,725 INFO core: Event loop thread started, running loop forever
2026-08-22 08:00:39,026 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 08:00:39,037 INFO core: _init_accounts coroutine started
2026-08-22 08:00:39,037 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 08:00:39,039 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:05:45,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 08:05:53,038 INFO core: Event loop thread started, running loop forever
2026-08-22 08:05:53,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 08:05:53,345 INFO core: _init_accounts coroutine started
2026-08-22 08:05:53,346 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 08:05:53,353 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:10:41,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 08:10:41,484 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 08:10:41,495 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 08:10:41,498 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:15:30,629 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 08:15:30,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:20:36,474 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 08:20:49,751 INFO core: Event loop thread started, running loop forever
2026-08-22 08:20:50,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 08:20:50,061 INFO core: _init_accounts coroutine started
2026-08-22 08:20:50,062 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 08:20:50,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:25:40,706 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:30:37,051 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 08:30:37,053 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 08:30:37,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:35:29,597 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 08:35:29,598 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 08:35:29,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:35:29,615 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 08:40:35,386 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 08:40:35,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 08:40:35,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 08:40:52,859 INFO core: Event loop thread started, running loop forever
2026-08-22 08:40:53,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 08:40:53,166 INFO core: _init_accounts coroutine started
2026-08-22 08:40:53,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:40:53,178 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 08:45:40,846 INFO core: Event loop thread started, running loop forever
2026-08-22 08:45:41,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 08:45:41,154 INFO core: _init_accounts coroutine started
2026-08-22 08:45:41,154 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 08:45:41,173 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:50:32,220 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 08:50:32,220 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 08:50:32,221 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 08:50:32,223 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 08:50:32,227 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 08:50:32,237 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 08:50:32,238 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 08:50:32,243 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 08:50:32,244 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 08:55:27,404 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 08:55:27,405 WARNING core: Account 2: connect timed out after 35s
2026-08-22 08:55:27,406 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 08:55:27,407 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 08:55:27,408 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 08:55:27,409 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-22 08:55:27,409 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-22 08:55:27,422 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:00:30,877 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 09:00:30,878 WARNING core: Account 2: connect timed out after 35s
2026-08-22 09:00:30,878 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-22 09:00:30,879 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-22 09:00:30,880 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 09:00:30,882 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-22 09:00:30,882 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-22 09:00:30,885 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:05:36,423 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 09:05:36,424 WARNING core: Account 2: connect timed out after 35s
2026-08-22 09:05:36,424 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-22 09:05:36,424 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-22 09:05:36,425 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 09:05:36,426 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-22 09:05:36,426 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-22 09:05:49,222 INFO core: Event loop thread started, running loop forever
2026-08-22 09:05:49,523 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 09:05:49,528 INFO core: _init_accounts coroutine started
2026-08-22 09:05:49,529 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 09:05:49,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:10:33,575 INFO core: Event loop thread started, running loop forever
2026-08-22 09:10:33,876 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 09:10:33,880 INFO core: _init_accounts coroutine started
2026-08-22 09:10:33,881 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 09:10:33,891 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:10:55,597 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 09:15:17,179 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 09:15:17,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:15:17,183 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 09:20:36,175 INFO core: Event loop thread started, running loop forever
2026-08-22 09:20:36,478 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 09:20:36,489 INFO core: _init_accounts coroutine started
2026-08-22 09:20:36,489 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 09:20:36,511 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 09:20:36,512 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 09:20:36,514 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 09:20:36,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:25:24,343 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 09:25:24,349 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:30:53,335 INFO core: Event loop thread started, running loop forever
2026-08-22 09:30:53,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 09:30:53,639 INFO core: _init_accounts coroutine started
2026-08-22 09:30:53,640 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 09:30:53,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:30:53,654 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 09:30:53,654 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 09:30:53,655 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 09:35:38,964 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 09:35:38,969 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:40:17,331 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:45:18,050 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:50:08,884 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 09:50:08,885 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 09:50:08,885 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 09:55:15,363 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 09:55:15,364 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 09:55:16,393 INFO core: Event loop thread started, running loop forever
2026-08-22 09:55:16,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 09:55:16,700 INFO core: _init_accounts coroutine started
2026-08-22 09:55:16,701 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 09:55:16,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:00:31,674 INFO core: Event loop thread started, running loop forever
2026-08-22 10:00:31,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 10:00:31,979 INFO core: _init_accounts coroutine started
2026-08-22 10:00:31,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 10:00:31,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:05:40,646 INFO core: Event loop thread started, running loop forever
2026-08-22 10:05:40,947 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 10:05:40,952 INFO core: _init_accounts coroutine started
2026-08-22 10:05:40,953 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 10:05:40,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:10:42,947 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 10:10:42,956 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:15:13,899 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:20:20,721 INFO core: Event loop thread started, running loop forever
2026-08-22 10:20:21,022 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 10:20:21,032 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:25:27,383 INFO core: _init_accounts coroutine started
2026-08-22 10:25:43,745 INFO core: Event loop thread started, running loop forever
2026-08-22 10:25:44,046 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 10:25:44,055 INFO core: _init_accounts coroutine started
2026-08-22 10:25:44,055 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 10:25:44,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:30:48,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:35:53,224 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 10:35:53,239 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:40:46,005 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:45:28,055 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-22 10:45:28,056 INFO core: _init_accounts coroutine started
2026-08-22 10:45:28,056 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 10:45:28,066 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:50:45,867 INFO core: Event loop thread started, running loop forever
2026-08-22 10:50:46,168 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 10:50:46,176 INFO core: _init_accounts coroutine started
2026-08-22 10:50:46,177 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 10:50:46,180 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 10:55:03,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:00:06,915 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:05:12,484 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 11:05:12,484 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 11:05:38,619 INFO core: Event loop thread started, running loop forever
2026-08-22 11:05:38,920 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 11:05:38,925 INFO core: _init_accounts coroutine started
2026-08-22 11:05:38,925 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 11:05:38,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:10:05,606 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 11:10:05,620 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:15:03,882 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:20:32,300 INFO core: Event loop thread started, running loop forever
2026-08-22 11:20:32,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 11:20:32,606 INFO core: _init_accounts coroutine started
2026-08-22 11:20:32,607 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 11:20:32,618 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:25:25,023 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:30:53,284 INFO core: Event loop thread started, running loop forever
2026-08-22 11:30:53,585 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 11:30:53,591 INFO core: _init_accounts coroutine started
2026-08-22 11:30:53,592 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 11:30:53,602 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:35:38,489 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:40:30,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 11:40:30,414 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 11:40:30,420 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:40:30,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 11:45:35,101 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 11:45:35,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:50:23,558 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 11:55:25,394 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:00:31,399 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 12:00:53,466 INFO core: Event loop thread started, running loop forever
2026-08-22 12:00:53,768 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 12:00:53,776 INFO core: _init_accounts coroutine started
2026-08-22 12:00:53,777 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 12:00:53,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:05:12,209 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:10:31,227 INFO core: Event loop thread started, running loop forever
2026-08-22 12:10:31,529 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 12:10:31,538 INFO core: _init_accounts coroutine started
2026-08-22 12:10:31,538 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 12:10:31,543 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:15:41,216 INFO core: Event loop thread started, running loop forever
2026-08-22 12:15:41,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 12:15:41,520 INFO core: _init_accounts coroutine started
2026-08-22 12:15:41,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 12:15:41,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:20:27,660 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:25:03,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 12:25:03,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 12:25:03,477 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 12:25:03,480 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 12:25:03,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:30:10,368 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 12:30:10,368 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 12:30:10,368 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 12:30:50,678 INFO core: Event loop thread started, running loop forever
2026-08-22 12:30:50,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 12:30:50,985 INFO core: _init_accounts coroutine started
2026-08-22 12:30:50,986 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 12:30:50,993 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:35:23,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:40:04,599 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 12:40:04,600 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 12:40:04,601 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 12:40:04,602 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 12:40:04,612 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:45:45,294 INFO core: Event loop thread started, running loop forever
2026-08-22 12:45:45,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 12:45:45,601 INFO core: _init_accounts coroutine started
2026-08-22 12:45:45,603 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 12:45:45,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:50:14,872 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 12:50:14,873 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 12:50:14,875 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 12:50:14,878 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 12:50:14,889 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 12:50:14,889 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 12:50:14,894 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 12:50:14,895 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 12:50:14,896 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 12:55:20,348 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 12:55:20,348 WARNING core: Account 2: connect timed out after 35s
2026-08-22 12:55:20,349 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 12:55:20,349 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 12:55:20,350 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 12:55:20,351 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-22 12:55:20,352 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-22 12:55:28,405 INFO core: Event loop thread started, running loop forever
2026-08-22 12:55:28,706 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 12:55:28,711 INFO core: _init_accounts coroutine started
2026-08-22 12:55:28,712 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 12:55:28,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:00:41,617 INFO core: Event loop thread started, running loop forever
2026-08-22 13:00:41,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 13:00:41,922 INFO core: _init_accounts coroutine started
2026-08-22 13:00:41,922 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 13:00:41,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:05:13,239 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 13:05:13,239 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 13:05:13,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:10:19,355 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 13:10:19,356 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-22 13:10:19,357 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 13:10:19,357 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-22 13:10:19,357 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 13:10:19,357 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 13:10:34,324 INFO core: Event loop thread started, running loop forever
2026-08-22 13:10:34,625 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 13:10:34,630 INFO core: _init_accounts coroutine started
2026-08-22 13:10:34,631 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 13:10:34,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:15:47,447 INFO core: Event loop thread started, running loop forever
2026-08-22 13:15:47,754 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 13:15:47,759 INFO core: _init_accounts coroutine started
2026-08-22 13:15:47,761 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 13:15:47,773 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:20:29,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:25:10,458 INFO core: Event loop thread started, running loop forever
2026-08-22 13:25:10,759 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 13:25:10,765 INFO core: _init_accounts coroutine started
2026-08-22 13:25:10,765 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 13:25:10,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:30:26,702 INFO core: Event loop thread started, running loop forever
2026-08-22 13:30:27,003 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 13:30:27,009 INFO core: _init_accounts coroutine started
2026-08-22 13:30:27,009 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 13:30:27,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:35:07,998 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 13:35:07,998 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 13:35:07,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:35:08,002 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 13:40:40,255 INFO core: Event loop thread started, running loop forever
2026-08-22 13:40:40,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 13:40:40,563 INFO core: _init_accounts coroutine started
2026-08-22 13:40:40,564 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 13:40:40,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:45:33,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:45:33,572 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 13:45:33,572 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 13:50:14,854 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 13:50:14,856 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 13:50:14,859 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 13:55:52,588 INFO core: Event loop thread started, running loop forever
2026-08-22 13:55:52,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 13:55:52,894 INFO core: _init_accounts coroutine started
2026-08-22 13:55:52,895 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 13:55:52,903 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:00:22,523 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:05:27,421 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 14:05:27,421 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 14:05:27,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 14:05:27,427 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 14:05:27,429 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:10:34,443 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 14:10:34,842 INFO core: Event loop thread started, running loop forever
2026-08-22 14:10:35,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 14:10:35,147 INFO core: _init_accounts coroutine started
2026-08-22 14:10:35,148 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 14:10:35,163 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:15:38,017 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 14:15:38,020 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 14:15:38,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:20:08,473 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 14:20:08,475 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 14:20:08,483 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 14:20:08,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:25:46,005 INFO core: Event loop thread started, running loop forever
2026-08-22 14:25:46,306 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 14:25:46,311 INFO core: _init_accounts coroutine started
2026-08-22 14:25:46,312 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 14:25:46,325 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:25:46,327 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 14:25:46,327 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 14:25:46,330 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 14:25:46,331 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 14:30:17,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:35:12,255 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:35:12,257 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 14:35:12,258 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 14:40:18,400 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 14:40:37,884 INFO core: Event loop thread started, running loop forever
2026-08-22 14:40:38,186 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 14:40:38,192 INFO core: _init_accounts coroutine started
2026-08-22 14:40:38,193 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 14:40:38,202 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:45:49,135 INFO core: Event loop thread started, running loop forever
2026-08-22 14:45:49,436 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 14:45:49,441 INFO core: _init_accounts coroutine started
2026-08-22 14:45:49,443 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 14:45:49,448 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:50:12,115 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 14:50:12,123 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 14:55:05,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:00:34,613 INFO core: Event loop thread started, running loop forever
2026-08-22 15:00:34,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:00:34,921 INFO core: _init_accounts coroutine started
2026-08-22 15:00:34,922 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:00:34,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:05:41,414 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 15:05:50,593 INFO core: Event loop thread started, running loop forever
2026-08-22 15:05:50,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:05:50,901 INFO core: _init_accounts coroutine started
2026-08-22 15:05:50,902 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:05:50,909 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:10:21,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 15:10:21,582 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 15:10:21,583 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 15:10:21,585 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 15:10:21,595 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:15:47,401 INFO core: Event loop thread started, running loop forever
2026-08-22 15:15:47,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:15:47,708 INFO core: _init_accounts coroutine started
2026-08-22 15:15:47,708 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:15:47,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:20:13,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:25:26,266 INFO core: Event loop thread started, running loop forever
2026-08-22 15:25:26,567 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:25:26,572 INFO core: _init_accounts coroutine started
2026-08-22 15:25:26,573 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:25:26,581 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:30:33,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 15:30:38,463 INFO core: Event loop thread started, running loop forever
2026-08-22 15:30:38,764 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:30:38,768 INFO core: _init_accounts coroutine started
2026-08-22 15:30:38,770 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:30:38,779 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:35:43,638 INFO core: Event loop thread started, running loop forever
2026-08-22 15:35:43,939 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:35:43,945 INFO core: _init_accounts coroutine started
2026-08-22 15:35:43,945 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:35:43,953 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:40:06,679 INFO core: Event loop thread started, running loop forever
2026-08-22 15:40:06,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:40:06,985 INFO core: _init_accounts coroutine started
2026-08-22 15:40:06,986 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:40:06,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:40:06,998 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 15:40:07,000 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 15:40:50,721 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-22 15:45:33,045 INFO core: Event loop thread started, running loop forever
2026-08-22 15:45:33,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:45:33,353 INFO core: _init_accounts coroutine started
2026-08-22 15:45:33,353 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:45:33,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:50:12,213 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 15:50:12,226 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 15:55:51,047 INFO core: Event loop thread started, running loop forever
2026-08-22 15:55:51,348 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 15:55:51,356 INFO core: _init_accounts coroutine started
2026-08-22 15:55:51,356 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 15:55:51,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:00:19,029 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 16:00:19,030 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 16:00:19,032 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 16:00:19,036 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 16:00:19,051 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 16:00:19,052 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 16:00:19,057 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 16:00:19,058 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 16:00:19,082 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:05:26,438 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 16:05:36,460 INFO core: Event loop thread started, running loop forever
2026-08-22 16:05:36,761 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 16:05:36,768 INFO core: _init_accounts coroutine started
2026-08-22 16:05:36,769 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 16:05:36,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:10:45,840 INFO core: Event loop thread started, running loop forever
2026-08-22 16:10:46,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 16:10:46,152 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:15:36,138 INFO core: _init_accounts coroutine started
2026-08-22 16:15:36,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 16:15:36,157 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:20:43,649 INFO core: Event loop thread started, running loop forever
2026-08-22 16:20:43,950 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 16:20:43,961 INFO core: _init_accounts coroutine started
2026-08-22 16:20:43,962 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 16:20:43,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:20:43,972 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-22 16:25:25,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:30:04,624 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:35:42,522 INFO core: Event loop thread started, running loop forever
2026-08-22 16:35:42,823 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 16:35:42,829 INFO core: _init_accounts coroutine started
2026-08-22 16:35:42,830 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 16:35:42,838 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:40:27,474 INFO core: Event loop thread started, running loop forever
2026-08-22 16:40:27,775 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 16:40:27,779 INFO core: _init_accounts coroutine started
2026-08-22 16:40:27,780 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 16:40:27,794 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 16:40:27,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 16:40:27,795 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:40:49,500 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-22 16:45:09,866 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 16:45:09,872 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 16:45:09,873 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:50:15,380 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 16:50:15,381 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 16:50:15,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 16:50:38,032 INFO core: Event loop thread started, running loop forever
2026-08-22 16:50:38,334 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 16:50:38,340 INFO core: _init_accounts coroutine started
2026-08-22 16:50:38,341 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 16:50:38,349 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 16:55:45,435 INFO core: Event loop thread started, running loop forever
2026-08-22 16:55:45,736 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 16:55:45,741 INFO core: _init_accounts coroutine started
2026-08-22 16:55:45,742 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 16:55:45,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:00:32,063 INFO core: Event loop thread started, running loop forever
2026-08-22 17:00:32,364 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 17:00:32,368 INFO core: _init_accounts coroutine started
2026-08-22 17:00:32,376 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:00:32,381 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 17:05:34,651 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:10:31,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:10:31,315 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 17:10:31,316 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 17:15:35,635 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 17:15:35,639 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 17:15:35,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:20:10,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:25:16,379 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 17:25:39,003 INFO core: Event loop thread started, running loop forever
2026-08-22 17:25:39,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 17:25:39,308 INFO core: _init_accounts coroutine started
2026-08-22 17:25:39,309 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 17:25:39,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:30:19,964 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 17:30:19,965 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 17:30:19,968 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:30:19,970 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 17:35:21,634 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 17:35:21,651 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 17:35:21,652 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 17:35:21,657 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 17:35:21,657 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 17:35:21,661 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:40:28,392 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 17:40:28,395 WARNING core: Account 2: connect timed out after 35s
2026-08-22 17:40:28,396 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 17:40:28,396 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 17:40:28,397 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 17:40:28,398 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-22 17:40:28,398 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-22 17:40:53,043 INFO core: Event loop thread started, running loop forever
2026-08-22 17:40:53,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 17:40:53,350 INFO core: _init_accounts coroutine started
2026-08-22 17:40:53,351 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 17:40:53,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:45:23,686 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:45:23,687 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 17:45:23,688 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 17:50:04,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 17:55:11,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 17:55:11,363 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-22 17:55:11,363 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 17:55:11,363 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-22 17:55:11,363 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 17:55:11,363 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 17:55:20,717 INFO core: Event loop thread started, running loop forever
2026-08-22 17:55:21,018 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 17:55:21,022 INFO core: _init_accounts coroutine started
2026-08-22 17:55:21,024 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 17:55:21,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:00:27,410 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 18:00:27,411 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 18:00:27,411 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-22 18:00:27,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 18:00:27,412 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-22 18:00:27,412 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 18:00:27,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-22 18:00:27,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 18:00:27,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 18:00:40,099 INFO core: Event loop thread started, running loop forever
2026-08-22 18:00:40,400 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:00:40,405 INFO core: _init_accounts coroutine started
2026-08-22 18:00:40,405 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:00:40,417 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:05:30,774 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:05:30,775 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 18:05:30,776 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 18:10:20,743 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 18:10:20,750 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 18:10:20,762 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 18:10:20,762 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 18:10:20,766 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 18:10:20,767 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 18:10:20,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:15:27,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 18:15:27,411 WARNING core: Account 2: connect timed out after 35s
2026-08-22 18:15:27,411 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 18:15:27,412 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 18:15:27,412 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 18:15:27,414 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-22 18:15:27,414 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-22 18:15:52,375 INFO core: Event loop thread started, running loop forever
2026-08-22 18:15:52,675 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:15:52,681 INFO core: _init_accounts coroutine started
2026-08-22 18:15:52,682 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:15:52,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:20:20,951 INFO core: Event loop thread started, running loop forever
2026-08-22 18:20:21,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:20:21,256 INFO core: _init_accounts coroutine started
2026-08-22 18:20:21,257 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:20:21,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:25:13,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 18:25:13,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 18:25:13,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:25:13,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 18:30:34,293 INFO core: Event loop thread started, running loop forever
2026-08-22 18:30:34,594 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:30:34,600 INFO core: _init_accounts coroutine started
2026-08-22 18:30:34,601 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:30:34,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:35:13,952 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:40:19,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 18:40:19,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 18:40:19,392 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-22 18:40:19,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 18:40:19,393 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-22 18:40:19,393 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 18:40:19,393 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-22 18:40:19,393 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 18:40:19,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 18:40:43,443 INFO core: Event loop thread started, running loop forever
2026-08-22 18:40:43,744 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:40:43,749 INFO core: _init_accounts coroutine started
2026-08-22 18:40:43,749 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:40:43,760 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:45:23,075 INFO core: Event loop thread started, running loop forever
2026-08-22 18:45:23,379 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:45:23,386 INFO core: _init_accounts coroutine started
2026-08-22 18:45:23,387 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:45:23,397 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:45:23,397 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-22 18:50:34,329 INFO core: Event loop thread started, running loop forever
2026-08-22 18:50:34,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:50:34,635 INFO core: _init_accounts coroutine started
2026-08-22 18:50:34,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:50:34,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:55:08,631 INFO core: Event loop thread started, running loop forever
2026-08-22 18:55:08,932 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 18:55:08,936 INFO core: _init_accounts coroutine started
2026-08-22 18:55:08,937 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 18:55:08,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 18:55:41,657 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-08-22 19:00:15,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 19:00:15,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 19:00:15,420 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 19:00:15,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 19:00:27,575 INFO core: Event loop thread started, running loop forever
2026-08-22 19:00:27,876 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 19:00:27,881 INFO core: _init_accounts coroutine started
2026-08-22 19:00:27,882 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 19:00:27,888 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:05:28,110 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:10:32,308 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 19:10:32,308 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 19:10:32,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 19:10:32,311 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 19:10:32,324 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 19:10:32,324 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 19:10:32,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:10:32,331 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 19:10:32,332 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 19:15:07,340 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 19:15:15,590 INFO core: Event loop thread started, running loop forever
2026-08-22 19:15:15,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 19:15:15,896 INFO core: _init_accounts coroutine started
2026-08-22 19:15:15,896 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 19:15:15,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:20:06,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:25:13,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 19:25:19,206 INFO core: Event loop thread started, running loop forever
2026-08-22 19:25:19,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 19:25:19,511 INFO core: _init_accounts coroutine started
2026-08-22 19:25:19,512 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 19:25:19,527 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 19:25:19,527 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 19:25:19,528 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 19:25:19,530 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 19:25:19,539 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:30:11,462 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 19:30:11,463 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 19:30:11,470 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 19:30:11,471 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 19:30:11,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:35:23,576 INFO core: Event loop thread started, running loop forever
2026-08-22 19:35:23,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 19:35:23,884 INFO core: _init_accounts coroutine started
2026-08-22 19:35:23,885 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 19:35:23,893 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:40:04,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:40:04,950 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 19:45:03,440 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 19:45:03,462 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 19:45:03,474 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 19:45:03,500 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 19:45:03,500 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 19:45:03,509 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 19:45:03,511 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-22 19:45:03,511 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:50:08,081 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 19:50:08,081 WARNING core: Account 2: connect timed out after 35s
2026-08-22 19:50:08,082 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-22 19:50:08,082 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-22 19:50:08,083 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 19:50:08,084 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-22 19:50:08,085 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-22 19:50:08,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 19:55:14,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-22 19:55:14,410 WARNING core: Account 2: connect timed out after 35s
2026-08-22 19:55:14,411 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-22 19:55:14,411 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-22 19:55:14,412 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-22 19:55:14,414 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-22 19:55:14,414 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-22 19:55:34,426 INFO core: Event loop thread started, running loop forever
2026-08-22 19:55:34,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 19:55:34,734 INFO core: _init_accounts coroutine started
2026-08-22 19:55:34,735 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 19:55:34,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:00:51,764 INFO core: Event loop thread started, running loop forever
2026-08-22 20:00:52,065 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 20:00:52,073 INFO core: _init_accounts coroutine started
2026-08-22 20:00:52,073 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 20:00:52,086 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 20:00:52,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 20:00:52,088 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 20:00:52,090 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 20:00:52,099 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:05:46,522 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:10:27,241 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 20:10:27,244 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 20:10:27,247 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:15:27,560 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 20:15:27,598 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:20:30,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:25:38,198 INFO core: Event loop thread started, running loop forever
2026-08-22 20:25:38,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 20:25:38,503 INFO core: _init_accounts coroutine started
2026-08-22 20:25:38,504 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 20:25:38,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:30:04,314 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 20:30:04,342 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:35:22,896 INFO core: Event loop thread started, running loop forever
2026-08-22 20:35:23,198 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 20:35:23,203 INFO core: _init_accounts coroutine started
2026-08-22 20:35:23,204 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 20:35:23,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:40:04,489 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:45:44,673 INFO core: Event loop thread started, running loop forever
2026-08-22 20:45:44,974 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 20:45:44,979 INFO core: _init_accounts coroutine started
2026-08-22 20:45:44,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 20:45:44,988 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:45:44,990 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 20:45:45,006 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 20:45:45,008 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 20:45:45,009 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 20:50:33,550 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 20:55:23,131 INFO core: Event loop thread started, running loop forever
2026-08-22 20:55:23,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 20:55:23,438 INFO core: _init_accounts coroutine started
2026-08-22 20:55:23,439 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 20:55:23,448 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:00:29,370 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 21:00:49,629 INFO core: Event loop thread started, running loop forever
2026-08-22 21:00:49,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 21:00:49,937 INFO core: _init_accounts coroutine started
2026-08-22 21:00:49,938 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 21:00:49,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:05:44,966 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:10:50,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 21:10:50,428 INFO core: Event loop thread started, running loop forever
2026-08-22 21:10:50,729 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 21:10:50,735 INFO core: _init_accounts coroutine started
2026-08-22 21:10:50,735 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 21:10:50,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:15:48,507 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 21:15:48,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:20:29,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:25:28,493 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-22 21:25:28,503 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:30:35,423 INFO core: _init_accounts coroutine started
2026-08-22 21:30:35,424 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 21:30:46,030 INFO core: Event loop thread started, running loop forever
2026-08-22 21:30:46,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 21:30:46,339 INFO core: _init_accounts coroutine started
2026-08-22 21:30:46,339 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 21:30:46,345 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:35:43,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 21:35:43,104 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 21:35:43,105 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 21:35:43,107 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 21:35:43,108 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:40:30,343 INFO core: Event loop thread started, running loop forever
2026-08-22 21:40:30,644 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 21:40:30,652 INFO core: _init_accounts coroutine started
2026-08-22 21:40:30,653 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 21:40:30,667 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:45:29,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 21:45:29,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 21:45:29,420 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:45:29,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 21:50:06,594 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 21:50:06,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 21:55:08,852 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 21:55:08,853 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 21:55:08,857 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:00:14,365 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 22:00:23,497 INFO core: Event loop thread started, running loop forever
2026-08-22 22:00:23,798 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:00:23,802 INFO core: _init_accounts coroutine started
2026-08-22 22:00:23,803 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:00:23,810 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:05:12,828 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 22:05:12,829 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 22:05:12,831 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 22:05:12,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:10:45,254 INFO core: Event loop thread started, running loop forever
2026-08-22 22:10:45,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:10:45,563 INFO core: _init_accounts coroutine started
2026-08-22 22:10:45,563 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:10:45,577 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:15:07,377 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 22:15:20,406 INFO core: Event loop thread started, running loop forever
2026-08-22 22:15:20,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:15:20,712 INFO core: _init_accounts coroutine started
2026-08-22 22:15:20,713 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:15:20,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:20:45,697 INFO core: Event loop thread started, running loop forever
2026-08-22 22:20:45,998 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:20:46,003 INFO core: _init_accounts coroutine started
2026-08-22 22:20:46,004 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:20:46,027 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:25:52,474 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-22 22:25:52,835 INFO core: Event loop thread started, running loop forever
2026-08-22 22:25:53,136 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:25:53,142 INFO core: _init_accounts coroutine started
2026-08-22 22:25:53,142 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:25:53,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:30:35,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:35:43,792 INFO core: Event loop thread started, running loop forever
2026-08-22 22:35:44,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:35:44,099 INFO core: _init_accounts coroutine started
2026-08-22 22:35:44,101 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:35:44,108 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:40:33,257 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 22:40:33,258 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 22:40:33,259 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 22:40:33,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:45:18,868 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 22:45:18,876 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:50:27,481 INFO core: Event loop thread started, running loop forever
2026-08-22 22:50:27,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:50:27,787 INFO core: _init_accounts coroutine started
2026-08-22 22:50:27,788 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:50:27,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:55:34,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 22:55:34,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 22:55:34,395 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-22 22:55:34,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 22:55:34,395 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-22 22:55:34,396 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 22:55:34,528 INFO core: Event loop thread started, running loop forever
2026-08-22 22:55:34,829 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 22:55:34,838 INFO core: _init_accounts coroutine started
2026-08-22 22:55:34,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 22:55:34,840 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 22:55:34,847 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-22 23:00:20,837 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:05:18,274 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-22 23:05:18,276 INFO core: _init_accounts coroutine started
2026-08-22 23:05:18,278 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 23:05:18,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:10:34,804 INFO core: Event loop thread started, running loop forever
2026-08-22 23:10:35,106 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 23:10:35,113 INFO core: _init_accounts coroutine started
2026-08-22 23:10:35,113 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 23:10:35,121 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:15:24,556 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-22 23:15:24,582 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:20:44,942 INFO core: Event loop thread started, running loop forever
2026-08-22 23:20:45,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 23:20:45,249 INFO core: _init_accounts coroutine started
2026-08-22 23:20:45,249 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 23:20:45,255 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:25:10,822 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:30:13,937 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:35:34,984 INFO core: Event loop thread started, running loop forever
2026-08-22 23:35:35,285 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 23:35:35,289 INFO core: _init_accounts coroutine started
2026-08-22 23:35:35,290 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 23:35:35,300 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:40:40,377 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-22 23:40:40,377 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-22 23:40:40,379 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-22 23:40:40,383 INFO core: _init_accounts_inner: reloading LLM config
2026-08-22 23:40:40,388 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:45:11,359 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:50:12,481 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-22 23:50:12,483 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-22 23:50:12,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-22 23:55:19,403 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-22 23:55:38,012 INFO core: Event loop thread started, running loop forever
2026-08-22 23:55:38,313 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-22 23:55:38,319 INFO core: _init_accounts coroutine started
2026-08-22 23:55:38,321 INFO core: _init_accounts_inner: starting DB migrations
2026-08-22 23:55:38,326 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:00:09,244 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:05:16,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 00:05:16,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 00:05:16,436 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-23 00:05:16,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 00:05:16,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-23 00:05:16,436 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 00:05:16,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-23 00:05:16,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 00:05:16,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 00:05:34,269 INFO core: Event loop thread started, running loop forever
2026-08-23 00:05:34,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 00:05:34,575 INFO core: _init_accounts coroutine started
2026-08-23 00:05:34,576 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 00:05:34,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:10:08,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:15:08,619 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 00:15:08,619 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 00:15:08,623 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 00:15:08,626 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 00:15:08,637 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:20:15,450 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 00:20:19,444 INFO core: Event loop thread started, running loop forever
2026-08-23 00:20:19,746 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 00:20:19,750 INFO core: _init_accounts coroutine started
2026-08-23 00:20:19,751 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 00:20:19,760 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:25:26,386 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 00:25:34,373 INFO core: Event loop thread started, running loop forever
2026-08-23 00:25:34,674 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 00:25:34,680 INFO core: _init_accounts coroutine started
2026-08-23 00:25:34,680 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 00:25:34,686 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:30:26,831 INFO core: Event loop thread started, running loop forever
2026-08-23 00:30:27,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 00:30:27,138 INFO core: _init_accounts coroutine started
2026-08-23 00:30:27,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 00:30:27,145 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:35:33,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 00:35:48,659 INFO core: Event loop thread started, running loop forever
2026-08-23 00:35:48,960 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 00:35:48,965 INFO core: _init_accounts coroutine started
2026-08-23 00:35:48,967 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 00:35:48,975 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:40:44,893 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 00:40:44,894 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 00:40:44,895 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 00:40:44,896 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 00:40:44,906 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 00:40:44,906 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 00:40:44,911 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 00:40:44,912 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 00:40:44,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:45:11,715 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 00:45:11,716 WARNING core: Account 2: connect timed out after 35s
2026-08-23 00:45:11,717 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 00:45:11,717 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 00:45:11,718 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 00:45:11,719 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 00:45:11,720 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 00:45:11,724 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:50:17,385 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 00:50:17,386 WARNING core: Account 2: connect timed out after 35s
2026-08-23 00:50:45,358 INFO core: Event loop thread started, running loop forever
2026-08-23 00:50:45,659 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 00:50:45,663 INFO core: _init_accounts coroutine started
2026-08-23 00:50:45,664 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 00:50:45,680 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 00:55:10,816 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:00:16,428 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 01:00:38,883 INFO core: Event loop thread started, running loop forever
2026-08-23 01:00:39,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 01:00:39,189 INFO core: _init_accounts coroutine started
2026-08-23 01:00:39,191 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 01:00:39,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:05:23,842 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:10:29,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 01:10:38,550 INFO core: Event loop thread started, running loop forever
2026-08-23 01:10:38,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 01:10:38,855 INFO core: _init_accounts coroutine started
2026-08-23 01:10:38,856 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 01:10:38,865 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:15:40,138 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:20:39,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:20:39,789 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 01:25:32,358 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 01:25:32,366 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 01:25:32,369 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:25:32,369 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 01:30:47,291 INFO core: Event loop thread started, running loop forever
2026-08-23 01:30:47,595 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 01:30:47,601 INFO core: _init_accounts coroutine started
2026-08-23 01:30:47,601 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 01:30:47,613 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:35:23,104 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:40:17,559 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 01:40:17,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:45:21,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:50:29,380 INFO core: Event loop thread started, running loop forever
2026-08-23 01:50:29,682 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 01:50:29,687 INFO core: _init_accounts coroutine started
2026-08-23 01:50:29,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 01:50:29,695 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 01:55:34,581 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 01:55:34,581 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 01:55:34,582 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:00:25,603 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 02:00:25,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:05:31,453 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 02:05:31,454 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 02:05:31,454 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-23 02:05:31,455 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 02:05:31,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 02:05:34,210 INFO core: Event loop thread started, running loop forever
2026-08-23 02:05:34,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 02:05:34,517 INFO core: _init_accounts coroutine started
2026-08-23 02:05:34,519 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 02:05:34,529 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:10:36,122 INFO core: Event loop thread started, running loop forever
2026-08-23 02:10:36,423 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 02:10:36,427 INFO core: _init_accounts coroutine started
2026-08-23 02:10:36,428 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 02:10:36,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:10:41,120 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 02:15:23,440 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:20:30,390 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 02:20:30,391 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 02:20:30,392 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-23 02:20:45,480 INFO core: Event loop thread started, running loop forever
2026-08-23 02:20:45,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 02:20:45,788 INFO core: _init_accounts coroutine started
2026-08-23 02:20:45,788 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 02:20:45,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:25:52,430 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 02:25:52,603 INFO core: Event loop thread started, running loop forever
2026-08-23 02:25:52,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 02:25:52,908 INFO core: _init_accounts coroutine started
2026-08-23 02:25:52,910 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 02:25:52,924 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:30:35,166 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 02:30:35,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:35:36,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:40:51,385 INFO core: Event loop thread started, running loop forever
2026-08-23 02:40:51,686 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 02:40:51,692 INFO core: _init_accounts coroutine started
2026-08-23 02:40:51,693 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 02:40:51,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:45:05,170 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 02:45:05,170 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 02:45:05,173 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 02:45:05,177 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:45:05,178 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 02:50:35,704 INFO core: Event loop thread started, running loop forever
2026-08-23 02:50:36,005 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 02:50:36,011 INFO core: _init_accounts coroutine started
2026-08-23 02:50:36,011 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 02:50:36,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 02:55:42,390 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 02:55:43,754 INFO core: Event loop thread started, running loop forever
2026-08-23 02:55:44,055 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 02:55:44,059 INFO core: _init_accounts coroutine started
2026-08-23 02:55:44,060 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 02:55:44,069 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:00:22,780 INFO core: Event loop thread started, running loop forever
2026-08-23 03:00:23,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 03:00:23,086 INFO core: _init_accounts coroutine started
2026-08-23 03:00:23,087 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 03:00:23,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:05:40,026 INFO core: Event loop thread started, running loop forever
2026-08-23 03:05:40,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 03:05:40,332 INFO core: _init_accounts coroutine started
2026-08-23 03:05:40,333 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 03:05:40,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:10:44,265 INFO core: Event loop thread started, running loop forever
2026-08-23 03:10:44,566 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 03:10:44,570 INFO core: _init_accounts coroutine started
2026-08-23 03:10:44,570 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 03:10:44,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:15:46,157 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:20:29,106 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 03:20:29,108 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 03:20:29,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 03:20:29,112 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 03:20:29,113 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:25:48,638 INFO core: Event loop thread started, running loop forever
2026-08-23 03:25:48,939 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 03:25:48,950 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:30:39,746 INFO core: _init_accounts coroutine started
2026-08-23 03:30:39,753 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 03:30:39,761 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:30:39,767 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 03:35:30,237 INFO core: Event loop thread started, running loop forever
2026-08-23 03:35:30,538 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 03:35:30,542 INFO core: _init_accounts coroutine started
2026-08-23 03:35:30,543 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 03:35:30,549 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:40:30,900 INFO core: Event loop thread started, running loop forever
2026-08-23 03:40:31,201 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 03:40:31,207 INFO core: _init_accounts coroutine started
2026-08-23 03:40:31,207 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 03:40:31,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:45:37,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 03:45:47,903 INFO core: Event loop thread started, running loop forever
2026-08-23 03:45:48,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 03:45:48,207 INFO core: _init_accounts coroutine started
2026-08-23 03:45:48,208 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 03:45:48,216 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:50:51,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 03:55:28,759 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 03:55:28,760 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 03:55:28,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:00:32,995 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 04:00:32,998 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 04:00:32,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:05:21,693 INFO core: Event loop thread started, running loop forever
2026-08-23 04:05:21,995 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 04:05:21,999 INFO core: _init_accounts coroutine started
2026-08-23 04:05:22,000 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 04:05:22,011 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:05:22,013 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 04:05:22,014 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 04:10:28,365 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 04:10:28,366 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-23 04:10:28,367 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 04:10:28,367 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-23 04:10:28,367 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 04:10:28,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 04:10:51,335 INFO core: Event loop thread started, running loop forever
2026-08-23 04:10:51,637 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 04:10:51,642 INFO core: _init_accounts coroutine started
2026-08-23 04:10:51,643 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 04:10:51,650 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:15:22,623 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 04:15:22,626 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 04:15:22,627 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 04:15:22,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:20:28,380 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 04:20:28,396 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 04:20:28,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 04:20:28,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 04:20:28,753 INFO core: Event loop thread started, running loop forever
2026-08-23 04:20:29,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 04:20:29,058 INFO core: _init_accounts coroutine started
2026-08-23 04:20:29,058 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 04:20:29,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:25:08,624 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:30:15,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 04:30:15,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 04:30:15,403 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-23 04:30:15,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 04:30:15,404 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-23 04:30:44,885 INFO core: Event loop thread started, running loop forever
2026-08-23 04:30:45,187 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 04:30:45,191 INFO core: _init_accounts coroutine started
2026-08-23 04:30:45,193 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 04:30:45,199 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:35:03,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:40:09,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 04:40:50,063 INFO core: Event loop thread started, running loop forever
2026-08-23 04:40:50,364 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 04:40:50,370 INFO core: _init_accounts coroutine started
2026-08-23 04:40:50,371 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 04:40:50,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:45:11,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:50:13,972 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 04:50:13,972 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 04:50:13,975 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 04:55:37,364 INFO core: Event loop thread started, running loop forever
2026-08-23 04:55:37,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 04:55:37,672 INFO core: _init_accounts coroutine started
2026-08-23 04:55:37,673 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 04:55:37,678 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:00:26,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:05:07,184 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 05:05:07,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:10:04,722 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-23 05:10:04,726 INFO core: _init_accounts coroutine started
2026-08-23 05:10:04,727 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 05:10:04,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:15:46,625 INFO core: Event loop thread started, running loop forever
2026-08-23 05:15:46,926 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 05:15:46,931 INFO core: _init_accounts coroutine started
2026-08-23 05:15:46,933 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 05:15:46,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:20:17,371 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:25:37,867 INFO core: Event loop thread started, running loop forever
2026-08-23 05:25:38,168 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 05:25:38,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:30:43,923 INFO core: Event loop thread started, running loop forever
2026-08-23 05:30:44,224 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 05:30:44,231 INFO core: _init_accounts coroutine started
2026-08-23 05:30:44,231 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 05:30:44,244 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:30:45,916 INFO core: _init_accounts coroutine started
2026-08-23 05:30:45,918 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 05:30:45,918 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 05:35:28,378 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 05:35:28,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:35:28,379 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 05:40:05,300 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 05:40:05,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:40:05,307 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 05:45:07,273 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 05:45:07,275 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 05:45:07,279 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:50:14,348 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 05:50:14,349 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 05:50:34,618 INFO core: Event loop thread started, running loop forever
2026-08-23 05:50:34,919 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 05:50:34,924 INFO core: _init_accounts coroutine started
2026-08-23 05:50:34,925 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 05:50:34,945 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 05:50:34,945 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 05:50:34,948 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 05:50:34,950 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 05:50:34,955 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 05:55:27,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:00:10,506 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:05:17,402 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 06:05:40,362 INFO core: Event loop thread started, running loop forever
2026-08-23 06:05:40,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 06:05:40,669 INFO core: _init_accounts coroutine started
2026-08-23 06:05:40,669 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 06:05:40,680 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:10:16,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 06:10:16,459 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 06:10:16,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:15:10,365 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 06:15:10,370 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-23 06:15:48,690 INFO core: Event loop thread started, running loop forever
2026-08-23 06:15:48,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 06:15:48,995 INFO core: _init_accounts coroutine started
2026-08-23 06:15:48,995 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 06:15:49,002 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:20:48,806 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:25:48,019 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:30:44,324 INFO core: Event loop thread started, running loop forever
2026-08-23 06:30:44,625 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 06:30:44,629 INFO core: _init_accounts coroutine started
2026-08-23 06:30:44,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 06:30:44,638 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:30:54,343 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 06:35:26,639 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 06:35:26,640 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:35:26,640 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 06:40:26,315 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 06:40:26,324 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 06:40:26,339 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 06:40:26,340 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 06:40:26,345 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 06:40:26,345 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:40:26,347 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 06:45:17,452 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 06:45:17,456 WARNING core: Account 2: connect timed out after 35s
2026-08-23 06:45:17,457 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 06:45:17,458 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 06:45:17,461 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 06:45:17,463 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 06:45:17,463 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 06:45:17,466 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:50:05,663 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 06:50:05,663 WARNING core: Account 2: connect timed out after 35s
2026-08-23 06:50:05,664 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-23 06:50:05,664 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-23 06:50:05,666 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 06:50:05,667 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-23 06:50:05,667 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-23 06:50:05,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 06:55:45,589 INFO core: Event loop thread started, running loop forever
2026-08-23 06:55:45,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 06:55:45,895 INFO core: _init_accounts coroutine started
2026-08-23 06:55:45,896 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 06:55:45,906 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:00:36,951 INFO core: Event loop thread started, running loop forever
2026-08-23 07:00:37,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 07:00:37,255 INFO core: _init_accounts coroutine started
2026-08-23 07:00:37,259 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 07:00:37,270 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:00:51,966 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 07:05:40,116 INFO core: Event loop thread started, running loop forever
2026-08-23 07:05:40,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 07:05:40,433 INFO core: _init_accounts coroutine started
2026-08-23 07:05:40,433 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 07:05:40,439 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:10:05,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:15:10,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:15:10,921 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 07:15:10,921 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 07:20:07,461 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 07:20:07,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:25:48,187 INFO core: Event loop thread started, running loop forever
2026-08-23 07:25:48,488 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 07:25:48,492 INFO core: _init_accounts coroutine started
2026-08-23 07:25:48,493 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 07:25:48,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:30:43,319 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:35:04,621 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 07:35:04,623 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 07:35:04,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:40:07,207 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 07:40:07,211 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 07:40:07,225 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:45:13,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:45:13,537 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 07:45:13,537 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 07:50:20,407 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 07:50:20,409 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 07:50:23,399 INFO core: Event loop thread started, running loop forever
2026-08-23 07:50:23,700 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 07:50:23,706 INFO core: _init_accounts coroutine started
2026-08-23 07:50:23,707 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 07:50:23,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 07:55:24,289 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 07:55:24,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:00:37,339 INFO core: Event loop thread started, running loop forever
2026-08-23 08:00:37,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 08:00:37,644 INFO core: _init_accounts coroutine started
2026-08-23 08:00:37,647 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 08:00:37,658 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:05:33,237 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 08:05:33,237 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 08:05:33,240 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 08:05:33,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:05:33,243 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 08:10:07,225 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 08:10:07,225 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 08:10:07,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:15:47,495 INFO core: Event loop thread started, running loop forever
2026-08-23 08:15:47,796 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 08:15:47,801 INFO core: _init_accounts coroutine started
2026-08-23 08:15:47,802 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 08:15:47,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:20:12,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:25:11,363 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 08:25:11,369 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 08:25:11,370 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 08:25:11,372 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 08:25:11,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 08:25:11,387 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:25:11,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 08:30:31,450 INFO core: Event loop thread started, running loop forever
2026-08-23 08:30:31,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 08:30:31,756 INFO core: _init_accounts coroutine started
2026-08-23 08:30:31,758 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 08:30:31,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:35:38,459 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 08:35:38,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 08:35:38,462 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-23 08:35:47,653 INFO core: Event loop thread started, running loop forever
2026-08-23 08:35:47,954 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 08:35:47,958 INFO core: _init_accounts coroutine started
2026-08-23 08:35:47,959 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 08:35:47,969 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:40:14,145 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:40:14,146 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 08:40:14,147 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 08:40:14,148 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 08:45:43,291 INFO core: Event loop thread started, running loop forever
2026-08-23 08:45:43,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 08:45:43,600 INFO core: _init_accounts coroutine started
2026-08-23 08:45:43,601 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 08:45:43,610 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:45:43,614 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 08:50:22,953 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 08:50:22,965 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 08:50:22,969 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 08:55:44,311 INFO core: Event loop thread started, running loop forever
2026-08-23 08:55:44,612 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 08:55:44,616 INFO core: _init_accounts coroutine started
2026-08-23 08:55:44,617 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 08:55:44,626 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:00:51,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 09:00:51,391 INFO core: Event loop thread started, running loop forever
2026-08-23 09:00:51,692 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 09:00:51,695 INFO core: _init_accounts coroutine started
2026-08-23 09:00:51,697 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 09:00:51,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:05:47,109 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 09:05:47,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:10:04,498 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:15:45,996 INFO core: Event loop thread started, running loop forever
2026-08-23 09:15:46,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 09:15:46,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:20:47,093 INFO core: _init_accounts coroutine started
2026-08-23 09:20:47,094 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 09:20:47,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:20:47,111 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 09:20:47,111 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 09:25:13,951 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 09:25:13,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:30:09,634 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 09:30:09,638 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 09:30:09,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:35:48,807 INFO core: Event loop thread started, running loop forever
2026-08-23 09:35:49,108 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 09:35:49,114 INFO core: _init_accounts coroutine started
2026-08-23 09:35:49,114 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 09:35:49,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:40:17,665 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:40:17,665 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 09:45:23,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 09:45:45,830 INFO core: Event loop thread started, running loop forever
2026-08-23 09:45:46,131 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 09:45:46,146 INFO core: _init_accounts coroutine started
2026-08-23 09:45:46,146 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 09:45:46,152 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:50:30,109 INFO core: Event loop thread started, running loop forever
2026-08-23 09:50:30,410 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 09:50:30,417 INFO core: _init_accounts coroutine started
2026-08-23 09:50:30,418 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 09:50:30,422 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 09:50:53,147 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-08-23 09:55:29,942 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 09:55:29,943 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 09:55:29,945 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 09:55:29,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:00:28,634 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 10:00:28,650 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 10:00:28,650 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 10:00:28,656 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 10:00:28,658 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 10:00:28,665 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:05:17,269 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 10:05:17,270 WARNING core: Account 2: connect timed out after 35s
2026-08-23 10:05:17,271 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 10:05:17,271 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 10:05:17,272 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 10:05:17,274 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 10:05:17,275 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 10:05:17,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:10:52,596 INFO core: Event loop thread started, running loop forever
2026-08-23 10:10:52,897 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 10:10:52,904 INFO core: _init_accounts coroutine started
2026-08-23 10:10:52,905 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 10:10:52,916 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 10:10:52,916 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 10:10:52,919 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 10:10:52,920 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 10:10:52,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:15:06,054 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:20:12,030 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:25:04,283 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 10:25:04,283 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 10:25:04,291 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 10:25:04,292 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 10:25:04,300 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:30:11,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 10:30:11,416 WARNING core: Account 2: connect timed out after 35s
2026-08-23 10:30:11,416 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 10:30:11,417 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 10:30:11,418 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 10:30:11,419 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 10:30:11,420 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 10:30:35,400 INFO core: Event loop thread started, running loop forever
2026-08-23 10:30:35,701 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 10:30:35,706 INFO core: _init_accounts coroutine started
2026-08-23 10:30:35,708 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 10:30:35,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:35:46,314 INFO core: Event loop thread started, running loop forever
2026-08-23 10:35:46,615 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 10:35:46,621 INFO core: _init_accounts coroutine started
2026-08-23 10:35:46,621 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 10:35:46,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:40:33,287 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:45:29,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 10:45:29,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 10:45:29,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 10:45:29,415 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 10:45:29,428 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:50:41,525 INFO core: Event loop thread started, running loop forever
2026-08-23 10:50:41,827 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 10:50:41,832 INFO core: _init_accounts coroutine started
2026-08-23 10:50:41,833 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 10:50:41,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 10:55:32,269 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:00:29,202 INFO core: Event loop thread started, running loop forever
2026-08-23 11:00:29,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 11:00:29,507 INFO core: _init_accounts coroutine started
2026-08-23 11:00:29,507 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 11:00:29,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:05:04,601 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:10:11,431 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 11:10:49,589 INFO core: Event loop thread started, running loop forever
2026-08-23 11:10:49,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 11:10:49,895 INFO core: _init_accounts coroutine started
2026-08-23 11:10:49,896 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 11:10:49,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:15:29,561 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 11:15:29,581 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:20:34,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:25:31,995 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-23 11:25:31,997 INFO core: _init_accounts coroutine started
2026-08-23 11:25:31,997 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 11:25:32,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:30:07,379 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 11:30:07,393 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:35:24,115 INFO core: Event loop thread started, running loop forever
2026-08-23 11:35:24,421 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 11:35:24,429 INFO core: _init_accounts coroutine started
2026-08-23 11:35:24,429 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 11:35:24,438 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:40:31,381 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 11:40:34,078 INFO core: Event loop thread started, running loop forever
2026-08-23 11:40:34,379 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 11:40:34,384 INFO core: _init_accounts coroutine started
2026-08-23 11:40:34,384 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 11:40:34,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 11:40:34,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 11:40:34,397 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:40:34,398 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 11:45:40,790 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 11:45:40,791 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-23 11:45:40,796 INFO core: Event loop thread started, running loop forever
2026-08-23 11:45:41,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 11:45:41,101 INFO core: _init_accounts coroutine started
2026-08-23 11:45:41,102 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 11:45:41,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:50:05,899 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 11:50:05,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 11:50:05,900 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 11:50:05,903 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 11:55:26,127 INFO core: Event loop thread started, running loop forever
2026-08-23 11:55:26,428 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 11:55:26,432 INFO core: _init_accounts coroutine started
2026-08-23 11:55:26,433 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 11:55:26,442 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:00:43,987 INFO core: Event loop thread started, running loop forever
2026-08-23 12:00:44,298 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 12:00:44,304 INFO core: _init_accounts coroutine started
2026-08-23 12:00:44,304 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 12:00:44,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:05:38,965 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 12:05:38,973 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:10:07,094 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:15:43,796 INFO core: Event loop thread started, running loop forever
2026-08-23 12:15:44,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 12:15:44,102 INFO core: _init_accounts coroutine started
2026-08-23 12:15:44,104 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 12:15:44,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:20:05,463 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:25:12,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 12:25:12,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 12:25:12,402 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-23 12:25:12,403 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 12:25:12,403 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-23 12:25:12,403 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 12:25:12,403 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-23 12:25:12,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 12:25:12,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 12:25:29,774 INFO core: Event loop thread started, running loop forever
2026-08-23 12:25:30,076 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 12:25:30,083 INFO core: _init_accounts coroutine started
2026-08-23 12:25:30,084 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 12:25:30,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:30:22,244 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:35:37,116 INFO core: Event loop thread started, running loop forever
2026-08-23 12:35:37,417 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 12:35:37,421 INFO core: _init_accounts coroutine started
2026-08-23 12:35:37,423 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 12:35:37,438 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:35:37,442 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 12:35:37,442 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 12:35:37,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 12:35:37,447 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 12:40:11,599 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:45:26,898 INFO core: Event loop thread started, running loop forever
2026-08-23 12:45:27,200 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 12:45:27,206 INFO core: _init_accounts coroutine started
2026-08-23 12:45:27,207 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 12:45:27,219 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:50:06,528 INFO core: Event loop thread started, running loop forever
2026-08-23 12:50:06,830 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 12:50:06,836 INFO core: _init_accounts coroutine started
2026-08-23 12:50:06,836 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 12:50:06,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 12:50:33,569 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 12:55:13,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 12:55:22,641 INFO core: Event loop thread started, running loop forever
2026-08-23 12:55:22,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 12:55:22,948 INFO core: _init_accounts coroutine started
2026-08-23 12:55:22,949 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 12:55:22,960 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:00:28,409 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-23 13:00:46,577 INFO core: Event loop thread started, running loop forever
2026-08-23 13:00:46,878 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 13:00:46,886 INFO core: _init_accounts coroutine started
2026-08-23 13:00:46,887 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 13:00:46,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:05:18,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:10:20,509 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 13:10:20,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:15:11,595 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:20:42,915 INFO core: Event loop thread started, running loop forever
2026-08-23 13:20:43,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 13:20:43,221 INFO core: _init_accounts coroutine started
2026-08-23 13:20:43,222 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 13:20:43,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:25:09,178 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 13:25:09,178 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 13:25:09,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:30:16,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 13:30:38,513 INFO core: Event loop thread started, running loop forever
2026-08-23 13:30:38,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 13:30:38,818 INFO core: _init_accounts coroutine started
2026-08-23 13:30:38,820 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 13:30:38,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:35:12,670 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 13:35:12,671 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 13:35:12,674 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 13:35:12,676 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:35:12,677 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 13:40:51,166 INFO core: Event loop thread started, running loop forever
2026-08-23 13:40:51,467 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 13:40:51,471 INFO core: _init_accounts coroutine started
2026-08-23 13:40:51,473 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 13:40:51,484 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:45:48,696 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 13:45:48,698 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 13:45:48,701 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 13:45:48,705 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 13:45:48,707 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:50:52,917 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 13:50:52,918 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 13:50:52,922 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 13:50:52,923 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 13:50:52,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 13:55:16,058 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 13:55:16,059 WARNING core: Account 2: connect timed out after 35s
2026-08-23 13:55:16,060 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 13:55:16,061 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 13:55:16,062 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 13:55:16,063 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 13:55:16,063 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 13:55:16,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:00:23,386 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 14:00:23,388 WARNING core: Account 2: connect timed out after 35s
2026-08-23 14:00:52,529 INFO core: Event loop thread started, running loop forever
2026-08-23 14:00:52,831 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 14:00:52,849 INFO core: _init_accounts coroutine started
2026-08-23 14:00:52,850 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 14:00:52,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:05:07,833 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:10:13,444 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 14:10:37,354 INFO core: Event loop thread started, running loop forever
2026-08-23 14:10:37,655 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 14:10:37,659 INFO core: _init_accounts coroutine started
2026-08-23 14:10:37,660 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 14:10:37,671 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:15:26,212 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 14:15:26,213 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 14:15:26,215 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 14:15:26,218 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 14:15:26,220 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:20:42,411 INFO core: Event loop thread started, running loop forever
2026-08-23 14:20:42,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 14:20:42,716 INFO core: _init_accounts coroutine started
2026-08-23 14:20:42,717 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 14:20:42,727 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:25:19,338 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 14:25:19,354 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:30:05,750 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:35:20,722 INFO core: Event loop thread started, running loop forever
2026-08-23 14:35:21,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 14:35:21,028 INFO core: _init_accounts coroutine started
2026-08-23 14:35:21,029 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 14:35:21,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:40:16,494 INFO core: Event loop thread started, running loop forever
2026-08-23 14:40:16,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 14:40:16,800 INFO core: _init_accounts coroutine started
2026-08-23 14:40:16,801 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 14:40:16,811 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:45:41,322 INFO core: Event loop thread started, running loop forever
2026-08-23 14:45:41,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 14:45:41,628 INFO core: _init_accounts coroutine started
2026-08-23 14:45:41,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 14:45:41,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:50:21,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 14:50:21,898 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 14:50:21,898 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 14:55:42,475 INFO core: Event loop thread started, running loop forever
2026-08-23 14:55:42,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 14:55:42,782 INFO core: _init_accounts coroutine started
2026-08-23 14:55:42,783 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 14:55:42,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:00:47,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:05:24,027 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 15:05:24,028 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 15:05:24,035 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:10:16,634 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 15:10:16,635 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 15:10:16,650 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 15:10:16,651 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:15:22,373 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 15:15:27,102 INFO core: Event loop thread started, running loop forever
2026-08-23 15:15:27,402 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 15:15:27,408 INFO core: _init_accounts coroutine started
2026-08-23 15:15:27,408 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 15:15:27,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:20:28,091 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 15:20:28,099 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:25:18,727 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:30:38,123 INFO core: Event loop thread started, running loop forever
2026-08-23 15:30:38,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 15:30:38,429 INFO core: _init_accounts coroutine started
2026-08-23 15:30:38,430 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 15:30:38,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:35:09,736 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:35:09,737 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 15:40:11,672 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 15:40:11,676 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 15:40:11,678 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 15:40:11,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:45:04,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:50:28,008 INFO core: Event loop thread started, running loop forever
2026-08-23 15:50:28,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 15:50:28,313 INFO core: _init_accounts coroutine started
2026-08-23 15:50:28,313 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 15:50:28,322 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 15:55:35,363 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 15:55:50,424 INFO core: Event loop thread started, running loop forever
2026-08-23 15:55:50,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 15:55:50,729 INFO core: _init_accounts coroutine started
2026-08-23 15:55:50,731 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 15:55:50,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:00:45,515 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 16:00:45,517 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 16:00:45,520 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 16:00:45,523 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:00:45,526 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 16:05:32,164 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:10:07,665 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 16:10:07,665 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 16:10:07,669 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:15:10,307 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 16:15:10,321 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:20:06,925 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:25:37,879 INFO core: Event loop thread started, running loop forever
2026-08-23 16:25:38,180 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 16:25:38,184 INFO core: _init_accounts coroutine started
2026-08-23 16:25:38,186 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 16:25:38,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:25:38,202 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 16:25:38,202 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 16:25:38,203 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 16:25:38,207 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 16:30:11,004 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:35:13,352 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:40:52,058 INFO core: Event loop thread started, running loop forever
2026-08-23 16:40:52,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 16:40:52,365 INFO core: _init_accounts coroutine started
2026-08-23 16:40:52,366 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 16:40:52,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:45:17,145 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:50:16,565 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 16:50:16,567 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 16:50:16,571 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 16:50:16,574 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 16:50:16,575 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 16:55:23,379 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 16:55:23,380 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 16:55:23,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 16:55:45,976 INFO core: Event loop thread started, running loop forever
2026-08-23 16:55:46,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 16:55:46,288 INFO core: _init_accounts coroutine started
2026-08-23 16:55:46,288 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 16:55:46,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:00:13,362 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:00:13,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 17:00:13,363 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 17:05:41,151 INFO core: Event loop thread started, running loop forever
2026-08-23 17:05:41,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 17:05:41,468 INFO core: _init_accounts coroutine started
2026-08-23 17:05:41,468 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 17:05:41,479 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:10:31,558 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:10:31,558 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 17:10:31,559 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 17:15:19,845 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:20:16,185 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 17:20:16,189 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:25:18,498 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 17:25:18,511 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:30:25,254 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 17:30:25,255 INFO core: Event loop thread started, running loop forever
2026-08-23 17:30:25,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 17:30:25,562 INFO core: _init_accounts coroutine started
2026-08-23 17:30:25,562 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 17:30:25,569 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:35:40,163 INFO core: Event loop thread started, running loop forever
2026-08-23 17:35:40,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 17:35:40,471 INFO core: _init_accounts coroutine started
2026-08-23 17:35:40,471 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 17:35:40,482 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:40:13,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:45:07,406 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 17:45:07,426 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:50:44,296 INFO core: Event loop thread started, running loop forever
2026-08-23 17:50:44,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 17:50:44,602 INFO core: _init_accounts coroutine started
2026-08-23 17:50:44,602 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 17:50:44,613 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 17:50:44,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 17:50:44,620 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 17:55:12,680 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 17:55:12,683 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:00:50,538 INFO core: Event loop thread started, running loop forever
2026-08-23 18:00:50,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 18:00:50,845 INFO core: _init_accounts coroutine started
2026-08-23 18:00:50,846 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 18:00:50,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:05:49,576 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:10:33,806 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 18:10:33,806 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 18:10:33,808 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 18:10:33,809 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:15:45,846 INFO core: Event loop thread started, running loop forever
2026-08-23 18:15:46,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 18:15:46,154 INFO core: _init_accounts coroutine started
2026-08-23 18:15:46,155 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 18:15:46,177 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:20:30,172 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 18:20:30,173 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 18:20:30,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:20:30,185 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 18:20:30,187 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 18:25:24,554 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:30:25,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:35:26,486 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 18:35:26,488 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 18:35:26,497 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 18:35:26,498 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 18:35:26,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:40:11,642 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 18:40:11,645 WARNING core: Account 2: connect timed out after 35s
2026-08-23 18:40:11,646 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 18:40:11,647 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 18:40:11,648 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 18:40:11,650 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 18:40:11,651 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 18:40:11,674 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:45:09,864 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 18:45:09,865 WARNING core: Account 2: connect timed out after 35s
2026-08-23 18:45:09,866 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-23 18:45:09,866 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-23 18:45:09,866 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 18:45:09,867 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-23 18:45:09,868 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-23 18:45:09,873 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:50:15,444 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 18:50:15,444 WARNING core: Account 2: connect timed out after 35s
2026-08-23 18:50:15,445 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-23 18:50:39,407 INFO core: Event loop thread started, running loop forever
2026-08-23 18:50:39,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 18:50:39,712 INFO core: _init_accounts coroutine started
2026-08-23 18:50:39,715 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 18:50:39,726 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 18:55:03,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:00:09,397 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 19:00:39,340 INFO core: Event loop thread started, running loop forever
2026-08-23 19:00:39,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 19:00:39,648 INFO core: _init_accounts coroutine started
2026-08-23 19:00:39,649 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 19:00:39,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:05:27,291 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 19:05:27,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:10:49,703 INFO core: Event loop thread started, running loop forever
2026-08-23 19:10:50,004 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 19:10:50,015 INFO core: _init_accounts coroutine started
2026-08-23 19:10:50,016 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 19:10:50,024 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:15:30,876 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:15:30,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 19:15:30,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 19:20:25,567 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 19:20:25,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:25:14,723 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 19:25:14,733 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:30:38,579 INFO core: Event loop thread started, running loop forever
2026-08-23 19:30:38,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 19:30:38,884 INFO core: _init_accounts coroutine started
2026-08-23 19:30:38,886 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 19:30:38,899 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 19:30:38,899 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 19:30:38,902 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 19:30:38,904 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 19:30:38,907 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:35:39,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:40:25,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:45:47,101 INFO core: Event loop thread started, running loop forever
2026-08-23 19:45:47,402 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 19:45:47,407 INFO core: _init_accounts coroutine started
2026-08-23 19:45:47,408 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 19:45:47,417 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:50:09,501 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 19:50:09,501 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 19:50:09,504 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 19:50:09,505 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 19:55:37,468 INFO core: Event loop thread started, running loop forever
2026-08-23 19:55:37,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 19:55:37,773 INFO core: _init_accounts coroutine started
2026-08-23 19:55:37,774 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 19:55:37,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:00:53,984 INFO core: Event loop thread started, running loop forever
2026-08-23 20:00:54,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 20:00:54,290 INFO core: _init_accounts coroutine started
2026-08-23 20:00:54,291 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 20:00:54,300 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:05:14,846 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 20:05:14,853 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:10:50,686 INFO core: Event loop thread started, running loop forever
2026-08-23 20:10:50,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 20:10:50,993 INFO core: _init_accounts coroutine started
2026-08-23 20:10:50,994 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 20:10:51,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:15:19,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:20:24,860 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 20:20:24,860 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 20:20:24,861 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 20:20:24,863 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 20:20:24,863 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:25:14,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:30:36,002 INFO core: Event loop thread started, running loop forever
2026-08-23 20:30:36,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 20:30:36,307 INFO core: _init_accounts coroutine started
2026-08-23 20:30:36,308 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 20:30:36,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:35:13,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:40:10,835 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 20:40:10,835 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 20:40:10,840 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 20:40:10,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:40:10,843 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 20:45:06,617 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:50:11,349 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 20:50:11,350 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 20:50:11,356 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 20:50:11,357 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 20:50:11,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 20:55:04,636 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 20:55:04,636 WARNING core: Account 2: connect timed out after 35s
2026-08-23 20:55:04,637 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 20:55:04,637 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 20:55:04,638 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 20:55:04,640 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 20:55:04,640 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 20:55:04,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:00:10,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 21:00:10,419 WARNING core: Account 2: connect timed out after 35s
2026-08-23 21:00:49,700 INFO core: Event loop thread started, running loop forever
2026-08-23 21:00:50,002 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 21:00:50,007 INFO core: _init_accounts coroutine started
2026-08-23 21:00:50,011 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 21:00:50,023 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:05:24,448 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 21:05:24,449 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 21:05:24,450 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 21:05:24,452 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 21:05:24,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:10:47,999 INFO core: Event loop thread started, running loop forever
2026-08-23 21:10:48,300 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 21:10:48,306 INFO core: _init_accounts coroutine started
2026-08-23 21:10:48,306 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 21:10:48,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:15:45,683 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 21:15:45,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:20:45,703 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:25:07,594 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-23 21:25:07,595 INFO core: _init_accounts coroutine started
2026-08-23 21:25:07,595 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 21:25:07,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:30:09,856 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:35:18,954 INFO core: Event loop thread started, running loop forever
2026-08-23 21:35:19,255 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 21:35:19,261 INFO core: _init_accounts coroutine started
2026-08-23 21:35:19,262 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 21:35:19,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:40:05,890 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 21:40:05,890 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 21:40:05,893 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 21:40:05,893 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:45:11,350 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 21:45:51,899 INFO core: Event loop thread started, running loop forever
2026-08-23 21:45:52,200 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 21:45:52,205 INFO core: _init_accounts coroutine started
2026-08-23 21:45:52,206 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 21:45:52,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:45:52,218 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 21:45:52,218 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 21:45:52,219 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 21:45:52,222 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 21:50:22,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 21:55:20,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:00:09,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:05:14,835 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 22:05:14,837 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 22:05:14,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:10:17,160 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 22:10:17,161 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:10:17,163 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 22:15:08,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 22:15:08,383 WARNING core: Account 2: connect timed out after 35s
2026-08-23 22:15:08,384 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 22:15:08,385 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 22:15:28,660 INFO core: Event loop thread started, running loop forever
2026-08-23 22:15:28,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 22:15:28,966 INFO core: _init_accounts coroutine started
2026-08-23 22:15:28,966 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 22:15:28,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:20:10,895 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-23 22:20:10,907 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:25:37,949 INFO core: Event loop thread started, running loop forever
2026-08-23 22:25:38,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 22:25:38,254 INFO core: _init_accounts coroutine started
2026-08-23 22:25:38,255 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 22:25:38,270 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 22:25:38,270 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 22:25:38,272 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 22:25:38,273 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 22:25:38,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:30:44,396 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 22:30:51,765 INFO core: Event loop thread started, running loop forever
2026-08-23 22:30:52,067 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 22:30:52,076 INFO core: _init_accounts coroutine started
2026-08-23 22:30:52,076 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 22:30:52,086 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:35:13,006 INFO core: Event loop thread started, running loop forever
2026-08-23 22:35:13,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 22:35:13,312 INFO core: _init_accounts coroutine started
2026-08-23 22:35:13,313 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 22:35:13,319 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:35:59,058 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 22:40:50,579 INFO core: Event loop thread started, running loop forever
2026-08-23 22:40:50,880 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 22:40:50,884 INFO core: _init_accounts coroutine started
2026-08-23 22:40:50,885 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 22:40:50,893 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:45:42,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 22:45:42,279 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 22:45:42,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:45:42,282 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 22:45:42,284 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 22:46:35,240 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:50:40,552 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 22:55:41,325 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 22:55:41,326 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 22:55:41,332 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 22:55:41,334 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 22:55:41,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:00:26,398 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 23:00:26,398 WARNING core: Account 2: connect timed out after 35s
2026-08-23 23:00:26,398 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 23:00:26,399 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 23:00:26,400 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 23:00:26,401 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 23:00:26,401 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-23 23:00:26,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:05:33,422 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 23:05:35,407 INFO core: Event loop thread started, running loop forever
2026-08-23 23:05:35,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 23:05:35,711 INFO core: _init_accounts coroutine started
2026-08-23 23:05:35,712 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 23:05:35,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:10:07,234 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:15:13,445 INFO core: Event loop thread started, running loop forever
2026-08-23 23:15:13,746 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 23:15:13,754 INFO core: _init_accounts coroutine started
2026-08-23 23:15:13,754 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 23:15:13,759 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:20:44,742 INFO core: Event loop thread started, running loop forever
2026-08-23 23:20:45,044 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 23:20:45,055 INFO core: _init_accounts coroutine started
2026-08-23 23:20:45,055 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 23:20:45,068 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 23:20:45,068 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 23:20:45,070 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 23:20:45,071 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 23:20:45,077 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:25:38,147 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:30:19,337 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-23 23:30:19,337 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 23:30:19,348 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-23 23:30:19,349 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-23 23:30:19,360 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:35:13,321 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-23 23:35:13,323 WARNING core: Account 2: connect timed out after 35s
2026-08-23 23:35:13,326 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-23 23:35:13,326 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-23 23:35:13,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:35:13,329 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-23 23:40:19,385 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-23 23:40:23,273 INFO core: Event loop thread started, running loop forever
2026-08-23 23:40:23,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 23:40:23,580 INFO core: _init_accounts coroutine started
2026-08-23 23:40:23,580 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 23:40:23,592 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:45:08,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:50:15,371 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 23:50:15,371 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 23:50:15,371 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-23 23:50:15,372 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 23:50:15,372 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-23 23:50:15,372 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 23:50:15,372 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-23 23:50:15,373 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 23:50:15,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 23:50:25,464 INFO core: Event loop thread started, running loop forever
2026-08-23 23:50:25,765 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 23:50:25,769 INFO core: _init_accounts coroutine started
2026-08-23 23:50:25,770 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 23:50:25,779 INFO core: status() clients=0 connected=False forwarding=False
2026-08-23 23:50:25,781 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-23 23:50:25,782 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-23 23:55:32,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-23 23:55:32,400 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-23 23:55:32,400 INFO core: _init_accounts_inner: reloading LLM config
2026-08-23 23:55:32,400 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-23 23:55:32,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-23 23:55:32,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-23 23:55:39,764 INFO core: Event loop thread started, running loop forever
2026-08-23 23:55:40,066 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-23 23:55:40,077 INFO core: _init_accounts coroutine started
2026-08-23 23:55:40,077 INFO core: _init_accounts_inner: starting DB migrations
2026-08-23 23:55:40,088 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:00:41,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:00:41,175 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 00:00:41,176 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 00:00:41,178 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 00:00:41,180 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 00:05:41,134 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:10:07,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:15:07,880 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 00:15:07,881 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 00:15:07,886 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:20:13,400 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 00:20:13,401 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 00:20:39,886 INFO core: Event loop thread started, running loop forever
2026-08-24 00:20:40,187 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 00:20:40,191 INFO core: _init_accounts coroutine started
2026-08-24 00:20:40,192 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 00:20:40,201 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:25:33,656 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 00:25:33,657 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 00:25:33,657 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:30:29,726 INFO core: Event loop thread started, running loop forever
2026-08-24 00:30:30,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 00:30:30,031 INFO core: _init_accounts coroutine started
2026-08-24 00:30:30,032 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 00:30:30,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:35:22,351 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:40:24,880 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 00:40:24,895 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:45:39,971 INFO core: Event loop thread started, running loop forever
2026-08-24 00:45:40,272 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 00:45:40,277 INFO core: _init_accounts coroutine started
2026-08-24 00:45:40,277 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 00:45:40,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:50:20,002 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 00:55:07,174 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 00:55:07,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:00:16,949 INFO core: Event loop thread started, running loop forever
2026-08-24 01:00:17,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 01:00:17,257 INFO core: _init_accounts coroutine started
2026-08-24 01:00:17,258 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 01:00:17,265 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:05:44,085 INFO core: Event loop thread started, running loop forever
2026-08-24 01:05:44,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 01:05:44,391 INFO core: _init_accounts coroutine started
2026-08-24 01:05:44,392 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 01:05:44,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 01:05:44,407 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 01:05:44,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:05:44,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 01:10:45,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:15:26,112 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 01:15:26,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:20:23,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:25:08,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:30:41,838 INFO core: Event loop thread started, running loop forever
2026-08-24 01:30:42,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 01:30:42,143 INFO core: _init_accounts coroutine started
2026-08-24 01:30:42,144 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 01:30:42,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:35:45,606 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 01:35:45,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:40:14,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:45:45,424 INFO core: Event loop thread started, running loop forever
2026-08-24 01:45:45,726 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 01:45:45,731 INFO core: _init_accounts coroutine started
2026-08-24 01:45:45,732 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 01:45:45,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:50:24,640 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 01:50:24,674 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 01:55:39,557 INFO core: Event loop thread started, running loop forever
2026-08-24 01:55:39,858 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 01:55:39,863 INFO core: _init_accounts coroutine started
2026-08-24 01:55:39,864 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 01:55:39,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:00:47,829 INFO core: Event loop thread started, running loop forever
2026-08-24 02:00:48,130 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 02:00:48,135 INFO core: _init_accounts coroutine started
2026-08-24 02:00:48,136 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 02:00:48,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:05:07,239 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:10:14,428 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 02:10:34,471 INFO core: Event loop thread started, running loop forever
2026-08-24 02:10:34,772 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 02:10:34,777 INFO core: _init_accounts coroutine started
2026-08-24 02:10:34,779 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 02:10:34,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:15:41,248 INFO core: Event loop thread started, running loop forever
2026-08-24 02:15:41,549 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 02:15:41,560 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:15:41,563 INFO core: _init_accounts coroutine started
2026-08-24 02:15:41,563 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 02:20:08,428 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:25:29,940 INFO core: Event loop thread started, running loop forever
2026-08-24 02:25:30,241 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 02:25:30,245 INFO core: _init_accounts coroutine started
2026-08-24 02:25:30,247 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 02:25:30,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:30:07,320 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 02:30:07,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:35:03,227 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:40:24,802 INFO core: Event loop thread started, running loop forever
2026-08-24 02:40:25,103 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 02:40:25,111 INFO core: _init_accounts coroutine started
2026-08-24 02:40:25,112 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 02:40:25,121 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:45:49,799 INFO core: Event loop thread started, running loop forever
2026-08-24 02:45:50,100 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 02:45:50,103 INFO core: _init_accounts coroutine started
2026-08-24 02:45:50,105 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 02:45:50,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:50:43,082 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 02:55:21,227 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 02:55:21,254 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:00:36,117 INFO core: Event loop thread started, running loop forever
2026-08-24 03:00:36,419 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 03:00:36,425 INFO core: _init_accounts coroutine started
2026-08-24 03:00:36,426 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 03:00:36,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:05:27,973 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 03:05:27,974 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 03:05:27,981 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 03:05:27,983 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 03:05:27,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:10:48,742 INFO core: Event loop thread started, running loop forever
2026-08-24 03:10:49,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 03:10:49,047 INFO core: _init_accounts coroutine started
2026-08-24 03:10:49,047 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 03:10:49,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:15:27,656 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:20:33,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 03:20:42,280 INFO core: Event loop thread started, running loop forever
2026-08-24 03:20:42,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 03:20:42,586 INFO core: _init_accounts coroutine started
2026-08-24 03:20:42,587 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 03:20:42,598 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:25:21,729 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 03:25:21,740 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:30:43,151 INFO core: Event loop thread started, running loop forever
2026-08-24 03:30:43,452 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 03:30:43,458 INFO core: _init_accounts coroutine started
2026-08-24 03:30:43,459 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 03:30:43,470 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:35:17,429 INFO core: Event loop thread started, running loop forever
2026-08-24 03:35:17,730 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 03:35:17,734 INFO core: _init_accounts coroutine started
2026-08-24 03:35:17,734 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 03:35:17,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:40:13,589 INFO core: Event loop thread started, running loop forever
2026-08-24 03:40:13,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 03:40:13,895 INFO core: _init_accounts coroutine started
2026-08-24 03:40:13,895 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 03:40:13,903 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:40:13,908 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 03:40:13,925 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 03:45:11,912 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 03:45:11,917 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:45:11,918 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 03:50:14,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 03:55:21,733 INFO core: Event loop thread started, running loop forever
2026-08-24 03:55:22,034 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 03:55:22,039 INFO core: _init_accounts coroutine started
2026-08-24 03:55:22,040 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 03:55:22,047 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:00:30,853 INFO core: Event loop thread started, running loop forever
2026-08-24 04:00:31,154 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 04:00:31,159 INFO core: _init_accounts coroutine started
2026-08-24 04:00:31,159 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 04:00:31,167 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:05:35,949 INFO core: Event loop thread started, running loop forever
2026-08-24 04:05:36,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 04:05:36,254 INFO core: _init_accounts coroutine started
2026-08-24 04:05:36,254 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 04:05:36,262 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:10:22,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:15:10,036 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 04:15:10,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:20:08,375 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:25:51,351 INFO core: Event loop thread started, running loop forever
2026-08-24 04:25:51,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 04:25:51,667 INFO core: _init_accounts coroutine started
2026-08-24 04:25:51,667 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 04:25:51,671 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:30:06,110 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 04:30:06,140 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:35:41,501 INFO core: Event loop thread started, running loop forever
2026-08-24 04:35:41,804 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 04:35:41,814 INFO core: _init_accounts coroutine started
2026-08-24 04:35:41,814 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 04:35:41,820 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:40:23,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:45:30,495 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 04:45:30,495 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 04:45:30,498 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 04:45:53,623 INFO core: Event loop thread started, running loop forever
2026-08-24 04:45:53,925 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 04:45:53,931 INFO core: _init_accounts coroutine started
2026-08-24 04:45:53,933 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 04:45:53,952 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:50:19,464 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:55:45,291 INFO core: Event loop thread started, running loop forever
2026-08-24 04:55:45,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 04:55:45,596 INFO core: _init_accounts coroutine started
2026-08-24 04:55:45,597 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 04:55:45,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 04:55:45,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 04:55:45,621 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 05:00:35,151 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 05:00:35,160 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 05:00:35,166 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:05:20,708 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:10:27,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 05:10:27,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 05:10:27,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 05:10:30,876 INFO core: Event loop thread started, running loop forever
2026-08-24 05:10:31,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 05:10:31,184 INFO core: _init_accounts coroutine started
2026-08-24 05:10:31,190 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 05:10:31,198 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:15:37,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 05:15:39,229 INFO core: Event loop thread started, running loop forever
2026-08-24 05:15:39,530 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 05:15:39,535 INFO core: _init_accounts coroutine started
2026-08-24 05:15:39,536 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 05:15:39,545 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:20:46,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 05:20:49,971 INFO core: Event loop thread started, running loop forever
2026-08-24 05:20:50,272 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 05:20:50,278 INFO core: _init_accounts coroutine started
2026-08-24 05:20:50,279 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 05:20:50,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:25:41,511 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 05:25:41,532 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:30:08,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:35:52,780 INFO core: Event loop thread started, running loop forever
2026-08-24 05:35:53,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 05:35:53,097 INFO core: _init_accounts coroutine started
2026-08-24 05:35:53,098 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 05:35:53,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:40:44,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:45:19,246 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 05:45:19,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:45:19,250 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 05:45:19,253 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 05:50:45,233 INFO core: Event loop thread started, running loop forever
2026-08-24 05:50:45,534 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 05:50:45,540 INFO core: _init_accounts coroutine started
2026-08-24 05:50:45,541 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 05:50:45,552 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 05:55:48,977 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 05:55:48,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 05:55:48,982 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 05:55:48,989 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 05:55:49,014 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:00:53,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:00:53,105 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 06:00:53,106 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 06:05:35,053 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:10:09,965 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 06:10:09,967 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 06:10:09,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:15:11,433 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 06:15:11,434 WARNING core: Account 2: connect timed out after 35s
2026-08-24 06:15:11,435 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 06:15:11,435 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 06:15:11,436 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 06:15:11,438 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 06:15:11,439 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 06:15:14,685 INFO core: Event loop thread started, running loop forever
2026-08-24 06:15:14,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 06:15:14,996 INFO core: _init_accounts coroutine started
2026-08-24 06:15:14,996 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 06:15:15,010 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:20:21,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 06:20:39,646 INFO core: Event loop thread started, running loop forever
2026-08-24 06:20:39,948 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 06:20:39,957 INFO core: _init_accounts coroutine started
2026-08-24 06:20:39,958 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 06:20:39,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:25:32,977 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 06:25:32,977 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 06:25:32,987 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 06:25:32,990 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 06:25:32,994 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:30:39,390 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 06:30:45,863 INFO core: Event loop thread started, running loop forever
2026-08-24 06:30:46,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 06:30:46,169 INFO core: _init_accounts coroutine started
2026-08-24 06:30:46,170 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 06:30:46,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:35:19,260 INFO core: Event loop thread started, running loop forever
2026-08-24 06:35:19,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 06:35:19,567 INFO core: _init_accounts coroutine started
2026-08-24 06:35:19,568 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 06:35:19,576 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:35:52,300 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 06:40:46,833 INFO core: Event loop thread started, running loop forever
2026-08-24 06:40:47,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 06:40:47,140 INFO core: _init_accounts coroutine started
2026-08-24 06:40:47,141 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 06:40:47,150 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:45:45,031 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 06:45:45,031 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 06:45:45,034 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 06:45:45,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:50:08,695 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 06:50:08,701 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 06:55:15,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 06:55:15,427 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 06:55:15,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 06:55:38,463 INFO core: Event loop thread started, running loop forever
2026-08-24 06:55:38,764 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 06:55:38,769 INFO core: _init_accounts coroutine started
2026-08-24 06:55:38,770 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 06:55:38,777 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:00:49,294 INFO core: Event loop thread started, running loop forever
2026-08-24 07:00:49,595 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 07:00:49,599 INFO core: _init_accounts coroutine started
2026-08-24 07:00:49,600 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 07:00:49,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:05:20,757 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 07:05:20,758 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 07:05:20,758 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:10:14,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:15:21,384 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 07:15:21,390 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 07:15:21,390 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 07:15:21,391 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 07:15:21,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 07:15:40,350 INFO core: Event loop thread started, running loop forever
2026-08-24 07:15:40,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 07:15:40,655 INFO core: _init_accounts coroutine started
2026-08-24 07:15:40,656 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 07:15:40,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:20:27,804 INFO core: Event loop thread started, running loop forever
2026-08-24 07:20:28,105 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 07:20:28,110 INFO core: _init_accounts coroutine started
2026-08-24 07:20:28,111 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 07:20:28,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:25:08,021 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 07:25:08,022 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 07:25:08,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:30:08,030 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 07:30:08,038 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 07:30:08,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:35:44,939 INFO core: Event loop thread started, running loop forever
2026-08-24 07:35:45,240 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 07:35:45,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:40:21,768 INFO core: _init_accounts coroutine started
2026-08-24 07:40:21,770 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 07:40:21,783 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 07:40:21,783 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 07:40:21,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:45:28,467 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 07:45:46,434 INFO core: Event loop thread started, running loop forever
2026-08-24 07:45:46,736 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 07:45:46,751 INFO core: _init_accounts coroutine started
2026-08-24 07:45:46,751 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 07:45:46,765 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 07:45:46,766 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 07:45:46,766 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:50:26,091 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 07:50:26,096 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 07:50:26,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 07:55:18,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:00:12,492 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:05:20,768 INFO core: Event loop thread started, running loop forever
2026-08-24 08:05:21,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 08:05:21,073 INFO core: _init_accounts coroutine started
2026-08-24 08:05:21,075 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 08:05:21,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:10:07,242 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 08:10:07,243 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 08:10:07,244 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 08:10:07,245 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 08:10:07,257 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 08:10:07,258 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 08:10:07,265 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 08:10:07,266 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 08:10:07,270 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:15:06,575 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 08:15:06,576 WARNING core: Account 2: connect timed out after 35s
2026-08-24 08:15:06,577 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 08:15:06,577 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 08:15:06,578 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 08:15:06,579 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 08:15:06,579 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 08:15:06,613 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:20:13,396 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 08:20:13,397 WARNING core: Account 2: connect timed out after 35s
2026-08-24 08:20:20,708 INFO core: Event loop thread started, running loop forever
2026-08-24 08:20:21,010 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 08:20:21,017 INFO core: _init_accounts coroutine started
2026-08-24 08:20:21,017 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 08:20:21,029 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:25:30,190 INFO core: Event loop thread started, running loop forever
2026-08-24 08:25:30,491 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 08:25:30,497 INFO core: _init_accounts coroutine started
2026-08-24 08:25:30,497 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 08:25:30,507 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:30:04,247 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 08:30:04,266 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 08:30:04,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:35:11,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 08:35:11,455 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 08:35:11,456 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 08:35:11,456 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 08:35:11,457 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 08:35:11,457 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 08:35:11,776 INFO core: Event loop thread started, running loop forever
2026-08-24 08:35:12,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 08:35:12,081 INFO core: _init_accounts coroutine started
2026-08-24 08:35:12,083 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 08:35:12,089 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:40:19,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 08:40:27,616 INFO core: Event loop thread started, running loop forever
2026-08-24 08:40:27,917 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 08:40:27,924 INFO core: _init_accounts coroutine started
2026-08-24 08:40:27,924 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 08:40:27,930 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:45:20,847 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 08:45:20,848 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 08:45:20,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:50:26,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 08:50:50,082 INFO core: Event loop thread started, running loop forever
2026-08-24 08:50:50,384 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 08:50:50,394 INFO core: _init_accounts coroutine started
2026-08-24 08:50:50,395 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 08:50:50,413 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 08:55:52,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:00:35,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 09:00:35,442 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 09:00:35,445 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 09:00:35,449 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 09:00:35,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 09:00:35,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 09:00:35,467 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 09:00:35,470 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 09:00:35,471 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:05:41,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 09:05:48,450 INFO core: Event loop thread started, running loop forever
2026-08-24 09:05:48,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 09:05:48,756 INFO core: _init_accounts coroutine started
2026-08-24 09:05:48,761 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 09:05:48,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:10:44,781 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:10:44,784 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 09:15:08,130 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 09:15:08,140 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 09:15:08,141 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 09:15:08,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:20:15,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 09:20:24,015 INFO core: Event loop thread started, running loop forever
2026-08-24 09:20:24,316 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 09:20:24,322 INFO core: _init_accounts coroutine started
2026-08-24 09:20:24,322 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 09:20:24,332 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:25:11,743 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 09:25:11,744 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 09:25:11,746 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 09:25:11,747 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 09:25:11,758 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 09:25:11,758 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 09:25:11,762 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 09:25:11,763 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 09:25:11,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:30:10,057 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 09:30:10,057 WARNING core: Account 2: connect timed out after 35s
2026-08-24 09:30:10,058 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 09:30:10,058 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 09:30:10,060 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 09:30:10,062 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 09:30:10,063 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 09:30:10,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:35:07,187 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 09:35:07,188 WARNING core: Account 2: connect timed out after 35s
2026-08-24 09:35:07,189 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-24 09:35:07,189 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-24 09:35:07,190 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 09:35:07,192 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-24 09:35:07,192 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-24 09:35:07,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:40:14,399 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 09:40:14,400 WARNING core: Account 2: connect timed out after 35s
2026-08-24 09:40:14,401 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-24 09:40:14,401 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-24 09:40:14,402 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 09:40:14,403 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-24 09:40:14,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-24 09:40:32,905 INFO core: Event loop thread started, running loop forever
2026-08-24 09:40:33,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 09:40:33,210 INFO core: _init_accounts coroutine started
2026-08-24 09:40:33,211 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 09:40:33,220 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:45:53,135 INFO core: Event loop thread started, running loop forever
2026-08-24 09:45:53,436 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 09:45:53,439 INFO core: _init_accounts coroutine started
2026-08-24 09:45:53,439 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 09:45:53,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:50:35,739 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 09:50:35,740 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 09:50:35,742 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 09:50:35,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 09:50:35,745 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 09:55:20,855 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:00:10,341 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:05:17,371 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 10:05:17,372 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 10:05:17,377 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 10:05:17,378 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 10:05:20,490 INFO core: Event loop thread started, running loop forever
2026-08-24 10:05:20,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 10:05:20,795 INFO core: _init_accounts coroutine started
2026-08-24 10:05:20,796 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 10:05:20,806 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:10:28,312 INFO core: Event loop thread started, running loop forever
2026-08-24 10:10:28,613 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 10:10:28,618 INFO core: _init_accounts coroutine started
2026-08-24 10:10:28,619 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 10:10:28,632 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:10:28,635 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 10:15:35,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 10:15:35,420 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-24 10:15:35,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 10:15:35,421 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 10:15:35,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 10:15:35,421 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 10:15:35,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 10:15:35,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 10:15:52,136 INFO core: Event loop thread started, running loop forever
2026-08-24 10:15:52,437 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 10:15:52,442 INFO core: _init_accounts coroutine started
2026-08-24 10:15:52,444 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 10:15:52,453 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:20:29,253 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:25:15,991 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 10:25:15,991 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 10:25:16,002 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:30:22,418 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 10:30:22,419 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 10:30:22,420 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 10:30:22,420 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 10:30:22,420 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 10:30:22,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 10:30:37,712 INFO core: Event loop thread started, running loop forever
2026-08-24 10:30:38,013 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 10:30:38,020 INFO core: _init_accounts coroutine started
2026-08-24 10:30:38,021 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 10:30:38,033 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:35:44,384 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 10:35:44,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 10:35:44,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 10:35:44,388 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 10:35:44,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 10:35:44,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 10:35:44,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 10:35:47,677 INFO core: Event loop thread started, running loop forever
2026-08-24 10:35:47,978 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 10:35:47,982 INFO core: _init_accounts coroutine started
2026-08-24 10:35:47,983 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 10:35:47,996 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:40:36,212 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 10:40:36,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:45:41,014 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:50:28,239 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-24 10:50:28,240 INFO core: _init_accounts coroutine started
2026-08-24 10:50:28,241 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 10:50:28,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 10:55:25,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:00:31,550 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 11:00:50,026 INFO core: Event loop thread started, running loop forever
2026-08-24 11:00:50,327 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 11:00:50,335 INFO core: _init_accounts coroutine started
2026-08-24 11:00:50,335 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 11:00:50,348 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:00:50,350 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 11:05:23,116 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 11:05:23,128 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:10:11,755 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 11:10:11,756 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 11:10:11,759 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:15:17,486 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 11:15:47,043 INFO core: Event loop thread started, running loop forever
2026-08-24 11:15:47,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 11:15:47,350 INFO core: _init_accounts coroutine started
2026-08-24 11:15:47,350 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 11:15:47,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:20:35,738 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 11:20:35,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:25:38,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:30:03,684 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-24 11:30:03,687 INFO core: _init_accounts coroutine started
2026-08-24 11:30:03,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 11:30:03,711 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:35:04,833 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 11:35:04,833 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 11:35:04,836 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 11:35:04,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:40:10,399 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 11:40:11,040 INFO core: Event loop thread started, running loop forever
2026-08-24 11:40:11,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 11:40:11,347 INFO core: _init_accounts coroutine started
2026-08-24 11:40:11,348 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 11:40:11,355 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:45:30,336 INFO core: Event loop thread started, running loop forever
2026-08-24 11:45:30,643 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 11:45:30,647 INFO core: _init_accounts coroutine started
2026-08-24 11:45:30,648 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 11:45:30,658 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:50:36,083 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 11:55:20,337 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:00:48,877 INFO core: Event loop thread started, running loop forever
2026-08-24 12:00:49,178 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 12:00:49,182 INFO core: _init_accounts coroutine started
2026-08-24 12:00:49,183 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 12:00:49,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:05:48,602 INFO core: Event loop thread started, running loop forever
2026-08-24 12:05:48,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 12:05:48,909 INFO core: _init_accounts coroutine started
2026-08-24 12:05:48,910 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 12:05:48,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:05:56,608 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 12:10:50,804 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 12:10:50,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:10:50,806 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 12:15:28,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 12:15:28,447 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 12:15:28,447 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:20:34,004 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:25:04,784 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 12:25:04,785 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 12:25:04,786 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:25:04,790 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 12:25:04,791 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 12:30:10,389 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 12:30:10,389 WARNING core: Account 2: connect timed out after 35s
2026-08-24 12:30:10,390 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 12:30:10,390 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 12:30:10,391 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 12:30:10,392 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 12:30:10,393 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 12:30:49,828 INFO core: Event loop thread started, running loop forever
2026-08-24 12:30:50,129 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 12:30:50,135 INFO core: _init_accounts coroutine started
2026-08-24 12:30:50,136 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 12:30:50,149 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:35:42,518 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:35:42,519 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 12:35:42,521 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 12:40:14,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:45:20,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 12:45:50,889 INFO core: Event loop thread started, running loop forever
2026-08-24 12:45:51,190 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 12:45:51,194 INFO core: _init_accounts coroutine started
2026-08-24 12:45:51,195 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 12:45:51,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:50:45,502 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 12:50:45,503 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 12:50:45,505 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 12:50:45,506 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 12:50:45,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 12:50:45,520 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 12:50:45,522 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 12:55:28,941 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 12:55:28,942 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 12:55:28,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:00:18,468 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 13:00:18,469 WARNING core: Account 2: connect timed out after 35s
2026-08-24 13:00:18,470 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 13:00:18,470 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 13:00:18,471 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 13:00:18,472 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 13:00:18,473 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 13:00:18,476 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:05:25,451 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 13:05:25,452 WARNING core: Account 2: connect timed out after 35s
2026-08-24 13:05:25,452 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-24 13:05:25,454 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-24 13:05:51,627 INFO core: Event loop thread started, running loop forever
2026-08-24 13:05:51,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 13:05:51,934 INFO core: _init_accounts coroutine started
2026-08-24 13:05:51,937 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 13:05:51,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:10:28,435 INFO core: Event loop thread started, running loop forever
2026-08-24 13:10:28,736 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 13:10:28,740 INFO core: _init_accounts coroutine started
2026-08-24 13:10:28,741 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 13:10:28,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:10:57,494 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 13:15:44,662 INFO core: Event loop thread started, running loop forever
2026-08-24 13:15:44,963 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 13:15:44,974 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:20:14,231 INFO core: _init_accounts coroutine started
2026-08-24 13:20:14,232 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 13:20:14,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:25:46,076 INFO core: Event loop thread started, running loop forever
2026-08-24 13:25:46,377 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 13:25:46,382 INFO core: _init_accounts coroutine started
2026-08-24 13:25:46,383 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 13:25:46,392 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:30:39,680 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:35:13,681 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 13:35:13,682 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 13:35:13,686 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 13:35:13,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:40:20,397 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 13:40:20,397 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 13:40:20,399 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 13:40:45,508 INFO core: Event loop thread started, running loop forever
2026-08-24 13:40:45,809 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 13:40:45,814 INFO core: _init_accounts coroutine started
2026-08-24 13:40:45,814 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 13:40:45,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:40:45,831 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 13:40:45,836 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 13:40:45,838 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 13:45:21,948 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 13:45:21,957 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:50:15,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 13:55:03,299 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:00:29,277 INFO core: Event loop thread started, running loop forever
2026-08-24 14:00:29,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 14:00:29,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:05:33,209 INFO core: _init_accounts coroutine started
2026-08-24 14:05:33,210 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 14:05:33,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:10:11,026 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 14:10:11,027 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 14:10:11,033 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:10:11,035 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 14:15:09,817 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 14:15:09,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:20:21,165 INFO core: Event loop thread started, running loop forever
2026-08-24 14:20:21,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 14:20:21,470 INFO core: _init_accounts coroutine started
2026-08-24 14:20:21,472 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 14:20:21,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 14:20:21,483 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 14:20:21,485 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 14:20:21,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:25:36,810 INFO core: Event loop thread started, running loop forever
2026-08-24 14:25:37,111 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 14:25:37,117 INFO core: _init_accounts coroutine started
2026-08-24 14:25:37,117 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 14:25:37,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:30:40,939 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 14:30:40,939 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 14:30:40,941 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 14:30:40,943 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 14:30:40,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:35:09,338 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:40:25,792 INFO core: Event loop thread started, running loop forever
2026-08-24 14:40:26,093 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 14:40:26,099 INFO core: _init_accounts coroutine started
2026-08-24 14:40:26,100 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 14:40:26,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:45:12,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:50:18,353 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 14:50:18,354 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 14:50:18,355 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-24 14:50:24,229 INFO core: Event loop thread started, running loop forever
2026-08-24 14:50:24,530 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 14:50:24,535 INFO core: _init_accounts coroutine started
2026-08-24 14:50:24,537 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 14:50:24,548 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 14:55:52,831 INFO core: Event loop thread started, running loop forever
2026-08-24 14:55:53,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 14:55:53,137 INFO core: _init_accounts coroutine started
2026-08-24 14:55:53,138 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 14:55:53,147 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:00:14,764 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:00:14,767 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 15:00:14,767 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 15:05:21,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 15:05:23,443 INFO core: Event loop thread started, running loop forever
2026-08-24 15:05:23,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 15:05:23,751 INFO core: _init_accounts coroutine started
2026-08-24 15:05:23,752 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 15:05:23,758 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:10:11,478 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 15:10:11,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:15:42,124 INFO core: Event loop thread started, running loop forever
2026-08-24 15:15:42,426 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 15:15:42,430 INFO core: _init_accounts coroutine started
2026-08-24 15:15:42,431 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 15:15:42,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:20:49,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 15:20:51,992 INFO core: Event loop thread started, running loop forever
2026-08-24 15:20:52,293 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 15:20:52,298 INFO core: _init_accounts coroutine started
2026-08-24 15:20:52,299 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 15:20:52,309 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:25:23,885 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 15:25:23,886 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 15:25:23,887 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 15:25:23,888 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 15:25:23,905 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 15:25:23,905 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 15:25:23,907 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:30:27,224 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 15:30:27,225 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 15:30:27,239 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:35:27,820 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 15:35:27,820 WARNING core: Account 2: connect timed out after 35s
2026-08-24 15:35:27,821 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 15:35:27,822 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 15:35:27,823 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 15:35:27,824 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 15:35:27,825 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 15:35:27,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:40:28,730 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 15:40:28,731 WARNING core: Account 2: connect timed out after 35s
2026-08-24 15:40:28,732 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-24 15:40:28,732 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-24 15:40:28,734 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 15:40:28,735 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-24 15:40:28,736 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-24 15:40:28,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:45:34,416 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 15:45:34,418 WARNING core: Account 2: connect timed out after 35s
2026-08-24 15:45:51,306 INFO core: Event loop thread started, running loop forever
2026-08-24 15:45:51,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 15:45:51,616 INFO core: _init_accounts coroutine started
2026-08-24 15:45:51,617 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 15:45:51,631 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:50:38,748 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 15:50:38,749 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 15:50:38,756 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 15:50:38,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 15:55:37,469 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 15:55:37,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:00:39,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:05:39,719 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 16:05:39,719 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 16:05:39,725 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 16:05:39,727 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 16:05:39,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:10:26,986 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 16:10:26,988 WARNING core: Account 2: connect timed out after 35s
2026-08-24 16:10:26,989 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 16:10:26,989 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 16:10:26,991 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 16:10:26,992 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 16:10:26,993 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 16:10:26,996 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:15:09,983 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 16:15:09,983 WARNING core: Account 2: connect timed out after 35s
2026-08-24 16:15:09,984 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-24 16:15:09,984 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-24 16:15:09,984 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 16:15:09,985 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-24 16:15:09,985 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-24 16:15:09,994 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:20:15,383 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 16:20:15,384 WARNING core: Account 2: connect timed out after 35s
2026-08-24 16:20:24,733 INFO core: Event loop thread started, running loop forever
2026-08-24 16:20:25,035 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 16:20:25,039 INFO core: _init_accounts coroutine started
2026-08-24 16:20:25,040 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 16:20:25,052 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 16:20:25,053 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 16:20:25,055 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 16:20:25,057 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 16:20:25,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:25:31,380 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 16:25:31,381 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 16:25:38,456 INFO core: Event loop thread started, running loop forever
2026-08-24 16:25:38,757 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 16:25:38,762 INFO core: _init_accounts coroutine started
2026-08-24 16:25:38,763 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 16:25:38,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:30:10,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 16:30:10,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 16:30:10,410 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-24 16:30:10,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 16:30:10,411 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 16:30:10,411 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 16:30:10,411 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 16:30:10,411 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 16:30:10,411 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 16:30:30,354 INFO core: Event loop thread started, running loop forever
2026-08-24 16:30:30,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 16:30:30,661 INFO core: _init_accounts coroutine started
2026-08-24 16:30:30,663 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 16:30:30,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:35:51,272 INFO core: Event loop thread started, running loop forever
2026-08-24 16:35:51,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 16:35:51,577 INFO core: _init_accounts coroutine started
2026-08-24 16:35:51,578 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 16:35:51,588 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:40:36,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 16:40:36,625 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 16:40:36,628 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 16:40:36,629 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 16:40:36,638 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 16:40:36,638 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 16:40:36,642 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 16:40:36,643 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 16:40:36,653 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:45:38,586 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 16:45:38,587 WARNING core: Account 2: connect timed out after 35s
2026-08-24 16:45:38,589 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 16:45:38,589 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 16:45:38,591 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 16:45:38,592 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 16:45:38,592 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 16:45:38,603 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:50:10,291 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 16:50:10,292 WARNING core: Account 2: connect timed out after 35s
2026-08-24 16:50:10,292 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-24 16:50:10,292 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-24 16:50:10,293 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 16:50:10,294 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-24 16:50:10,294 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-24 16:50:10,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 16:55:17,379 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 16:55:17,380 WARNING core: Account 2: connect timed out after 35s
2026-08-24 16:55:17,380 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-24 16:55:17,381 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-24 16:55:17,381 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 16:55:17,382 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-24 16:55:17,383 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-24 16:55:23,551 INFO core: Event loop thread started, running loop forever
2026-08-24 16:55:23,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 16:55:23,861 INFO core: _init_accounts coroutine started
2026-08-24 16:55:23,861 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 16:55:23,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:00:16,657 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:00:16,659 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 17:00:16,659 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 17:05:22,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 17:05:24,298 INFO core: Event loop thread started, running loop forever
2026-08-24 17:05:24,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 17:05:24,605 INFO core: _init_accounts coroutine started
2026-08-24 17:05:24,606 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 17:05:24,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:10:28,498 INFO core: Event loop thread started, running loop forever
2026-08-24 17:10:28,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 17:10:28,803 INFO core: _init_accounts coroutine started
2026-08-24 17:10:28,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 17:10:28,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:15:34,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 17:15:48,037 INFO core: Event loop thread started, running loop forever
2026-08-24 17:15:48,338 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 17:15:48,345 INFO core: _init_accounts coroutine started
2026-08-24 17:15:48,345 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 17:15:48,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:20:35,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:25:45,491 INFO core: Event loop thread started, running loop forever
2026-08-24 17:25:45,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 17:25:45,795 INFO core: _init_accounts coroutine started
2026-08-24 17:25:45,796 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 17:25:45,806 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:30:11,880 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 17:30:11,881 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 17:30:11,883 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 17:30:11,886 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 17:30:11,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:30:11,906 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 17:30:11,907 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 17:30:11,912 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 17:30:11,913 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 17:35:42,108 INFO core: Event loop thread started, running loop forever
2026-08-24 17:35:42,411 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 17:35:42,417 INFO core: _init_accounts coroutine started
2026-08-24 17:35:42,418 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 17:35:42,423 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:40:31,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:45:11,957 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:50:30,521 INFO core: Event loop thread started, running loop forever
2026-08-24 17:50:30,823 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 17:50:30,827 INFO core: _init_accounts coroutine started
2026-08-24 17:50:30,829 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 17:50:30,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 17:55:43,254 INFO core: Event loop thread started, running loop forever
2026-08-24 17:55:43,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 17:55:43,560 INFO core: _init_accounts coroutine started
2026-08-24 17:55:43,561 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 17:55:43,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:00:26,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:05:04,062 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 18:05:04,142 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:10:16,708 INFO core: Event loop thread started, running loop forever
2026-08-24 18:10:17,009 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 18:10:17,013 INFO core: _init_accounts coroutine started
2026-08-24 18:10:17,014 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 18:10:17,032 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 18:10:17,032 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 18:10:17,038 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:15:23,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 18:15:23,405 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 18:15:23,405 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 18:15:23,406 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 18:15:23,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 18:15:23,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 18:15:44,016 INFO core: Event loop thread started, running loop forever
2026-08-24 18:15:44,330 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 18:15:44,334 INFO core: _init_accounts coroutine started
2026-08-24 18:15:44,334 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 18:15:44,353 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 18:15:44,353 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 18:15:44,354 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 18:15:44,356 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 18:15:44,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:20:21,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:25:10,972 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 18:25:10,973 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 18:25:10,975 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:30:15,970 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 18:30:15,971 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 18:30:15,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:35:10,721 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 18:35:10,726 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:35:10,726 WARNING core: Account 2: connect timed out after 35s
2026-08-24 18:40:16,423 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 18:40:45,797 INFO core: Event loop thread started, running loop forever
2026-08-24 18:40:46,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 18:40:46,104 INFO core: _init_accounts coroutine started
2026-08-24 18:40:46,104 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 18:40:46,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:45:06,306 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 18:45:11,458 INFO core: Event loop thread started, running loop forever
2026-08-24 18:45:11,759 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 18:45:11,764 INFO core: _init_accounts coroutine started
2026-08-24 18:45:11,765 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 18:45:11,770 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:50:18,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 18:50:18,458 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 18:50:18,459 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-24 18:50:18,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 18:50:18,459 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 18:50:18,460 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 18:50:18,460 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 18:50:18,460 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 18:50:18,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 18:50:46,310 INFO core: Event loop thread started, running loop forever
2026-08-24 18:50:46,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 18:50:46,616 INFO core: _init_accounts coroutine started
2026-08-24 18:50:46,616 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 18:50:46,622 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:55:10,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 18:55:10,987 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 19:00:16,417 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 19:00:16,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 19:00:16,421 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 19:00:32,537 INFO core: Event loop thread started, running loop forever
2026-08-24 19:00:32,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 19:00:32,842 INFO core: _init_accounts coroutine started
2026-08-24 19:00:32,843 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 19:00:32,853 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:05:29,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:10:35,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 19:10:38,795 INFO core: Event loop thread started, running loop forever
2026-08-24 19:10:39,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 19:10:39,110 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:15:45,371 INFO core: _init_accounts coroutine started
2026-08-24 19:15:45,371 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 19:15:47,903 INFO core: Event loop thread started, running loop forever
2026-08-24 19:15:48,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 19:15:48,209 INFO core: _init_accounts coroutine started
2026-08-24 19:15:48,210 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 19:15:48,219 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:20:33,048 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 19:20:33,048 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 19:20:33,051 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 19:20:33,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:25:42,690 INFO core: Event loop thread started, running loop forever
2026-08-24 19:25:42,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 19:25:42,996 INFO core: _init_accounts coroutine started
2026-08-24 19:25:42,998 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 19:25:43,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:30:11,820 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:35:06,938 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 19:35:06,939 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 19:35:06,940 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 19:35:06,941 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 19:35:06,957 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 19:35:06,957 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 19:35:06,961 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 19:35:06,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:35:06,962 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 19:40:13,346 WARNING core: Account 2: connect timed out after 35s
2026-08-24 19:40:13,347 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-24 19:40:13,347 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-24 19:40:13,348 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-24 19:40:13,349 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-24 19:40:13,349 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-24 19:40:28,319 INFO core: Event loop thread started, running loop forever
2026-08-24 19:40:28,620 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 19:40:28,624 INFO core: _init_accounts coroutine started
2026-08-24 19:40:28,625 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 19:40:28,637 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:45:38,985 INFO core: Event loop thread started, running loop forever
2026-08-24 19:45:39,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 19:45:39,291 INFO core: _init_accounts coroutine started
2026-08-24 19:45:39,291 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 19:45:39,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:50:46,361 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 19:50:49,842 INFO core: Event loop thread started, running loop forever
2026-08-24 19:50:50,144 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 19:50:50,148 INFO core: _init_accounts coroutine started
2026-08-24 19:50:50,149 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 19:50:50,158 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 19:55:35,876 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:00:41,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 20:00:42,934 INFO core: Event loop thread started, running loop forever
2026-08-24 20:00:43,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 20:00:43,239 INFO core: _init_accounts coroutine started
2026-08-24 20:00:43,240 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 20:00:43,251 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:05:16,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:05:16,315 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 20:05:16,316 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 20:10:03,038 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 20:10:03,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:15:10,424 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 20:15:15,094 INFO core: Event loop thread started, running loop forever
2026-08-24 20:15:15,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 20:15:15,399 INFO core: _init_accounts coroutine started
2026-08-24 20:15:15,400 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 20:15:15,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:20:22,274 INFO core: Event loop thread started, running loop forever
2026-08-24 20:20:22,575 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 20:20:22,580 INFO core: _init_accounts coroutine started
2026-08-24 20:20:22,581 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 20:20:22,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:25:03,531 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 20:25:03,532 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 20:25:03,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:25:03,537 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 20:30:11,960 INFO core: Event loop thread started, running loop forever
2026-08-24 20:30:12,268 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 20:30:12,273 INFO core: _init_accounts coroutine started
2026-08-24 20:30:12,275 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 20:30:12,287 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:35:11,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:40:20,908 INFO core: Event loop thread started, running loop forever
2026-08-24 20:40:21,214 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 20:40:21,221 INFO core: _init_accounts coroutine started
2026-08-24 20:40:21,222 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 20:40:21,231 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:45:47,425 INFO core: Event loop thread started, running loop forever
2026-08-24 20:45:47,726 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 20:45:47,731 INFO core: _init_accounts coroutine started
2026-08-24 20:45:47,732 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 20:45:47,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:50:36,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 20:50:36,051 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 20:50:36,052 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 20:55:05,067 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 20:55:05,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:00:12,405 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 21:00:12,406 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 21:00:24,896 INFO core: Event loop thread started, running loop forever
2026-08-24 21:00:25,197 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 21:00:25,203 INFO core: _init_accounts coroutine started
2026-08-24 21:00:25,204 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 21:00:25,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:05:31,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 21:05:49,418 INFO core: Event loop thread started, running loop forever
2026-08-24 21:05:49,719 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 21:05:49,724 INFO core: _init_accounts coroutine started
2026-08-24 21:05:49,725 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 21:05:49,730 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:10:38,063 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 21:10:38,063 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 21:10:38,064 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 21:10:38,066 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 21:10:38,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:15:19,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:20:42,848 INFO core: Event loop thread started, running loop forever
2026-08-24 21:20:43,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 21:20:43,153 INFO core: _init_accounts coroutine started
2026-08-24 21:20:43,154 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 21:20:43,164 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:25:09,318 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 21:25:09,319 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 21:25:09,320 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 21:25:09,321 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 21:25:09,332 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:30:04,718 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 21:30:04,719 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 21:30:04,728 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 21:30:04,729 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 21:30:04,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:35:10,392 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 21:35:15,582 INFO core: Event loop thread started, running loop forever
2026-08-24 21:35:15,884 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 21:35:15,890 INFO core: _init_accounts coroutine started
2026-08-24 21:35:15,891 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 21:35:15,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:40:22,439 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 21:40:22,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 21:40:22,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 21:40:22,443 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 21:40:40,858 INFO core: Event loop thread started, running loop forever
2026-08-24 21:40:41,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 21:40:41,164 INFO core: _init_accounts coroutine started
2026-08-24 21:40:41,165 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 21:40:41,182 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:45:52,015 INFO core: Event loop thread started, running loop forever
2026-08-24 21:45:52,316 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 21:45:52,320 INFO core: _init_accounts coroutine started
2026-08-24 21:45:52,321 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 21:45:52,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:50:35,963 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 21:50:35,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 21:55:04,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:00:11,254 INFO core: Event loop thread started, running loop forever
2026-08-24 22:00:11,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 22:00:11,566 INFO core: _init_accounts coroutine started
2026-08-24 22:00:11,566 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 22:00:11,602 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 22:00:11,602 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 22:00:11,630 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:05:13,273 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 22:05:13,307 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 22:05:13,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:10:20,431 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 22:10:20,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 22:10:20,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 22:10:29,170 INFO core: Event loop thread started, running loop forever
2026-08-24 22:10:29,471 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 22:10:29,476 INFO core: _init_accounts coroutine started
2026-08-24 22:10:29,476 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 22:10:29,489 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:15:05,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 22:15:28,382 INFO core: Event loop thread started, running loop forever
2026-08-24 22:15:28,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 22:15:28,688 INFO core: _init_accounts coroutine started
2026-08-24 22:15:28,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 22:15:28,698 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:20:34,464 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:20:34,465 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 22:20:34,466 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 22:25:06,031 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 22:25:06,043 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:30:12,465 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 22:30:12,466 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 22:30:12,467 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 22:30:12,468 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 22:30:36,859 INFO core: Event loop thread started, running loop forever
2026-08-24 22:30:37,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 22:30:37,165 INFO core: _init_accounts coroutine started
2026-08-24 22:30:37,166 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 22:30:37,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:35:28,239 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 22:35:28,240 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 22:35:28,241 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:35:28,242 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 22:40:42,388 INFO core: Event loop thread started, running loop forever
2026-08-24 22:40:42,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 22:40:42,694 INFO core: _init_accounts coroutine started
2026-08-24 22:40:42,694 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 22:40:42,706 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:45:21,201 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 22:45:21,201 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 22:45:21,209 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:50:23,170 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 22:50:23,177 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 22:50:23,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 22:55:38,251 INFO core: Event loop thread started, running loop forever
2026-08-24 22:55:38,552 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 22:55:38,559 INFO core: _init_accounts coroutine started
2026-08-24 22:55:38,560 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 22:55:38,569 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 22:55:38,569 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 22:55:38,571 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 22:55:38,572 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 22:55:38,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:00:38,769 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:05:32,389 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-24 23:05:32,390 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 23:05:32,396 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-24 23:05:32,397 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-24 23:05:32,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:10:39,433 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-24 23:10:43,261 INFO core: Event loop thread started, running loop forever
2026-08-24 23:10:43,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 23:10:43,566 INFO core: _init_accounts coroutine started
2026-08-24 23:10:43,567 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 23:10:43,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:15:19,755 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-24 23:15:19,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:20:42,507 INFO core: Event loop thread started, running loop forever
2026-08-24 23:20:42,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 23:20:42,817 INFO core: _init_accounts coroutine started
2026-08-24 23:20:42,818 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 23:20:42,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:25:29,497 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 23:25:29,497 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 23:25:29,499 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 23:25:29,500 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 23:25:29,508 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:30:38,813 INFO core: Event loop thread started, running loop forever
2026-08-24 23:30:39,114 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 23:30:39,120 INFO core: _init_accounts coroutine started
2026-08-24 23:30:39,122 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 23:30:39,130 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:35:22,166 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 23:35:22,166 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 23:35:22,172 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:40:29,453 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 23:40:29,454 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 23:40:44,998 INFO core: Event loop thread started, running loop forever
2026-08-24 23:40:45,299 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 23:40:45,304 INFO core: _init_accounts coroutine started
2026-08-24 23:40:45,306 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 23:40:45,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:45:34,994 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:50:41,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 23:50:41,399 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 23:50:41,399 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-24 23:50:41,399 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-24 23:50:41,399 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-24 23:50:41,400 INFO core: _init_accounts_inner: reloading LLM config
2026-08-24 23:50:41,400 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-24 23:50:41,400 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-24 23:50:41,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-24 23:50:53,022 INFO core: Event loop thread started, running loop forever
2026-08-24 23:50:53,323 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-24 23:50:53,327 INFO core: _init_accounts coroutine started
2026-08-24 23:50:53,328 INFO core: _init_accounts_inner: starting DB migrations
2026-08-24 23:50:53,338 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:55:09,939 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-24 23:55:09,940 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-24 23:55:09,942 INFO core: status() clients=0 connected=False forwarding=False
2026-08-24 23:55:09,943 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 00:00:29,064 INFO core: Event loop thread started, running loop forever
2026-08-25 00:00:29,365 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 00:00:29,370 INFO core: _init_accounts coroutine started
2026-08-25 00:00:29,370 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 00:00:29,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:05:27,142 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 00:05:27,142 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 00:05:27,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:05:27,145 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 00:10:34,423 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 00:10:36,673 INFO core: Event loop thread started, running loop forever
2026-08-25 00:10:36,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 00:10:36,981 INFO core: _init_accounts coroutine started
2026-08-25 00:10:36,981 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 00:10:36,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:15:17,298 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:20:23,721 INFO core: Event loop thread started, running loop forever
2026-08-25 00:20:24,022 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 00:20:24,027 INFO core: _init_accounts coroutine started
2026-08-25 00:20:24,028 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 00:20:24,036 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:25:42,624 INFO core: Event loop thread started, running loop forever
2026-08-25 00:25:42,925 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 00:25:42,930 INFO core: _init_accounts coroutine started
2026-08-25 00:25:42,932 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 00:25:42,939 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:30:11,827 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 00:30:11,828 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 00:30:11,831 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 00:30:11,841 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 00:30:11,845 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:30:13,874 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 00:35:48,334 INFO core: Event loop thread started, running loop forever
2026-08-25 00:35:48,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 00:35:48,642 INFO core: _init_accounts coroutine started
2026-08-25 00:35:48,643 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 00:35:48,651 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:35:48,655 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 00:35:48,655 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 00:40:46,653 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 00:40:46,655 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 00:40:46,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:45:18,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:50:25,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 00:50:52,672 INFO core: Event loop thread started, running loop forever
2026-08-25 00:50:52,973 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 00:50:52,979 INFO core: _init_accounts coroutine started
2026-08-25 00:50:52,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 00:50:52,986 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 00:55:37,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:00:29,764 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 01:00:29,765 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 01:00:29,771 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:00:29,772 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 01:05:24,888 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 01:05:24,891 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:10:42,568 INFO core: Event loop thread started, running loop forever
2026-08-25 01:10:42,869 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 01:10:42,875 INFO core: _init_accounts coroutine started
2026-08-25 01:10:42,876 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 01:10:42,882 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:15:39,995 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:20:07,405 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 01:20:07,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 01:20:07,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 01:20:07,415 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 01:20:07,429 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:25:14,411 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 01:25:34,763 INFO core: Event loop thread started, running loop forever
2026-08-25 01:25:35,064 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 01:25:35,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:30:15,874 INFO core: _init_accounts coroutine started
2026-08-25 01:30:15,875 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 01:30:15,893 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:35:45,197 INFO core: Event loop thread started, running loop forever
2026-08-25 01:35:45,498 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 01:35:45,502 INFO core: _init_accounts coroutine started
2026-08-25 01:35:45,504 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 01:35:45,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:40:14,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:45:23,859 INFO core: Event loop thread started, running loop forever
2026-08-25 01:45:24,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 01:45:24,166 INFO core: _init_accounts coroutine started
2026-08-25 01:45:24,166 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 01:45:24,176 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:50:30,384 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 01:50:43,723 INFO core: Event loop thread started, running loop forever
2026-08-25 01:50:44,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 01:50:44,029 INFO core: _init_accounts coroutine started
2026-08-25 01:50:44,029 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 01:50:44,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 01:55:24,296 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:00:50,878 INFO core: Event loop thread started, running loop forever
2026-08-25 02:00:51,179 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 02:00:51,183 INFO core: _init_accounts coroutine started
2026-08-25 02:00:51,184 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 02:00:51,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:05:51,232 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:10:46,139 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 02:10:46,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:15:11,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:20:29,705 INFO core: Event loop thread started, running loop forever
2026-08-25 02:20:30,006 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 02:20:30,014 INFO core: _init_accounts coroutine started
2026-08-25 02:20:30,015 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 02:20:30,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:25:38,933 INFO core: Event loop thread started, running loop forever
2026-08-25 02:25:39,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 02:25:39,240 INFO core: _init_accounts coroutine started
2026-08-25 02:25:39,240 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 02:25:39,250 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:30:24,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:35:30,449 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-25 02:35:44,156 INFO core: Event loop thread started, running loop forever
2026-08-25 02:35:44,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 02:35:44,463 INFO core: _init_accounts coroutine started
2026-08-25 02:35:44,464 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 02:35:44,471 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:40:08,021 INFO core: Event loop thread started, running loop forever
2026-08-25 02:40:08,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 02:40:08,331 INFO core: _init_accounts coroutine started
2026-08-25 02:40:08,332 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 02:40:08,340 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:40:51,061 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 02:45:34,835 INFO core: Event loop thread started, running loop forever
2026-08-25 02:45:35,136 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 02:45:35,140 INFO core: _init_accounts coroutine started
2026-08-25 02:45:35,141 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 02:45:35,147 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:50:04,884 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 02:55:08,077 INFO core: Event loop thread started, running loop forever
2026-08-25 02:55:08,380 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 02:55:08,385 INFO core: _init_accounts coroutine started
2026-08-25 02:55:08,386 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 02:55:08,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:00:15,105 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 03:00:28,566 INFO core: Event loop thread started, running loop forever
2026-08-25 03:00:28,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:00:28,884 INFO core: _init_accounts coroutine started
2026-08-25 03:00:28,885 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:00:28,894 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:05:26,259 INFO core: Event loop thread started, running loop forever
2026-08-25 03:05:26,560 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:05:26,565 INFO core: _init_accounts coroutine started
2026-08-25 03:05:26,567 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:05:26,576 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:05:34,267 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 03:10:03,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:15:32,499 INFO core: Event loop thread started, running loop forever
2026-08-25 03:15:32,801 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:15:32,806 INFO core: _init_accounts coroutine started
2026-08-25 03:15:32,806 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:15:32,819 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:20:39,568 INFO core: Event loop thread started, running loop forever
2026-08-25 03:20:39,870 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:20:39,875 INFO core: _init_accounts coroutine started
2026-08-25 03:20:39,876 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:20:39,885 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:25:46,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 03:25:52,261 INFO core: Event loop thread started, running loop forever
2026-08-25 03:25:52,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:25:52,566 INFO core: _init_accounts coroutine started
2026-08-25 03:25:52,567 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:25:52,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:25:52,580 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 03:25:52,580 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 03:25:52,581 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 03:25:52,582 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 03:30:37,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:35:11,061 INFO core: Event loop thread started, running loop forever
2026-08-25 03:35:11,362 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:35:11,366 INFO core: _init_accounts coroutine started
2026-08-25 03:35:11,366 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:35:11,379 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:40:31,411 INFO core: Event loop thread started, running loop forever
2026-08-25 03:40:31,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:40:31,715 INFO core: _init_accounts coroutine started
2026-08-25 03:40:31,716 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:40:31,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:45:40,328 INFO core: Event loop thread started, running loop forever
2026-08-25 03:45:40,629 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:45:40,633 INFO core: _init_accounts coroutine started
2026-08-25 03:45:40,634 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:45:40,643 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:50:48,796 INFO core: Event loop thread started, running loop forever
2026-08-25 03:50:49,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 03:50:49,101 INFO core: _init_accounts coroutine started
2026-08-25 03:50:49,102 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 03:50:49,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 03:55:45,797 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 03:55:45,798 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 03:55:45,799 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 03:55:45,801 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 03:55:45,812 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:00:48,274 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:05:25,595 INFO core: Event loop thread started, running loop forever
2026-08-25 04:05:25,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 04:05:25,902 INFO core: _init_accounts coroutine started
2026-08-25 04:05:25,903 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 04:05:25,907 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:10:14,134 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 04:10:14,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:15:16,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:20:52,435 INFO core: Event loop thread started, running loop forever
2026-08-25 04:20:52,736 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 04:20:52,741 INFO core: _init_accounts coroutine started
2026-08-25 04:20:52,741 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 04:20:52,774 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 04:20:52,775 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 04:20:52,777 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 04:20:52,780 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 04:20:52,784 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:25:29,153 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 04:25:29,154 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 04:25:29,161 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 04:25:29,162 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 04:25:29,168 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:30:15,041 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 04:30:15,042 WARNING core: Account 2: connect timed out after 35s
2026-08-25 04:30:15,042 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 04:30:15,043 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 04:30:15,043 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 04:30:15,048 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 04:30:15,049 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 04:30:15,079 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:35:08,817 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 04:35:08,821 WARNING core: Account 2: connect timed out after 35s
2026-08-25 04:35:08,822 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-25 04:35:08,823 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-25 04:35:08,824 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 04:35:08,826 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-25 04:35:08,828 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-25 04:35:08,831 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:40:14,388 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 04:40:39,927 INFO core: Event loop thread started, running loop forever
2026-08-25 04:40:40,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 04:40:40,230 INFO core: _init_accounts coroutine started
2026-08-25 04:40:40,232 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 04:40:40,251 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:45:45,134 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:50:22,852 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 04:50:22,853 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 04:50:22,854 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 04:55:27,773 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 04:55:27,781 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:00:10,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:05:16,428 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 05:05:41,561 INFO core: Event loop thread started, running loop forever
2026-08-25 05:05:41,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 05:05:41,867 INFO core: _init_accounts coroutine started
2026-08-25 05:05:41,867 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 05:05:41,892 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:10:19,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:15:13,656 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 05:15:13,657 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 05:15:13,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:20:20,396 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 05:20:53,345 INFO core: Event loop thread started, running loop forever
2026-08-25 05:20:53,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 05:20:53,652 INFO core: _init_accounts coroutine started
2026-08-25 05:20:53,653 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 05:20:53,663 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 05:20:53,664 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 05:20:53,666 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 05:20:53,669 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:25:36,526 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 05:25:36,557 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:30:06,293 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 05:30:06,293 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 05:30:06,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:35:12,447 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 05:35:12,450 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 05:35:13,701 INFO core: Event loop thread started, running loop forever
2026-08-25 05:35:14,020 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 05:35:14,028 INFO core: _init_accounts coroutine started
2026-08-25 05:35:14,028 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 05:35:14,043 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:40:18,358 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 05:40:18,359 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 05:40:18,361 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 05:40:18,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:45:24,667 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 05:45:24,678 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:50:26,209 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 05:55:33,396 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 05:55:33,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 05:55:33,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 05:55:38,934 INFO core: Event loop thread started, running loop forever
2026-08-25 05:55:39,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 05:55:39,239 INFO core: _init_accounts coroutine started
2026-08-25 05:55:39,242 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 05:55:39,256 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:00:26,004 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:05:32,436 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 06:05:48,305 INFO core: Event loop thread started, running loop forever
2026-08-25 06:05:48,607 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 06:05:48,611 INFO core: _init_accounts coroutine started
2026-08-25 06:05:48,612 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 06:05:48,625 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:10:15,981 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 06:10:15,982 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 06:10:15,994 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 06:10:15,996 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 06:10:15,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:15:10,405 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 06:15:46,514 INFO core: Event loop thread started, running loop forever
2026-08-25 06:15:46,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 06:15:46,818 INFO core: _init_accounts coroutine started
2026-08-25 06:15:46,819 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 06:15:46,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:20:51,083 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 06:20:51,083 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 06:20:51,084 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 06:20:51,086 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 06:20:51,093 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:25:41,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:30:51,691 INFO core: Event loop thread started, running loop forever
2026-08-25 06:30:51,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 06:30:51,999 INFO core: _init_accounts coroutine started
2026-08-25 06:30:52,002 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 06:30:52,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:35:43,077 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 06:35:43,078 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 06:35:43,079 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 06:35:43,081 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 06:35:43,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:40:12,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:45:25,693 INFO core: Event loop thread started, running loop forever
2026-08-25 06:45:25,994 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 06:45:25,998 INFO core: _init_accounts coroutine started
2026-08-25 06:45:25,999 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 06:45:26,005 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:50:32,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 06:50:43,417 INFO core: Event loop thread started, running loop forever
2026-08-25 06:50:43,718 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 06:50:43,725 INFO core: _init_accounts coroutine started
2026-08-25 06:50:43,726 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 06:50:43,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 06:55:15,790 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:00:19,206 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 07:00:19,207 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 07:00:19,207 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:05:26,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 07:05:26,388 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-25 07:05:35,615 INFO core: Event loop thread started, running loop forever
2026-08-25 07:05:35,925 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 07:05:35,929 INFO core: _init_accounts coroutine started
2026-08-25 07:05:35,930 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 07:05:35,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:05:35,949 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 07:10:07,515 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 07:10:07,522 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 07:10:07,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:15:14,431 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 07:15:14,432 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-25 07:15:14,433 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 07:15:14,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 07:15:33,238 INFO core: Event loop thread started, running loop forever
2026-08-25 07:15:33,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 07:15:33,556 INFO core: _init_accounts coroutine started
2026-08-25 07:15:33,557 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 07:15:33,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:20:34,138 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:20:34,139 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 07:20:34,140 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 07:25:36,605 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 07:25:36,611 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 07:25:36,629 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 07:25:36,629 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 07:25:36,630 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:25:36,634 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 07:25:36,635 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 07:30:30,239 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 07:30:30,239 WARNING core: Account 2: connect timed out after 35s
2026-08-25 07:30:30,240 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 07:30:30,240 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 07:30:30,241 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 07:30:30,242 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 07:30:30,243 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 07:30:30,247 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:35:42,254 INFO core: Event loop thread started, running loop forever
2026-08-25 07:35:42,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 07:35:42,560 INFO core: _init_accounts coroutine started
2026-08-25 07:35:42,560 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 07:35:42,570 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 07:35:42,571 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 07:35:42,572 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 07:35:42,573 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 07:35:42,583 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:40:37,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:45:26,623 INFO core: Event loop thread started, running loop forever
2026-08-25 07:45:26,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 07:45:26,930 INFO core: _init_accounts coroutine started
2026-08-25 07:45:26,931 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 07:45:26,943 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:50:08,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 07:55:31,031 INFO core: Event loop thread started, running loop forever
2026-08-25 07:55:31,332 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 07:55:31,337 INFO core: _init_accounts coroutine started
2026-08-25 07:55:31,337 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 07:55:31,345 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:00:46,056 INFO core: Event loop thread started, running loop forever
2026-08-25 08:00:46,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 08:00:46,362 INFO core: _init_accounts coroutine started
2026-08-25 08:00:46,362 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 08:00:46,374 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:05:15,587 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 08:05:15,588 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 08:05:15,590 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 08:05:15,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:10:22,416 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 08:10:22,417 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-25 08:10:22,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 08:10:22,609 INFO core: Event loop thread started, running loop forever
2026-08-25 08:10:22,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 08:10:22,918 INFO core: _init_accounts coroutine started
2026-08-25 08:10:22,920 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 08:10:22,925 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:15:29,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 08:15:33,818 INFO core: Event loop thread started, running loop forever
2026-08-25 08:15:34,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 08:15:34,125 INFO core: _init_accounts coroutine started
2026-08-25 08:15:34,125 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 08:15:34,136 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:20:13,517 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 08:20:13,517 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:20:13,518 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 08:25:04,739 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 08:25:04,762 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:30:09,434 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 08:30:24,575 INFO core: Event loop thread started, running loop forever
2026-08-25 08:30:24,876 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 08:30:24,881 INFO core: _init_accounts coroutine started
2026-08-25 08:30:24,882 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 08:30:24,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:35:44,829 INFO core: Event loop thread started, running loop forever
2026-08-25 08:35:45,130 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 08:35:45,134 INFO core: _init_accounts coroutine started
2026-08-25 08:35:45,135 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 08:35:45,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:40:26,470 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 08:40:26,470 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:40:26,471 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 08:45:50,760 INFO core: Event loop thread started, running loop forever
2026-08-25 08:45:51,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 08:45:51,066 INFO core: _init_accounts coroutine started
2026-08-25 08:45:51,067 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 08:45:51,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:50:48,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:55:33,701 INFO core: Event loop thread started, running loop forever
2026-08-25 08:55:34,003 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 08:55:34,008 INFO core: _init_accounts coroutine started
2026-08-25 08:55:34,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 08:55:34,024 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 08:55:54,727 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 08:55:54,729 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 08:55:54,739 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 08:55:54,740 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-25 08:55:54,741 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 08:55:54,741 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-25 08:55:54,741 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 08:55:54,741 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 09:00:27,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:05:23,512 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 09:05:23,512 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 09:05:23,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:10:29,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 09:10:29,366 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 09:10:29,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:15:35,439 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 09:15:43,613 INFO core: Event loop thread started, running loop forever
2026-08-25 09:15:43,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 09:15:43,918 INFO core: _init_accounts coroutine started
2026-08-25 09:15:43,918 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 09:15:43,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:20:25,956 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:25:37,268 INFO core: Event loop thread started, running loop forever
2026-08-25 09:25:37,569 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 09:25:37,573 INFO core: _init_accounts coroutine started
2026-08-25 09:25:37,573 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 09:25:37,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:30:41,837 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:35:46,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:40:37,433 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 09:40:37,471 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:45:19,934 INFO core: Event loop thread started, running loop forever
2026-08-25 09:45:20,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 09:45:20,239 INFO core: _init_accounts coroutine started
2026-08-25 09:45:20,239 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 09:45:20,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:50:29,499 INFO core: Event loop thread started, running loop forever
2026-08-25 09:50:29,800 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 09:50:29,809 INFO core: _init_accounts coroutine started
2026-08-25 09:50:29,810 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 09:50:29,810 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 09:55:07,011 INFO core: Event loop thread started, running loop forever
2026-08-25 09:55:07,315 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 09:55:07,323 INFO core: _init_accounts coroutine started
2026-08-25 09:55:07,323 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 09:55:07,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:00:31,477 INFO core: Event loop thread started, running loop forever
2026-08-25 10:00:31,778 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 10:00:31,783 INFO core: _init_accounts coroutine started
2026-08-25 10:00:31,784 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 10:00:31,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:05:26,495 INFO core: Event loop thread started, running loop forever
2026-08-25 10:05:26,797 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 10:05:26,801 INFO core: _init_accounts coroutine started
2026-08-25 10:05:26,801 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 10:05:26,812 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:10:12,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:10:12,604 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 10:10:12,612 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 10:15:16,965 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 10:15:16,970 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:20:29,137 INFO core: Event loop thread started, running loop forever
2026-08-25 10:20:29,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 10:20:29,444 INFO core: _init_accounts coroutine started
2026-08-25 10:20:29,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:20:29,453 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 10:25:36,362 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 10:25:37,902 INFO core: Event loop thread started, running loop forever
2026-08-25 10:25:38,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 10:25:38,207 INFO core: _init_accounts coroutine started
2026-08-25 10:25:38,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 10:25:38,217 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:30:24,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:35:19,619 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 10:35:19,620 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 10:35:19,626 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 10:35:19,629 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 10:35:19,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:40:40,200 INFO core: Event loop thread started, running loop forever
2026-08-25 10:40:40,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 10:40:40,505 INFO core: _init_accounts coroutine started
2026-08-25 10:40:40,506 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 10:40:40,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:45:31,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:50:46,308 INFO core: Event loop thread started, running loop forever
2026-08-25 10:50:46,609 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 10:50:46,614 INFO core: _init_accounts coroutine started
2026-08-25 10:50:46,615 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 10:50:46,623 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:55:17,995 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 10:55:17,996 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 10:55:17,997 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 10:55:17,998 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 11:00:35,500 INFO core: Event loop thread started, running loop forever
2026-08-25 11:00:35,801 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 11:00:35,806 INFO core: _init_accounts coroutine started
2026-08-25 11:00:35,807 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 11:00:35,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:05:23,267 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 11:05:23,268 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 11:05:23,269 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:10:48,942 INFO core: Event loop thread started, running loop forever
2026-08-25 11:10:49,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 11:10:49,247 INFO core: _init_accounts coroutine started
2026-08-25 11:10:49,248 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 11:10:49,258 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:15:40,708 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 11:15:40,709 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 11:15:40,715 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 11:15:40,716 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 11:15:40,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:20:09,542 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:25:16,393 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 11:25:19,979 INFO core: Event loop thread started, running loop forever
2026-08-25 11:25:20,280 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 11:25:20,284 INFO core: _init_accounts coroutine started
2026-08-25 11:25:20,285 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 11:25:20,294 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:30:26,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 11:30:33,221 INFO core: Event loop thread started, running loop forever
2026-08-25 11:30:33,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 11:30:33,526 INFO core: _init_accounts coroutine started
2026-08-25 11:30:33,527 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 11:30:33,543 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 11:30:33,544 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 11:30:33,546 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 11:30:33,549 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 11:30:33,553 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:35:13,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:40:20,430 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 11:40:20,431 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 11:40:20,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 11:40:52,295 INFO core: Event loop thread started, running loop forever
2026-08-25 11:40:52,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 11:40:52,603 INFO core: _init_accounts coroutine started
2026-08-25 11:40:52,603 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 11:40:52,611 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:45:16,560 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 11:45:16,560 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 11:45:16,565 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:50:16,475 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 11:50:16,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 11:55:42,301 INFO core: Event loop thread started, running loop forever
2026-08-25 11:55:42,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 11:55:42,615 INFO core: _init_accounts coroutine started
2026-08-25 11:55:42,618 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 11:55:42,624 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:00:12,592 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 12:00:12,602 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:05:18,952 INFO core: Event loop thread started, running loop forever
2026-08-25 12:05:19,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 12:05:19,260 INFO core: _init_accounts coroutine started
2026-08-25 12:05:19,260 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 12:05:19,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:10:23,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 12:10:23,694 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 12:10:23,697 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 12:10:23,699 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 12:10:23,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:15:08,359 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 12:15:55,366 INFO core: Event loop thread started, running loop forever
2026-08-25 12:15:55,667 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 12:15:55,673 INFO core: _init_accounts coroutine started
2026-08-25 12:15:55,673 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 12:15:55,678 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:20:51,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:25:35,397 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:30:25,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:35:51,553 INFO core: Event loop thread started, running loop forever
2026-08-25 12:35:51,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 12:35:51,860 INFO core: _init_accounts coroutine started
2026-08-25 12:35:51,860 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 12:35:51,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:40:35,095 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:45:21,306 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 12:45:21,306 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 12:45:21,308 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:50:41,329 INFO core: Event loop thread started, running loop forever
2026-08-25 12:50:41,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 12:50:41,635 INFO core: _init_accounts coroutine started
2026-08-25 12:50:41,636 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 12:50:41,648 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 12:50:41,648 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 12:50:41,649 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 12:50:41,650 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 12:50:41,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 12:50:41,666 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 12:50:41,666 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 12:50:41,671 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 12:50:41,672 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 12:55:38,731 WARNING core: Account 2: connect timed out after 35s
2026-08-25 12:55:38,732 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 12:55:38,733 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 12:55:38,734 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 12:55:38,736 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 12:55:38,737 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 12:55:38,740 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:00:37,107 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 13:00:37,108 WARNING core: Account 2: connect timed out after 35s
2026-08-25 13:00:37,109 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-25 13:00:37,109 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-25 13:00:37,110 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 13:00:37,111 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-25 13:00:37,112 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-25 13:00:37,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:05:43,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:05:43,182 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 13:05:43,185 WARNING core: Account 2: connect timed out after 35s
2026-08-25 13:05:43,186 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-25 13:05:43,186 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-25 13:10:07,670 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 13:10:07,672 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-25 13:10:07,672 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-25 13:10:07,682 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:15:13,373 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 13:15:38,314 INFO core: Event loop thread started, running loop forever
2026-08-25 13:15:38,615 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 13:15:38,620 INFO core: _init_accounts coroutine started
2026-08-25 13:15:38,620 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 13:15:38,635 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 13:15:38,635 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 13:15:38,636 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:15:38,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 13:20:42,047 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 13:20:42,073 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 13:20:42,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:20:42,074 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 13:25:40,724 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 13:25:40,725 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 13:25:40,728 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:30:37,874 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 13:30:37,874 WARNING core: Account 2: connect timed out after 35s
2026-08-25 13:30:37,875 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 13:30:37,876 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 13:30:37,877 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 13:30:37,878 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 13:30:37,878 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 13:30:37,880 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:35:04,389 INFO core: Event loop thread started, running loop forever
2026-08-25 13:35:04,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 13:35:04,693 INFO core: _init_accounts coroutine started
2026-08-25 13:35:04,694 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 13:35:04,708 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:35:44,425 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 13:35:44,426 WARNING core: Account 2: connect timed out after 35s
2026-08-25 13:35:44,427 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-25 13:35:44,427 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-25 13:35:44,428 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 13:35:44,429 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-25 13:35:44,429 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-25 13:40:47,964 INFO core: Event loop thread started, running loop forever
2026-08-25 13:40:48,266 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 13:40:48,271 INFO core: _init_accounts coroutine started
2026-08-25 13:40:48,271 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 13:40:48,291 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:40:48,296 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 13:40:48,298 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 13:40:48,302 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 13:45:48,351 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:45:48,353 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 13:50:17,781 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 13:55:15,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:00:27,883 INFO core: Event loop thread started, running loop forever
2026-08-25 14:00:28,186 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 14:00:28,192 INFO core: _init_accounts coroutine started
2026-08-25 14:00:28,192 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 14:00:28,231 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:05:08,837 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 14:05:08,838 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 14:05:08,840 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:10:14,733 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 14:10:14,735 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-25 14:10:15,727 INFO core: Event loop thread started, running loop forever
2026-08-25 14:10:16,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 14:10:16,032 INFO core: _init_accounts coroutine started
2026-08-25 14:10:16,033 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 14:10:16,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:15:10,073 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 14:15:10,074 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 14:15:10,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:20:27,390 INFO core: Event loop thread started, running loop forever
2026-08-25 14:20:27,691 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 14:20:27,696 INFO core: _init_accounts coroutine started
2026-08-25 14:20:27,697 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 14:20:27,705 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:25:13,410 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:30:09,360 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-25 14:30:42,721 INFO core: Event loop thread started, running loop forever
2026-08-25 14:30:43,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 14:30:43,031 INFO core: _init_accounts coroutine started
2026-08-25 14:30:43,032 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 14:30:43,039 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:30:43,045 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 14:35:30,904 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 14:35:30,914 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 14:35:30,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:35:30,923 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 14:40:34,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:45:29,687 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:50:09,035 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 14:55:24,202 INFO core: Event loop thread started, running loop forever
2026-08-25 14:55:24,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 14:55:24,516 INFO core: _init_accounts coroutine started
2026-08-25 14:55:24,516 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 14:55:24,528 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:00:15,165 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 15:00:15,166 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 15:00:15,169 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 15:00:15,172 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:00:15,172 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 15:05:05,456 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 15:05:05,457 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 15:05:05,465 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 15:05:05,466 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 15:05:05,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:10:12,143 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 15:10:12,144 WARNING core: Account 2: connect timed out after 35s
2026-08-25 15:10:12,144 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 15:10:12,144 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 15:10:12,145 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 15:10:12,147 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 15:10:12,147 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 15:10:21,025 INFO core: Event loop thread started, running loop forever
2026-08-25 15:10:21,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 15:10:21,335 INFO core: _init_accounts coroutine started
2026-08-25 15:10:21,336 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 15:10:21,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:15:28,399 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 15:15:36,055 INFO core: Event loop thread started, running loop forever
2026-08-25 15:15:36,356 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 15:15:36,360 INFO core: _init_accounts coroutine started
2026-08-25 15:15:36,361 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 15:15:36,373 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:20:13,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:25:22,699 INFO core: Event loop thread started, running loop forever
2026-08-25 15:25:23,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 15:25:23,006 INFO core: _init_accounts coroutine started
2026-08-25 15:25:23,007 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 15:25:23,012 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:30:46,165 INFO core: Event loop thread started, running loop forever
2026-08-25 15:30:46,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 15:30:46,471 INFO core: _init_accounts coroutine started
2026-08-25 15:30:46,472 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 15:30:46,479 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:35:28,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:40:35,321 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 15:40:35,322 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 15:40:35,322 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-25 15:40:35,323 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 15:40:35,323 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-25 15:40:35,323 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 15:40:35,323 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-25 15:40:35,323 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 15:40:35,323 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 15:40:35,337 INFO core: Event loop thread started, running loop forever
2026-08-25 15:40:35,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 15:40:35,643 INFO core: _init_accounts coroutine started
2026-08-25 15:40:35,644 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 15:40:35,654 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:45:09,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:50:14,113 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 15:55:20,241 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 15:55:20,241 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 15:55:20,244 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:00:00,396 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 16:00:00,404 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:00:00,419 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 16:00:17,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 16:00:17,440 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 16:00:41,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:00:46,664 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 16:00:46,665 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 16:00:46,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:00:53,019 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-25 16:01:29,514 WARNING core: Account 2: is_user_authorized timed out after 15s
2026-08-25 16:01:29,516 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 16:01:29,516 INFO telethon.network.mtprotosender: Connection closed while sending data
2026-08-25 16:01:36,925 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 16:01:36,926 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 16:01:36,927 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 16:01:36,928 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 16:05:06,444 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 16:05:06,445 WARNING core: Account 2: connect timed out after 35s
2026-08-25 16:05:06,445 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-25 16:05:06,445 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-25 16:05:06,446 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 16:05:06,446 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-25 16:05:06,447 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-25 16:05:06,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:10:04,348 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 16:10:04,350 WARNING core: Account 2: connect timed out after 35s
2026-08-25 16:10:04,351 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-25 16:10:04,356 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-25 16:10:04,357 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 16:10:04,358 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-25 16:10:04,359 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-25 16:10:04,389 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:15:16,362 INFO core: Event loop thread started, running loop forever
2026-08-25 16:15:16,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 16:15:16,671 INFO core: _init_accounts coroutine started
2026-08-25 16:15:16,671 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 16:15:16,682 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:20:33,800 INFO core: Event loop thread started, running loop forever
2026-08-25 16:20:34,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 16:20:34,110 INFO core: _init_accounts coroutine started
2026-08-25 16:20:34,111 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 16:20:34,116 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:25:24,832 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 16:25:24,832 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 16:25:24,834 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 16:25:24,836 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 16:25:24,843 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:27:32,144 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 16:27:32,145 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 16:27:32,155 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 16:27:32,157 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 16:27:34,447 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-25 16:27:38,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:27:52,286 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 16:27:52,288 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 16:27:52,289 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 16:30:36,326 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 16:30:36,327 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 16:30:36,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:35:22,235 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 16:35:22,239 WARNING core: Account 2: connect timed out after 35s
2026-08-25 16:35:22,240 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-25 16:35:22,241 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-25 16:35:22,242 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 16:35:22,244 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-25 16:35:22,244 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-25 16:35:22,250 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:40:08,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 16:40:08,419 WARNING core: Account 2: connect timed out after 35s
2026-08-25 16:40:08,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-25 16:40:08,420 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-25 16:40:08,420 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 16:40:08,423 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-25 16:40:08,423 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-25 16:40:08,440 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:45:06,384 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 16:45:06,385 WARNING core: Account 2: connect timed out after 35s
2026-08-25 16:45:21,276 INFO core: Event loop thread started, running loop forever
2026-08-25 16:45:21,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 16:45:21,585 INFO core: _init_accounts coroutine started
2026-08-25 16:45:21,586 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 16:45:21,595 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:50:42,895 INFO core: Event loop thread started, running loop forever
2026-08-25 16:50:43,196 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 16:50:43,200 INFO core: _init_accounts coroutine started
2026-08-25 16:50:43,201 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 16:50:43,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:55:39,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 16:55:39,283 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 16:55:39,284 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 17:00:19,554 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 17:00:19,565 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:05:22,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:10:08,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:15:15,434 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 17:15:15,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-25 17:15:15,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 17:15:15,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 17:15:38,803 INFO core: Event loop thread started, running loop forever
2026-08-25 17:15:39,104 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 17:15:39,110 INFO core: _init_accounts coroutine started
2026-08-25 17:15:39,111 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 17:15:39,121 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:20:41,539 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 17:20:41,546 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:25:08,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:30:19,562 INFO core: Event loop thread started, running loop forever
2026-08-25 17:30:19,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 17:30:19,869 INFO core: _init_accounts coroutine started
2026-08-25 17:30:19,870 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 17:30:19,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:35:20,893 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 17:35:20,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:40:06,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:45:26,854 INFO core: Event loop thread started, running loop forever
2026-08-25 17:45:27,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 17:45:27,159 INFO core: _init_accounts coroutine started
2026-08-25 17:45:27,160 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 17:45:27,167 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:50:14,339 INFO core: Event loop thread started, running loop forever
2026-08-25 17:50:14,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 17:50:14,645 INFO core: _init_accounts coroutine started
2026-08-25 17:50:14,646 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 17:50:14,651 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 17:50:34,357 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 17:55:10,768 INFO core: Event loop thread started, running loop forever
2026-08-25 17:55:11,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 17:55:11,073 INFO core: _init_accounts coroutine started
2026-08-25 17:55:11,074 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 17:55:11,086 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:00:18,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 18:00:25,229 INFO core: Event loop thread started, running loop forever
2026-08-25 18:00:25,530 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 18:00:25,535 INFO core: _init_accounts coroutine started
2026-08-25 18:00:25,536 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 18:00:25,546 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:05:35,605 INFO core: Event loop thread started, running loop forever
2026-08-25 18:05:35,906 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 18:05:35,909 INFO core: _init_accounts coroutine started
2026-08-25 18:05:35,911 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 18:05:35,919 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:10:21,687 INFO core: Event loop thread started, running loop forever
2026-08-25 18:10:21,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 18:10:21,992 INFO core: _init_accounts coroutine started
2026-08-25 18:10:21,993 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 18:10:22,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:15:20,390 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-25 18:15:20,399 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-25 18:20:43,850 INFO core: Event loop thread started, running loop forever
2026-08-25 18:20:44,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 18:20:44,156 INFO core: _init_accounts coroutine started
2026-08-25 18:20:44,156 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 18:20:44,166 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:25:49,583 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 18:25:49,598 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:30:14,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:35:32,099 INFO core: Event loop thread started, running loop forever
2026-08-25 18:35:32,400 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 18:35:32,404 INFO core: _init_accounts coroutine started
2026-08-25 18:35:32,405 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 18:35:32,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:40:08,191 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:45:06,001 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 18:45:06,001 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 18:45:06,011 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 18:45:06,013 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:50:12,436 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 18:50:12,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-25 18:50:12,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 18:50:12,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 18:50:37,100 INFO core: Event loop thread started, running loop forever
2026-08-25 18:50:37,401 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 18:50:37,404 INFO core: _init_accounts coroutine started
2026-08-25 18:50:37,406 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 18:50:37,414 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:55:20,690 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 18:55:20,691 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 18:55:20,701 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 18:55:20,704 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 18:55:20,704 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 19:00:30,555 INFO core: Event loop thread started, running loop forever
2026-08-25 19:00:30,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 19:00:30,861 INFO core: _init_accounts coroutine started
2026-08-25 19:00:30,861 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 19:00:30,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:05:37,439 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-25 19:05:47,973 INFO core: Event loop thread started, running loop forever
2026-08-25 19:05:48,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 19:05:48,280 INFO core: _init_accounts coroutine started
2026-08-25 19:05:48,280 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 19:05:48,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:10:14,117 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 19:10:14,119 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 19:10:14,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:10:14,121 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 19:15:11,103 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 19:15:11,110 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:20:18,456 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 19:20:18,457 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 19:20:18,464 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 19:20:32,496 INFO core: Event loop thread started, running loop forever
2026-08-25 19:20:32,797 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 19:20:32,802 INFO core: _init_accounts coroutine started
2026-08-25 19:20:32,803 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 19:20:32,809 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:25:19,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:30:07,258 INFO core: Event loop thread started, running loop forever
2026-08-25 19:30:07,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 19:30:07,564 INFO core: _init_accounts coroutine started
2026-08-25 19:30:07,564 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 19:30:07,577 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:30:26,284 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 19:35:13,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 19:35:24,693 INFO core: Event loop thread started, running loop forever
2026-08-25 19:35:24,994 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 19:35:25,000 INFO core: _init_accounts coroutine started
2026-08-25 19:35:25,001 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 19:35:25,009 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:40:49,838 INFO core: Event loop thread started, running loop forever
2026-08-25 19:40:50,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 19:40:50,145 INFO core: _init_accounts coroutine started
2026-08-25 19:40:50,146 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 19:40:50,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:45:19,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 19:45:19,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 19:45:19,410 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 19:45:19,412 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:50:07,776 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 19:50:07,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:55:29,038 INFO core: Event loop thread started, running loop forever
2026-08-25 19:55:29,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 19:55:29,344 INFO core: _init_accounts coroutine started
2026-08-25 19:55:29,345 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 19:55:29,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 19:55:29,358 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 19:55:29,359 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 19:55:29,360 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 19:55:29,365 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 20:00:05,995 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:05:22,224 INFO core: Event loop thread started, running loop forever
2026-08-25 20:05:22,525 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 20:05:22,529 INFO core: _init_accounts coroutine started
2026-08-25 20:05:22,530 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 20:05:22,566 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:10:29,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 20:10:45,888 INFO core: Event loop thread started, running loop forever
2026-08-25 20:10:46,189 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 20:10:46,206 INFO core: _init_accounts coroutine started
2026-08-25 20:10:46,206 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 20:10:46,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:15:19,285 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:20:24,764 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 20:20:24,764 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 20:20:24,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:25:30,370 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 20:25:42,523 INFO core: Event loop thread started, running loop forever
2026-08-25 20:25:42,824 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 20:25:42,829 INFO core: _init_accounts coroutine started
2026-08-25 20:25:42,831 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 20:25:42,843 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 20:25:42,843 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 20:25:42,845 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 20:25:42,848 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 20:25:42,852 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:30:37,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:35:30,143 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:40:30,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:45:31,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:50:46,921 INFO core: Event loop thread started, running loop forever
2026-08-25 20:50:47,223 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 20:50:47,229 INFO core: _init_accounts coroutine started
2026-08-25 20:50:47,230 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 20:50:47,239 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:55:16,552 INFO core: Event loop thread started, running loop forever
2026-08-25 20:55:16,853 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 20:55:16,858 INFO core: _init_accounts coroutine started
2026-08-25 20:55:16,859 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 20:55:16,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 20:55:54,600 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 21:00:23,378 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 21:00:27,914 INFO core: Event loop thread started, running loop forever
2026-08-25 21:00:28,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 21:00:28,220 INFO core: _init_accounts coroutine started
2026-08-25 21:00:28,221 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 21:00:28,231 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:05:06,952 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 21:05:06,966 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:10:14,681 INFO core: Event loop thread started, running loop forever
2026-08-25 21:10:14,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 21:10:14,988 INFO core: _init_accounts coroutine started
2026-08-25 21:10:14,989 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 21:10:15,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:15:06,377 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 21:15:15,950 INFO core: Event loop thread started, running loop forever
2026-08-25 21:15:16,257 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 21:15:16,266 INFO core: _init_accounts coroutine started
2026-08-25 21:15:16,267 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 21:15:16,267 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:20:16,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:25:18,790 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:30:24,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 21:30:24,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 21:30:24,395 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-25 21:30:24,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 21:30:24,397 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-25 21:30:24,397 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 21:30:36,626 INFO core: Event loop thread started, running loop forever
2026-08-25 21:30:36,927 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 21:30:36,933 INFO core: _init_accounts coroutine started
2026-08-25 21:30:36,934 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 21:30:36,945 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:35:23,748 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 21:35:23,749 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 21:35:23,754 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 21:35:23,755 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:40:30,405 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 21:40:30,405 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-25 21:40:30,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 21:40:30,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 21:40:42,437 INFO core: Event loop thread started, running loop forever
2026-08-25 21:40:42,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 21:40:42,744 INFO core: _init_accounts coroutine started
2026-08-25 21:40:42,744 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 21:40:42,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:45:43,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 21:45:43,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 21:45:43,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 21:45:43,476 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 21:45:43,490 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:50:21,263 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 21:50:21,264 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 21:50:21,271 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 21:50:21,271 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 21:50:21,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 21:55:19,611 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-25 21:55:19,612 WARNING core: Account 2: connect timed out after 35s
2026-08-25 21:55:19,615 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 21:55:19,615 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 21:55:19,617 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 21:55:19,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:00:25,408 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 22:00:25,411 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 22:00:47,704 INFO core: Event loop thread started, running loop forever
2026-08-25 22:00:48,005 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 22:00:48,010 INFO core: _init_accounts coroutine started
2026-08-25 22:00:48,011 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 22:00:48,017 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:05:04,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:10:47,121 INFO core: Event loop thread started, running loop forever
2026-08-25 22:10:47,422 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 22:10:47,427 INFO core: _init_accounts coroutine started
2026-08-25 22:10:47,428 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 22:10:47,439 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:15:43,224 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 22:15:43,224 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 22:15:43,231 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 22:15:43,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:15:43,236 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 22:20:08,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:25:47,878 INFO core: Event loop thread started, running loop forever
2026-08-25 22:25:48,179 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 22:25:48,184 INFO core: _init_accounts coroutine started
2026-08-25 22:25:48,184 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 22:25:48,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:30:40,068 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 22:30:40,069 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 22:30:40,073 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:30:40,074 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 22:35:28,443 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 22:35:28,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:40:03,525 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:45:06,766 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 22:45:06,769 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-25 22:45:06,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:45:06,787 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-25 22:45:06,789 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-25 22:50:12,442 WARNING core: Account 2: connect timed out after 35s
2026-08-25 22:50:12,444 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-25 22:50:12,444 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-25 22:50:12,446 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-25 22:50:12,448 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-25 22:50:12,449 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-25 22:50:42,831 INFO core: Event loop thread started, running loop forever
2026-08-25 22:50:43,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 22:50:43,138 INFO core: _init_accounts coroutine started
2026-08-25 22:50:43,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 22:50:43,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 22:55:39,775 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 22:55:39,776 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 22:55:39,778 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 22:55:39,778 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:00:30,724 INFO core: Event loop thread started, running loop forever
2026-08-25 23:00:31,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 23:00:31,033 INFO core: _init_accounts coroutine started
2026-08-25 23:00:31,033 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:00:31,043 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-25 23:00:31,048 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-25 23:05:48,415 INFO core: Event loop thread started, running loop forever
2026-08-25 23:05:48,716 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 23:05:48,721 INFO core: _init_accounts coroutine started
2026-08-25 23:05:48,722 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:05:48,734 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:05:48,742 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-25 23:05:48,742 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-25 23:10:24,865 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-25 23:10:24,868 INFO core: _init_accounts_inner: reloading LLM config
2026-08-25 23:10:24,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:15:26,111 INFO core: Event loop thread started, running loop forever
2026-08-25 23:15:26,412 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 23:15:26,415 INFO core: _init_accounts coroutine started
2026-08-25 23:15:26,415 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:15:26,440 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:15:31,144 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-25 23:20:38,865 INFO core: Event loop thread started, running loop forever
2026-08-25 23:20:39,167 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 23:20:39,172 INFO core: _init_accounts coroutine started
2026-08-25 23:20:39,173 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:20:39,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:25:45,358 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-25 23:25:52,846 INFO core: Event loop thread started, running loop forever
2026-08-25 23:25:53,147 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 23:25:53,151 INFO core: _init_accounts coroutine started
2026-08-25 23:25:53,152 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:25:53,161 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:30:28,884 INFO core: Event loop thread started, running loop forever
2026-08-25 23:30:29,185 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 23:30:29,190 INFO core: _init_accounts coroutine started
2026-08-25 23:30:29,190 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:30:29,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:35:30,026 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 23:35:30,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:40:45,470 INFO core: Event loop thread started, running loop forever
2026-08-25 23:40:45,771 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-25 23:40:45,776 INFO core: _init_accounts coroutine started
2026-08-25 23:40:45,776 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:40:45,782 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:45:48,262 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-25 23:45:48,273 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:50:11,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-25 23:55:17,039 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-25 23:55:17,041 INFO core: _init_accounts coroutine started
2026-08-25 23:55:17,041 INFO core: _init_accounts_inner: starting DB migrations
2026-08-25 23:55:17,048 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:00:54,728 INFO core: Event loop thread started, running loop forever
2026-08-26 00:00:55,029 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 00:00:55,033 INFO core: _init_accounts coroutine started
2026-08-26 00:00:55,033 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 00:00:55,043 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:05:37,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:10:25,282 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 00:10:25,282 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 00:10:25,284 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 00:10:25,286 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 00:10:25,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:15:32,443 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 00:15:41,355 INFO core: Event loop thread started, running loop forever
2026-08-26 00:15:41,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 00:15:41,663 INFO core: _init_accounts coroutine started
2026-08-26 00:15:41,665 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 00:15:41,673 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:20:16,022 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 00:20:16,031 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:25:51,001 INFO core: Event loop thread started, running loop forever
2026-08-26 00:25:51,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 00:25:51,309 INFO core: _init_accounts coroutine started
2026-08-26 00:25:51,327 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 00:25:51,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:30:12,777 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:35:19,368 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 00:35:19,369 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 00:35:19,369 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-26 00:35:19,370 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 00:35:19,370 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 00:35:19,370 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 00:35:19,370 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 00:35:19,370 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 00:35:19,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 00:35:27,957 INFO core: Event loop thread started, running loop forever
2026-08-26 00:35:28,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 00:35:28,263 INFO core: _init_accounts coroutine started
2026-08-26 00:35:28,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 00:35:28,275 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:40:14,961 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:45:09,177 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 00:45:09,178 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 00:45:09,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:50:16,363 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 00:50:16,364 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 00:50:16,365 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 00:50:16,366 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 00:50:50,606 INFO core: Event loop thread started, running loop forever
2026-08-26 00:50:50,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 00:50:50,913 INFO core: _init_accounts coroutine started
2026-08-26 00:50:50,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 00:50:50,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 00:55:22,585 INFO core: Event loop thread started, running loop forever
2026-08-26 00:55:22,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 00:55:22,891 INFO core: _init_accounts coroutine started
2026-08-26 00:55:22,892 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 00:55:22,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:00:18,109 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 01:00:18,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:05:15,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:10:39,894 INFO core: Event loop thread started, running loop forever
2026-08-26 01:10:40,195 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 01:10:40,201 INFO core: _init_accounts coroutine started
2026-08-26 01:10:40,206 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 01:10:40,209 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:15:31,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 01:15:31,493 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 01:15:31,495 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 01:15:31,500 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 01:15:31,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:15:31,520 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 01:15:31,521 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 01:20:14,070 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 01:20:14,071 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 01:20:14,077 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:25:33,406 INFO core: Event loop thread started, running loop forever
2026-08-26 01:25:33,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 01:25:33,711 INFO core: _init_accounts coroutine started
2026-08-26 01:25:33,712 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 01:25:33,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:30:38,366 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:35:21,845 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 01:35:21,874 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:40:21,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:45:10,798 INFO core: Event loop thread started, running loop forever
2026-08-26 01:45:11,099 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 01:45:11,104 INFO core: _init_accounts coroutine started
2026-08-26 01:45:11,105 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 01:45:11,113 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:50:37,739 INFO core: Event loop thread started, running loop forever
2026-08-26 01:50:38,040 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 01:50:38,044 INFO core: _init_accounts coroutine started
2026-08-26 01:50:38,044 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 01:50:38,055 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 01:55:14,565 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:00:21,385 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 02:00:48,354 INFO core: Event loop thread started, running loop forever
2026-08-26 02:00:48,655 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 02:00:48,660 INFO core: _init_accounts coroutine started
2026-08-26 02:00:48,660 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 02:00:48,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:05:31,558 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 02:05:31,559 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 02:05:31,574 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 02:05:31,586 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 02:05:31,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:10:19,564 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 02:10:19,565 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 02:10:19,574 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:15:25,509 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 02:15:25,511 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 02:15:25,846 INFO core: Event loop thread started, running loop forever
2026-08-26 02:15:26,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 02:15:26,157 INFO core: _init_accounts coroutine started
2026-08-26 02:15:26,158 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 02:15:26,172 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:20:39,181 INFO core: Event loop thread started, running loop forever
2026-08-26 02:20:39,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 02:20:39,491 INFO core: _init_accounts coroutine started
2026-08-26 02:20:39,492 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 02:20:39,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:25:08,694 INFO core: Event loop thread started, running loop forever
2026-08-26 02:25:08,995 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 02:25:09,007 INFO core: _init_accounts coroutine started
2026-08-26 02:25:09,007 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 02:25:09,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:25:45,769 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 02:30:16,478 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 02:30:29,533 INFO core: Event loop thread started, running loop forever
2026-08-26 02:30:29,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 02:30:29,845 INFO core: _init_accounts coroutine started
2026-08-26 02:30:29,845 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 02:30:29,863 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:35:18,205 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 02:35:18,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:40:49,617 INFO core: Event loop thread started, running loop forever
2026-08-26 02:40:49,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 02:40:49,929 INFO core: _init_accounts coroutine started
2026-08-26 02:40:49,930 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 02:40:49,937 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:45:35,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:50:42,495 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 02:50:52,005 INFO core: Event loop thread started, running loop forever
2026-08-26 02:50:52,306 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 02:50:52,316 INFO core: _init_accounts coroutine started
2026-08-26 02:50:52,317 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 02:50:52,323 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 02:55:18,113 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 02:55:18,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:00:50,599 INFO core: Event loop thread started, running loop forever
2026-08-26 03:00:50,901 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 03:00:50,907 INFO core: _init_accounts coroutine started
2026-08-26 03:00:50,908 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 03:00:50,931 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 03:00:50,931 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 03:00:50,938 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 03:00:50,940 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 03:00:50,958 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 03:00:50,959 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 03:00:50,965 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 03:00:50,966 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 03:00:50,968 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:05:29,042 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 03:05:29,043 WARNING core: Account 2: connect timed out after 35s
2026-08-26 03:05:29,044 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-26 03:05:29,044 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-26 03:05:29,045 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 03:05:29,046 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-26 03:05:29,047 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-26 03:05:29,054 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:10:19,808 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 03:10:19,822 WARNING core: Account 2: connect timed out after 35s
2026-08-26 03:10:19,823 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-26 03:10:19,823 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-26 03:10:19,824 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 03:10:19,825 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-26 03:10:19,825 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-26 03:10:19,872 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:15:59,786 INFO core: Event loop thread started, running loop forever
2026-08-26 03:16:00,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 03:16:00,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:16:00,103 INFO core: _init_accounts coroutine started
2026-08-26 03:20:51,431 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 03:20:51,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:25:36,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 03:25:36,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 03:25:36,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 03:25:36,411 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 03:25:36,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:30:24,595 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:35:56,378 INFO core: Event loop thread started, running loop forever
2026-08-26 03:35:56,679 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 03:35:56,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:35:56,692 INFO core: _init_accounts coroutine started
2026-08-26 03:35:56,693 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 03:40:13,877 INFO core: Event loop thread started, running loop forever
2026-08-26 03:40:14,178 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 03:40:14,182 INFO core: _init_accounts coroutine started
2026-08-26 03:40:14,183 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 03:40:14,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:45:18,734 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 03:45:18,735 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 03:45:18,736 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 03:45:18,737 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 03:45:18,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:50:24,573 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 03:50:24,574 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 03:50:24,575 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 03:50:56,528 INFO core: Event loop thread started, running loop forever
2026-08-26 03:50:56,830 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 03:50:56,835 INFO core: _init_accounts coroutine started
2026-08-26 03:50:56,835 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 03:50:56,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 03:55:23,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:00:28,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:05:12,455 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 04:05:12,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:10:56,596 INFO core: Event loop thread started, running loop forever
2026-08-26 04:10:56,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 04:10:56,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:15:27,670 INFO core: _init_accounts coroutine started
2026-08-26 04:15:27,670 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 04:15:27,678 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:20:30,691 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 04:20:30,713 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:25:08,038 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-26 04:25:08,043 INFO core: _init_accounts coroutine started
2026-08-26 04:25:08,044 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 04:25:08,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:30:51,196 INFO core: Event loop thread started, running loop forever
2026-08-26 04:30:51,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 04:30:51,502 INFO core: _init_accounts coroutine started
2026-08-26 04:30:51,504 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 04:30:51,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:35:15,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:40:22,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 04:40:40,145 INFO core: Event loop thread started, running loop forever
2026-08-26 04:40:40,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 04:40:40,452 INFO core: _init_accounts coroutine started
2026-08-26 04:40:40,453 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 04:40:40,469 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:45:19,354 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 04:45:19,365 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:50:19,845 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 04:55:11,271 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-26 04:55:11,272 INFO core: _init_accounts coroutine started
2026-08-26 04:55:11,272 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 04:55:11,278 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:00:49,774 INFO core: Event loop thread started, running loop forever
2026-08-26 05:00:50,076 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 05:00:50,079 INFO core: _init_accounts coroutine started
2026-08-26 05:00:50,081 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 05:00:50,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:05:17,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:10:08,879 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:15:15,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 05:15:15,417 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 05:15:39,824 INFO core: Event loop thread started, running loop forever
2026-08-26 05:15:40,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 05:15:40,130 INFO core: _init_accounts coroutine started
2026-08-26 05:15:40,130 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 05:15:40,137 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:20:35,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:20:35,214 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 05:20:35,214 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 05:20:35,216 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 05:20:35,217 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 05:25:31,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:30:40,608 INFO core: Event loop thread started, running loop forever
2026-08-26 05:30:40,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 05:30:40,918 INFO core: _init_accounts coroutine started
2026-08-26 05:30:40,918 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 05:30:40,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:35:17,713 INFO core: Event loop thread started, running loop forever
2026-08-26 05:35:18,018 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 05:35:18,022 INFO core: _init_accounts coroutine started
2026-08-26 05:35:18,023 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 05:35:18,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:35:47,745 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 05:40:24,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:40:24,059 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 05:40:24,060 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 05:45:30,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 05:45:30,444 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 05:45:37,056 INFO core: Event loop thread started, running loop forever
2026-08-26 05:45:37,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 05:45:37,361 INFO core: _init_accounts coroutine started
2026-08-26 05:45:37,362 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 05:45:37,371 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:50:15,056 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 05:50:15,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:55:36,181 INFO core: Event loop thread started, running loop forever
2026-08-26 05:55:36,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 05:55:36,488 INFO core: _init_accounts coroutine started
2026-08-26 05:55:36,489 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 05:55:36,501 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 05:55:36,502 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 05:55:36,503 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 05:55:36,505 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 05:55:36,506 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 06:00:36,675 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:05:20,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:10:27,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 06:10:27,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 06:10:27,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 06:10:46,206 INFO core: Event loop thread started, running loop forever
2026-08-26 06:10:46,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 06:10:46,511 INFO core: _init_accounts coroutine started
2026-08-26 06:10:46,513 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 06:10:46,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:15:06,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:15:07,846 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 06:15:07,846 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 06:15:07,847 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-26 06:15:07,847 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 06:15:07,847 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 06:15:07,847 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 06:15:07,848 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 06:15:07,848 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 06:15:07,848 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 06:20:36,908 INFO core: Event loop thread started, running loop forever
2026-08-26 06:20:37,209 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 06:20:37,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:20:37,224 INFO core: _init_accounts coroutine started
2026-08-26 06:20:37,224 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 06:25:03,861 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:30:09,482 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 06:30:34,998 INFO core: Event loop thread started, running loop forever
2026-08-26 06:30:35,299 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 06:30:35,304 INFO core: _init_accounts coroutine started
2026-08-26 06:30:35,305 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 06:30:35,323 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:35:36,369 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:40:43,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 06:40:53,276 INFO core: Event loop thread started, running loop forever
2026-08-26 06:40:53,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 06:40:53,584 INFO core: _init_accounts coroutine started
2026-08-26 06:40:53,585 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 06:40:53,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:40:53,602 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 06:45:10,223 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 06:45:10,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 06:45:10,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:45:10,386 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 06:50:46,651 INFO core: Event loop thread started, running loop forever
2026-08-26 06:50:46,952 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 06:50:46,959 INFO core: _init_accounts coroutine started
2026-08-26 06:50:46,959 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 06:50:46,970 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 06:55:23,468 INFO core: Event loop thread started, running loop forever
2026-08-26 06:55:23,770 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 06:55:23,775 INFO core: _init_accounts coroutine started
2026-08-26 06:55:23,777 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 06:55:23,818 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:00:30,428 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 07:00:40,406 INFO core: Event loop thread started, running loop forever
2026-08-26 07:00:40,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 07:00:40,711 INFO core: _init_accounts coroutine started
2026-08-26 07:00:40,712 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 07:00:40,721 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:00:40,724 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 07:00:40,725 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 07:00:40,726 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 07:00:40,727 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 07:05:55,270 INFO core: Event loop thread started, running loop forever
2026-08-26 07:05:55,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 07:05:55,582 INFO core: _init_accounts coroutine started
2026-08-26 07:05:55,583 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 07:05:55,597 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:05:55,599 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 07:05:55,599 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 07:10:13,859 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 07:10:13,864 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:15:19,413 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 07:15:19,415 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 07:15:23,449 INFO core: Event loop thread started, running loop forever
2026-08-26 07:15:23,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 07:15:23,757 INFO core: _init_accounts coroutine started
2026-08-26 07:15:23,757 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 07:15:23,764 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:20:07,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:25:31,074 INFO core: Event loop thread started, running loop forever
2026-08-26 07:25:31,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 07:25:31,380 INFO core: _init_accounts coroutine started
2026-08-26 07:25:31,382 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 07:25:31,393 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:30:39,343 INFO core: Event loop thread started, running loop forever
2026-08-26 07:30:39,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 07:30:39,651 INFO core: _init_accounts coroutine started
2026-08-26 07:30:39,651 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 07:30:39,660 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:35:22,052 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:40:24,301 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 07:40:24,329 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:45:05,232 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:50:49,862 INFO core: Event loop thread started, running loop forever
2026-08-26 07:50:50,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 07:50:50,170 INFO core: _init_accounts coroutine started
2026-08-26 07:50:50,171 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 07:50:50,183 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 07:50:50,184 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 07:50:50,185 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 07:50:50,186 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 07:50:50,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 07:55:12,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:00:17,815 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 08:00:17,816 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 08:00:17,817 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:05:53,356 INFO core: Event loop thread started, running loop forever
2026-08-26 08:05:53,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 08:05:53,661 INFO core: _init_accounts coroutine started
2026-08-26 08:05:53,663 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 08:05:53,673 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:10:30,087 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 08:10:30,088 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 08:10:30,090 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 08:10:30,094 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 08:10:30,094 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:15:34,995 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 08:15:34,995 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 08:15:35,001 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 08:15:35,002 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 08:15:35,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:20:25,165 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 08:20:25,166 WARNING core: Account 2: connect timed out after 35s
2026-08-26 08:20:25,167 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-26 08:20:25,167 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-26 08:20:25,168 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 08:20:25,169 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-26 08:20:25,169 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-26 08:20:25,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:25:23,441 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 08:25:23,445 WARNING core: Account 2: connect timed out after 35s
2026-08-26 08:25:23,446 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-26 08:25:23,446 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-26 08:25:23,447 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 08:25:23,448 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-26 08:25:23,448 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-26 08:25:23,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:30:07,796 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 08:30:07,797 WARNING core: Account 2: connect timed out after 35s
2026-08-26 08:30:07,798 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-26 08:30:07,798 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-26 08:30:07,799 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 08:30:07,801 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-26 08:30:07,801 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-26 08:30:07,829 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:35:13,474 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 08:35:19,348 INFO core: Event loop thread started, running loop forever
2026-08-26 08:35:19,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 08:35:19,654 INFO core: _init_accounts coroutine started
2026-08-26 08:35:19,655 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 08:35:19,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:40:41,479 INFO core: Event loop thread started, running loop forever
2026-08-26 08:40:41,780 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 08:40:41,787 INFO core: _init_accounts coroutine started
2026-08-26 08:40:41,787 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 08:40:41,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:45:11,964 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:50:21,397 INFO core: Event loop thread started, running loop forever
2026-08-26 08:50:21,699 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 08:50:21,705 INFO core: _init_accounts coroutine started
2026-08-26 08:50:21,706 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 08:50:21,718 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 08:55:38,597 INFO core: Event loop thread started, running loop forever
2026-08-26 08:55:38,898 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 08:55:38,903 INFO core: _init_accounts coroutine started
2026-08-26 08:55:38,904 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 08:55:38,930 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:00:26,479 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 09:00:26,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 09:00:26,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:05:12,947 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 09:05:12,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:05:12,967 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 09:10:18,530 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 09:10:26,344 INFO core: Event loop thread started, running loop forever
2026-08-26 09:10:26,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 09:10:26,649 INFO core: _init_accounts coroutine started
2026-08-26 09:10:26,651 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 09:10:26,663 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 09:10:26,663 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 09:10:26,664 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 09:10:26,668 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:10:26,671 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 09:15:14,646 INFO core: Event loop thread started, running loop forever
2026-08-26 09:15:14,952 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 09:15:14,956 INFO core: _init_accounts coroutine started
2026-08-26 09:15:14,956 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 09:15:14,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:20:20,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 09:20:41,900 INFO core: Event loop thread started, running loop forever
2026-08-26 09:20:42,201 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 09:20:42,207 INFO core: _init_accounts coroutine started
2026-08-26 09:20:42,207 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 09:20:42,228 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 09:20:42,229 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 09:20:42,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:20:42,232 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 09:25:22,836 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:30:23,683 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 09:30:23,723 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:35:30,482 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 09:35:30,482 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 09:35:30,483 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 09:35:50,758 INFO core: Event loop thread started, running loop forever
2026-08-26 09:35:51,059 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 09:35:51,070 INFO core: _init_accounts coroutine started
2026-08-26 09:35:51,070 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 09:35:51,078 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:40:51,551 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 09:40:51,552 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:40:51,552 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 09:45:16,266 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 09:45:16,273 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 09:45:16,274 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:50:50,269 INFO core: Event loop thread started, running loop forever
2026-08-26 09:50:50,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 09:50:50,576 INFO core: _init_accounts coroutine started
2026-08-26 09:50:50,576 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 09:50:50,582 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 09:55:39,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:00:07,002 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 10:00:07,003 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 10:00:07,025 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 10:00:07,028 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 10:00:07,057 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:05:36,803 INFO core: Event loop thread started, running loop forever
2026-08-26 10:05:37,106 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 10:05:37,110 INFO core: _init_accounts coroutine started
2026-08-26 10:05:37,113 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 10:05:37,129 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:10:13,347 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 10:10:13,372 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:15:43,664 INFO core: Event loop thread started, running loop forever
2026-08-26 10:15:43,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 10:15:43,970 INFO core: _init_accounts coroutine started
2026-08-26 10:15:43,972 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 10:15:43,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:20:08,572 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 10:20:08,573 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 10:20:08,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:25:20,996 INFO core: Event loop thread started, running loop forever
2026-08-26 10:25:21,298 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 10:25:21,301 INFO core: _init_accounts coroutine started
2026-08-26 10:25:21,303 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 10:25:21,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:30:18,935 INFO core: Event loop thread started, running loop forever
2026-08-26 10:30:19,236 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 10:30:19,244 INFO core: _init_accounts coroutine started
2026-08-26 10:30:19,245 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 10:30:19,265 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:35:12,555 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:40:18,445 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 10:40:18,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 10:40:18,446 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-26 10:40:18,447 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 10:40:18,447 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 10:40:18,447 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 10:40:18,447 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 10:40:18,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 10:40:18,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 10:40:28,168 INFO core: Event loop thread started, running loop forever
2026-08-26 10:40:28,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 10:40:28,475 INFO core: _init_accounts coroutine started
2026-08-26 10:40:28,476 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 10:40:28,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:45:33,581 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 10:45:33,582 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 10:45:33,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:50:14,986 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 10:50:14,996 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 10:50:15,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 10:55:35,395 INFO core: Event loop thread started, running loop forever
2026-08-26 10:55:35,703 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 10:55:35,708 INFO core: _init_accounts coroutine started
2026-08-26 10:55:35,709 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 10:55:35,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:00:23,566 INFO core: Event loop thread started, running loop forever
2026-08-26 11:00:23,870 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 11:00:23,878 INFO core: _init_accounts coroutine started
2026-08-26 11:00:23,878 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 11:00:23,890 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:05:05,577 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 11:05:05,578 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 11:05:05,581 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 11:05:05,586 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 11:05:05,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:10:22,551 INFO core: Event loop thread started, running loop forever
2026-08-26 11:10:22,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 11:10:22,859 INFO core: _init_accounts coroutine started
2026-08-26 11:10:22,859 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 11:10:22,869 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:15:36,609 INFO core: Event loop thread started, running loop forever
2026-08-26 11:15:36,911 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 11:15:36,915 INFO core: _init_accounts coroutine started
2026-08-26 11:15:36,915 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 11:15:36,928 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:20:32,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:25:06,824 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 11:25:06,825 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 11:25:06,831 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:25:06,832 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 11:30:42,245 INFO core: Event loop thread started, running loop forever
2026-08-26 11:30:42,546 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 11:30:42,551 INFO core: _init_accounts coroutine started
2026-08-26 11:30:42,551 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 11:30:42,555 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:35:17,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:40:33,005 INFO core: Event loop thread started, running loop forever
2026-08-26 11:40:33,306 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 11:40:33,311 INFO core: _init_accounts coroutine started
2026-08-26 11:40:33,311 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 11:40:33,320 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 11:40:33,321 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 11:40:33,322 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 11:40:33,323 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 11:40:33,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:45:31,213 INFO core: Event loop thread started, running loop forever
2026-08-26 11:45:31,519 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 11:45:31,525 INFO core: _init_accounts coroutine started
2026-08-26 11:45:31,526 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 11:45:31,538 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
2026-08-26 11:45:31,547 INFO core: status() clients=0 connected=False forwarding=False
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-26 11:50:34,902 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 11:55:34,278 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-26 11:55:34,280 INFO core: _init_accounts coroutine started
2026-08-26 11:55:34,281 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 11:55:34,293 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:00:15,653 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 12:00:15,663 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 12:00:15,671 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:05:21,441 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 12:05:21,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 12:05:21,447 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 12:05:21,448 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 12:05:21,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 12:05:21,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 12:05:29,367 INFO core: Event loop thread started, running loop forever
2026-08-26 12:05:29,668 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 12:05:29,675 INFO core: _init_accounts coroutine started
2026-08-26 12:05:29,678 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 12:05:29,684 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:10:25,636 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:15:20,737 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:20:09,593 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 12:20:09,593 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 12:20:09,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:20:09,597 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 12:25:16,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 12:25:16,409 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 12:25:51,188 INFO core: Event loop thread started, running loop forever
2026-08-26 12:25:51,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 12:25:51,494 INFO core: _init_accounts coroutine started
2026-08-26 12:25:51,495 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 12:25:51,505 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:30:31,780 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:35:31,811 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 12:35:31,812 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 12:35:31,818 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 12:35:31,820 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 12:35:31,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:40:37,434 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 12:40:37,435 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 12:40:50,879 INFO core: Event loop thread started, running loop forever
2026-08-26 12:40:51,180 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 12:40:51,186 INFO core: _init_accounts coroutine started
2026-08-26 12:40:51,188 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 12:40:51,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:45:37,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:50:06,705 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 12:50:06,705 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 12:50:06,707 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:50:06,708 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 12:55:12,393 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 12:55:24,653 INFO core: Event loop thread started, running loop forever
2026-08-26 12:55:24,954 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 12:55:24,960 INFO core: _init_accounts coroutine started
2026-08-26 12:55:24,960 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 12:55:24,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 12:55:24,973 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 12:55:24,975 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 13:00:14,472 INFO core: Event loop thread started, running loop forever
2026-08-26 13:00:14,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:00:14,781 INFO core: _init_accounts coroutine started
2026-08-26 13:00:14,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:00:14,832 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-26 13:00:14,836 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-26 13:05:24,868 INFO core: Event loop thread started, running loop forever
2026-08-26 13:05:25,169 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:05:25,174 INFO core: _init_accounts coroutine started
2026-08-26 13:05:25,175 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:05:25,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:10:31,383 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 13:10:38,817 INFO core: Event loop thread started, running loop forever
2026-08-26 13:10:39,118 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:10:39,122 INFO core: _init_accounts coroutine started
2026-08-26 13:10:39,124 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:10:39,134 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:15:30,232 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 13:15:30,239 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:20:10,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:25:34,438 INFO core: Event loop thread started, running loop forever
2026-08-26 13:25:34,739 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:25:34,744 INFO core: _init_accounts coroutine started
2026-08-26 13:25:34,745 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:25:34,761 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:25:34,763 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 13:25:34,763 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 13:30:41,556 INFO core: Event loop thread started, running loop forever
2026-08-26 13:30:41,858 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:30:41,861 INFO core: _init_accounts coroutine started
2026-08-26 13:30:41,861 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:30:41,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:35:16,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:40:23,439 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 13:40:23,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 13:40:23,442 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-26 13:40:23,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 13:40:23,443 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 13:40:23,443 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 13:40:23,443 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 13:40:46,998 INFO core: Event loop thread started, running loop forever
2026-08-26 13:40:47,299 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:40:47,305 INFO core: _init_accounts coroutine started
2026-08-26 13:40:47,305 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:40:47,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:45:13,383 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 13:45:58,737 INFO core: Event loop thread started, running loop forever
2026-08-26 13:45:59,041 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:45:59,046 INFO core: _init_accounts coroutine started
2026-08-26 13:45:59,047 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:45:59,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:50:10,064 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 13:50:10,064 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 13:50:10,066 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 13:50:10,068 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 13:50:10,070 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 13:50:10,089 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 13:50:10,089 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 13:50:10,097 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 13:55:17,506 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 13:55:17,511 WARNING core: Account 2: connect timed out after 35s
2026-08-26 13:55:17,517 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-26 13:55:17,518 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-26 13:55:17,519 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 13:55:30,619 INFO core: Event loop thread started, running loop forever
2026-08-26 13:55:30,920 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 13:55:30,925 INFO core: _init_accounts coroutine started
2026-08-26 13:55:30,926 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 13:55:30,938 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:00:36,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 14:00:45,778 INFO core: Event loop thread started, running loop forever
2026-08-26 14:00:46,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 14:00:46,084 INFO core: _init_accounts coroutine started
2026-08-26 14:00:46,086 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 14:00:46,101 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:00:46,102 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 14:05:34,834 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 14:05:34,845 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:10:22,998 INFO core: Event loop thread started, running loop forever
2026-08-26 14:10:23,300 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 14:10:23,304 INFO core: _init_accounts coroutine started
2026-08-26 14:10:23,304 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 14:10:23,323 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-26 14:10:23,328 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-26 14:10:41,009 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 14:10:41,010 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 14:10:41,011 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 14:10:41,011 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 14:10:41,011 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 14:10:41,012 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 14:15:39,468 INFO core: Event loop thread started, running loop forever
2026-08-26 14:15:39,770 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 14:15:39,775 INFO core: _init_accounts coroutine started
2026-08-26 14:15:39,776 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 14:15:39,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:20:15,876 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 14:20:15,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 14:20:15,879 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:25:07,383 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:30:37,968 INFO core: Event loop thread started, running loop forever
2026-08-26 14:30:38,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 14:30:38,276 INFO core: _init_accounts coroutine started
2026-08-26 14:30:38,277 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 14:30:38,284 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:35:14,468 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:40:04,731 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 14:40:04,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:45:06,716 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:50:09,623 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-26 14:50:09,626 INFO core: _init_accounts coroutine started
2026-08-26 14:50:09,626 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 14:50:09,634 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 14:50:09,634 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 14:50:09,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 14:50:09,639 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 14:50:09,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 14:55:03,910 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 14:55:03,912 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 14:55:03,927 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:00:10,437 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 15:00:10,439 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 15:00:27,904 INFO core: Event loop thread started, running loop forever
2026-08-26 15:00:28,207 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 15:00:28,213 INFO core: _init_accounts coroutine started
2026-08-26 15:00:28,215 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 15:00:28,226 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:05:14,759 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 15:05:14,792 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:10:38,009 INFO core: Event loop thread started, running loop forever
2026-08-26 15:10:38,310 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 15:10:38,317 INFO core: _init_accounts coroutine started
2026-08-26 15:10:38,317 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 15:10:38,332 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:15:43,241 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 15:15:43,263 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:20:52,796 INFO core: Event loop thread started, running loop forever
2026-08-26 15:20:53,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 15:20:53,103 INFO core: _init_accounts coroutine started
2026-08-26 15:20:53,105 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 15:20:53,111 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:25:33,927 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:30:04,859 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 15:30:04,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:35:53,955 INFO core: Event loop thread started, running loop forever
2026-08-26 15:35:54,257 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 15:35:54,264 INFO core: _init_accounts coroutine started
2026-08-26 15:35:54,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 15:35:54,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:40:10,457 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:45:10,983 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 15:45:11,029 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:50:21,335 INFO core: Event loop thread started, running loop forever
2026-08-26 15:50:21,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 15:50:21,643 INFO core: _init_accounts coroutine started
2026-08-26 15:50:21,646 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 15:50:21,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:55:27,480 INFO core: Event loop thread started, running loop forever
2026-08-26 15:55:27,472 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 15:55:27,781 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 15:55:27,786 INFO core: _init_accounts coroutine started
2026-08-26 15:55:27,787 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 15:55:27,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 15:55:27,804 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 15:55:27,804 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 15:55:27,805 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 15:55:27,806 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 16:00:35,688 INFO core: Event loop thread started, running loop forever
2026-08-26 16:00:35,989 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 16:00:35,995 INFO core: _init_accounts coroutine started
2026-08-26 16:00:35,995 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 16:00:36,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:05:33,725 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 16:05:33,741 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:10:38,637 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:15:31,179 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-26 16:15:31,181 INFO core: _init_accounts coroutine started
2026-08-26 16:15:31,181 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 16:15:31,189 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 16:15:31,189 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 16:15:31,191 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 16:15:31,192 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 16:15:31,200 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:20:20,542 INFO core: Event loop thread started, running loop forever
2026-08-26 16:20:20,843 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 16:20:20,850 INFO core: _init_accounts coroutine started
2026-08-26 16:20:20,850 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 16:20:20,866 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-26 16:20:20,873 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-26 16:25:43,335 INFO core: Event loop thread started, running loop forever
2026-08-26 16:25:43,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 16:25:43,643 INFO core: _init_accounts coroutine started
2026-08-26 16:25:43,644 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 16:25:43,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:30:09,041 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 16:30:09,041 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 16:30:09,044 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 16:30:09,048 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 16:30:09,074 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:30:09,075 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 16:30:09,075 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 16:35:16,381 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 16:35:16,382 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 16:35:44,661 INFO core: Event loop thread started, running loop forever
2026-08-26 16:35:44,962 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 16:35:44,968 INFO core: _init_accounts coroutine started
2026-08-26 16:35:44,969 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 16:35:44,974 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:40:20,800 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:45:26,318 INFO core: Event loop thread started, running loop forever
2026-08-26 16:45:26,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 16:45:26,629 INFO core: _init_accounts coroutine started
2026-08-26 16:45:26,634 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:45:26,644 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 16:50:10,121 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 16:55:17,372 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 16:55:30,171 INFO core: Event loop thread started, running loop forever
2026-08-26 16:55:30,472 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 16:55:30,476 INFO core: _init_accounts coroutine started
2026-08-26 16:55:30,477 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 16:55:30,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:00:35,048 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 17:00:35,049 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 17:00:35,055 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 17:00:35,058 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 17:00:35,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:05:47,902 INFO core: Event loop thread started, running loop forever
2026-08-26 17:05:48,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 17:05:48,209 INFO core: _init_accounts coroutine started
2026-08-26 17:05:48,210 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 17:05:48,217 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:10:27,223 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 17:10:27,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:15:25,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:20:23,924 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-26 17:20:23,928 INFO core: _init_accounts coroutine started
2026-08-26 17:20:23,928 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 17:20:23,939 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 17:20:23,940 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 17:20:23,943 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:25:34,177 INFO core: Event loop thread started, running loop forever
2026-08-26 17:25:34,478 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 17:25:34,482 INFO core: _init_accounts coroutine started
2026-08-26 17:25:34,483 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 17:25:34,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:30:33,812 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 17:30:33,813 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 17:30:33,815 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 17:30:33,817 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 17:30:33,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:35:08,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:40:25,167 INFO core: Event loop thread started, running loop forever
2026-08-26 17:40:25,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 17:40:25,480 INFO core: _init_accounts coroutine started
2026-08-26 17:40:25,481 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 17:40:25,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:45:05,033 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 17:45:05,033 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 17:45:05,036 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 17:45:05,059 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 17:45:05,080 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 17:45:05,080 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 17:45:05,081 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:50:31,181 INFO core: Event loop thread started, running loop forever
2026-08-26 17:50:31,483 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 17:50:31,487 INFO core: _init_accounts coroutine started
2026-08-26 17:50:31,488 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 17:50:31,500 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:55:14,168 INFO core: Event loop thread started, running loop forever
2026-08-26 17:55:14,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 17:55:14,476 INFO core: _init_accounts coroutine started
2026-08-26 17:55:14,477 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 17:55:14,487 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 17:55:14,487 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 17:55:14,488 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 17:55:38,192 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-26 18:00:20,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 18:00:20,465 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-26 18:00:20,466 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 18:00:20,466 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 18:00:20,467 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 18:00:20,467 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 18:00:46,311 INFO core: Event loop thread started, running loop forever
2026-08-26 18:00:46,613 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 18:00:46,617 INFO core: _init_accounts coroutine started
2026-08-26 18:00:46,618 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 18:00:46,632 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:00:46,634 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 18:00:46,635 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 18:00:46,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 18:05:51,620 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 18:05:51,624 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:10:32,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:15:37,583 INFO core: Event loop thread started, running loop forever
2026-08-26 18:15:37,884 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 18:15:37,887 INFO core: _init_accounts coroutine started
2026-08-26 18:15:37,887 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 18:15:37,895 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:20:33,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:25:39,484 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 18:25:49,149 INFO core: Event loop thread started, running loop forever
2026-08-26 18:25:49,450 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 18:25:49,458 INFO core: _init_accounts coroutine started
2026-08-26 18:25:49,459 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 18:25:49,566 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:30:21,055 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:30:21,061 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 18:35:28,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 18:35:29,371 INFO core: Event loop thread started, running loop forever
2026-08-26 18:35:29,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 18:35:29,681 INFO core: _init_accounts coroutine started
2026-08-26 18:35:29,681 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 18:35:29,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:40:04,530 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 18:40:04,564 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:45:10,962 INFO core: Event loop thread started, running loop forever
2026-08-26 18:45:11,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 18:45:11,268 INFO core: _init_accounts coroutine started
2026-08-26 18:45:11,269 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 18:45:11,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:50:18,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 18:50:34,785 INFO core: Event loop thread started, running loop forever
2026-08-26 18:50:35,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 18:50:35,092 INFO core: _init_accounts coroutine started
2026-08-26 18:50:35,093 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 18:50:35,099 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 18:55:33,595 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 18:55:33,596 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 18:55:33,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:00:42,788 INFO core: Event loop thread started, running loop forever
2026-08-26 19:00:43,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 19:00:43,095 INFO core: _init_accounts coroutine started
2026-08-26 19:00:43,096 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 19:00:43,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:05:06,592 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 19:05:06,593 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 19:05:06,600 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 19:05:06,603 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:05:06,604 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 19:10:13,475 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 19:10:14,769 INFO core: Event loop thread started, running loop forever
2026-08-26 19:10:15,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 19:10:15,076 INFO core: _init_accounts coroutine started
2026-08-26 19:10:15,076 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 19:10:15,090 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:15:21,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 19:15:24,480 INFO core: Event loop thread started, running loop forever
2026-08-26 19:15:24,781 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 19:15:24,789 INFO core: _init_accounts coroutine started
2026-08-26 19:15:24,789 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 19:15:24,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:20:13,428 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:25:20,384 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 19:25:37,299 INFO core: Event loop thread started, running loop forever
2026-08-26 19:25:37,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 19:25:37,606 INFO core: _init_accounts coroutine started
2026-08-26 19:25:37,606 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 19:25:37,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:30:11,795 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 19:30:11,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 19:30:11,798 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 19:30:11,799 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 19:30:11,822 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:35:09,342 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 19:35:09,342 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 19:35:09,356 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 19:35:09,358 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 19:35:09,363 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:40:16,391 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 19:40:16,392 WARNING core: Account 2: connect timed out after 35s
2026-08-26 19:40:16,393 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-26 19:40:16,394 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-26 19:40:47,743 INFO core: Event loop thread started, running loop forever
2026-08-26 19:40:48,044 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 19:40:48,048 INFO core: _init_accounts coroutine started
2026-08-26 19:40:48,049 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 19:40:48,057 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:45:30,309 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 19:45:30,310 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 19:45:30,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:45:30,319 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 19:50:25,154 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 19:50:25,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 19:55:31,371 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 19:55:31,372 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 19:55:31,372 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 19:55:48,663 INFO core: Event loop thread started, running loop forever
2026-08-26 19:55:48,963 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 19:55:48,967 INFO core: _init_accounts coroutine started
2026-08-26 19:55:48,968 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 19:55:48,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:00:27,701 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 20:00:27,701 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 20:00:27,703 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 20:00:27,709 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 20:00:27,729 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 20:00:27,730 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 20:00:27,734 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 20:00:27,735 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-26 20:00:27,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:05:04,092 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 20:05:04,092 WARNING core: Account 2: connect timed out after 35s
2026-08-26 20:05:04,093 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-26 20:05:04,095 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-26 20:05:04,096 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 20:05:04,097 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-26 20:05:04,097 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-26 20:05:04,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:10:11,462 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-26 20:10:11,463 WARNING core: Account 2: connect timed out after 35s
2026-08-26 20:10:11,464 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-26 20:10:11,464 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-26 20:10:11,464 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-26 20:10:11,465 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-26 20:10:11,466 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-26 20:10:33,757 INFO core: Event loop thread started, running loop forever
2026-08-26 20:10:34,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 20:10:34,064 INFO core: _init_accounts coroutine started
2026-08-26 20:10:34,064 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 20:10:34,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:15:40,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 20:15:52,039 INFO core: Event loop thread started, running loop forever
2026-08-26 20:15:52,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 20:15:52,347 INFO core: _init_accounts coroutine started
2026-08-26 20:15:52,347 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 20:15:52,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:20:44,583 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 20:20:44,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 20:20:44,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:20:44,587 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 20:25:20,569 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:30:17,280 INFO core: Event loop thread started, running loop forever
2026-08-26 20:30:17,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 20:30:17,598 INFO core: _init_accounts coroutine started
2026-08-26 20:30:17,598 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 20:30:17,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:31:19,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:35:45,986 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:40:30,670 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 20:40:30,671 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 20:40:30,680 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 20:40:30,687 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:45:36,444 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 20:45:36,445 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-26 20:45:36,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 20:45:43,159 INFO core: Event loop thread started, running loop forever
2026-08-26 20:45:43,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 20:45:43,473 INFO core: _init_accounts coroutine started
2026-08-26 20:45:43,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:45:43,474 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 20:50:27,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 20:55:29,551 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:00:36,469 INFO core: Event loop thread started, running loop forever
2026-08-26 21:00:36,770 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 21:00:36,776 INFO core: _init_accounts coroutine started
2026-08-26 21:00:36,776 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 21:00:36,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:05:42,701 INFO core: Event loop thread started, running loop forever
2026-08-26 21:05:43,002 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 21:05:43,006 INFO core: _init_accounts coroutine started
2026-08-26 21:05:43,007 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 21:05:43,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:10:22,841 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:15:28,408 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 21:15:48,028 INFO core: Event loop thread started, running loop forever
2026-08-26 21:15:48,329 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 21:15:48,334 INFO core: _init_accounts coroutine started
2026-08-26 21:15:48,335 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 21:15:48,345 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:20:21,189 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 21:20:21,190 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 21:20:21,193 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 21:20:21,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:25:11,158 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 21:25:11,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:30:30,270 INFO core: Event loop thread started, running loop forever
2026-08-26 21:30:30,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 21:30:30,576 INFO core: _init_accounts coroutine started
2026-08-26 21:30:30,577 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 21:30:30,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:35:33,621 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 21:35:33,622 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 21:35:33,624 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:40:31,509 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 21:40:31,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:45:25,583 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 21:45:25,584 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 21:45:25,589 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:50:34,436 INFO core: Event loop thread started, running loop forever
2026-08-26 21:50:34,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 21:50:34,741 INFO core: _init_accounts coroutine started
2026-08-26 21:50:34,743 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 21:50:34,757 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 21:55:07,037 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 21:55:07,038 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 21:55:07,044 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 21:55:07,047 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 21:55:07,055 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:00:11,946 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:05:19,586 INFO core: Event loop thread started, running loop forever
2026-08-26 22:05:19,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 22:05:19,891 INFO core: _init_accounts coroutine started
2026-08-26 22:05:19,893 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 22:05:19,901 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:10:34,152 INFO core: Event loop thread started, running loop forever
2026-08-26 22:10:34,456 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 22:10:34,461 INFO core: _init_accounts coroutine started
2026-08-26 22:10:34,461 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 22:10:34,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:15:35,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:20:41,405 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 22:20:41,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 22:20:41,407 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-26 22:20:49,315 INFO core: Event loop thread started, running loop forever
2026-08-26 22:20:49,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 22:20:49,622 INFO core: _init_accounts coroutine started
2026-08-26 22:20:49,623 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 22:20:49,646 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:25:10,548 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:30:10,088 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 22:30:10,089 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 22:30:10,092 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 22:30:10,099 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 22:30:10,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:30:10,140 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-26 22:30:10,141 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-26 22:35:17,399 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-26 22:35:45,201 INFO core: Event loop thread started, running loop forever
2026-08-26 22:35:45,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 22:35:45,521 INFO core: _init_accounts coroutine started
2026-08-26 22:35:45,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 22:35:45,545 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:40:42,061 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 22:40:42,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:45:49,149 INFO core: Event loop thread started, running loop forever
2026-08-26 22:45:49,451 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 22:45:49,455 INFO core: _init_accounts coroutine started
2026-08-26 22:45:49,455 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 22:45:49,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:50:12,801 INFO core: Event loop thread started, running loop forever
2026-08-26 22:50:13,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 22:50:13,108 INFO core: _init_accounts coroutine started
2026-08-26 22:50:13,109 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 22:50:13,125 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 22:50:55,856 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 22:55:41,642 INFO core: Event loop thread started, running loop forever
2026-08-26 22:55:41,943 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 22:55:41,948 INFO core: _init_accounts coroutine started
2026-08-26 22:55:41,949 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 22:55:41,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:00:53,985 INFO core: Event loop thread started, running loop forever
2026-08-26 23:00:54,287 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 23:00:54,295 INFO core: _init_accounts coroutine started
2026-08-26 23:00:54,295 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 23:00:54,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:05:11,771 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 23:05:11,771 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 23:05:11,773 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 23:05:11,781 INFO core: _init_accounts_inner: reloading LLM config
2026-08-26 23:05:11,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:10:08,141 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:15:42,061 INFO core: Event loop thread started, running loop forever
2026-08-26 23:15:42,362 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 23:15:42,370 INFO core: _init_accounts coroutine started
2026-08-26 23:15:42,373 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 23:15:42,374 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:20:22,206 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:25:46,552 INFO core: Event loop thread started, running loop forever
2026-08-26 23:25:46,853 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 23:25:46,857 INFO core: _init_accounts coroutine started
2026-08-26 23:25:46,858 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 23:25:46,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:30:22,983 INFO core: Event loop thread started, running loop forever
2026-08-26 23:30:23,284 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 23:30:23,292 INFO core: _init_accounts coroutine started
2026-08-26 23:30:23,292 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 23:30:23,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:30:53,006 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-26 23:35:30,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-26 23:35:39,136 INFO core: Event loop thread started, running loop forever
2026-08-26 23:35:39,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 23:35:39,442 INFO core: _init_accounts coroutine started
2026-08-26 23:35:39,443 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 23:35:39,453 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:40:07,527 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-26 23:40:07,528 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-26 23:40:07,532 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-26 23:40:07,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:45:44,814 INFO core: Event loop thread started, running loop forever
2026-08-26 23:45:45,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 23:45:45,120 INFO core: _init_accounts coroutine started
2026-08-26 23:45:45,120 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 23:45:45,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:50:53,035 INFO core: Event loop thread started, running loop forever
2026-08-26 23:50:53,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-26 23:50:53,341 INFO core: _init_accounts coroutine started
2026-08-26 23:50:53,342 INFO core: _init_accounts_inner: starting DB migrations
2026-08-26 23:50:53,349 INFO core: status() clients=0 connected=False forwarding=False
2026-08-26 23:55:18,781 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:00:25,466 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 00:00:33,892 INFO core: Event loop thread started, running loop forever
2026-08-27 00:00:34,193 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 00:00:34,197 INFO core: _init_accounts coroutine started
2026-08-27 00:00:34,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 00:00:34,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:05:05,468 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 00:05:05,470 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 00:05:05,477 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 00:05:05,482 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 00:05:05,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:10:04,995 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 00:10:04,995 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 00:10:05,000 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 00:10:05,001 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 00:10:05,008 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:15:12,401 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 00:15:12,402 WARNING core: Account 2: connect timed out after 35s
2026-08-27 00:15:12,402 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-27 00:15:12,402 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-27 00:15:12,403 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 00:15:12,404 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-27 00:15:12,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-27 00:15:31,210 INFO core: Event loop thread started, running loop forever
2026-08-27 00:15:31,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 00:15:31,516 INFO core: _init_accounts coroutine started
2026-08-27 00:15:31,517 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 00:15:31,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:20:36,098 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:25:25,676 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:25:25,677 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 00:25:25,678 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 00:30:06,003 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 00:30:06,015 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 00:30:06,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:35:12,446 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 00:35:12,447 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 00:35:12,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 00:35:32,685 INFO core: Event loop thread started, running loop forever
2026-08-27 00:35:32,986 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 00:35:32,991 INFO core: _init_accounts coroutine started
2026-08-27 00:35:32,993 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 00:35:33,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:40:30,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:45:39,560 INFO core: Event loop thread started, running loop forever
2026-08-27 00:45:39,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 00:45:39,866 INFO core: _init_accounts coroutine started
2026-08-27 00:45:39,868 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 00:45:39,880 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:45:39,881 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 00:45:39,882 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 00:50:38,528 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 00:50:38,537 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 00:50:38,540 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 00:55:27,328 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:00:35,551 INFO core: Event loop thread started, running loop forever
2026-08-27 01:00:35,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 01:00:35,856 INFO core: _init_accounts coroutine started
2026-08-27 01:00:35,857 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 01:00:35,861 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:00:35,867 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 01:05:16,136 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 01:05:16,144 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 01:05:16,145 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 01:05:16,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:10:22,550 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:15:38,164 INFO core: Event loop thread started, running loop forever
2026-08-27 01:15:38,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 01:15:38,470 INFO core: _init_accounts coroutine started
2026-08-27 01:15:38,471 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 01:15:38,478 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:20:05,926 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 01:20:05,927 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 01:20:05,928 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 01:20:05,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:20:05,930 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 01:25:12,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 01:25:34,585 INFO core: Event loop thread started, running loop forever
2026-08-27 01:25:34,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 01:25:34,895 INFO core: _init_accounts coroutine started
2026-08-27 01:25:34,895 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 01:25:34,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:30:36,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:35:16,934 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 01:35:16,935 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 01:35:16,938 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 01:35:16,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:40:42,733 INFO core: Event loop thread started, running loop forever
2026-08-27 01:40:43,035 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 01:40:43,039 INFO core: _init_accounts coroutine started
2026-08-27 01:40:43,039 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 01:40:43,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:45:25,207 INFO core: Event loop thread started, running loop forever
2026-08-27 01:45:25,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 01:45:25,513 INFO core: _init_accounts coroutine started
2026-08-27 01:45:25,514 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 01:45:25,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:50:31,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 01:50:46,389 INFO core: Event loop thread started, running loop forever
2026-08-27 01:50:46,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 01:50:46,694 INFO core: _init_accounts coroutine started
2026-08-27 01:50:46,696 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 01:50:46,705 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 01:55:11,838 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 01:55:11,838 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 01:55:11,840 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 01:55:11,843 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 01:55:11,848 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:00:17,422 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 02:00:17,422 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 02:00:17,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 02:00:54,098 INFO core: Event loop thread started, running loop forever
2026-08-27 02:00:54,399 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 02:00:54,402 INFO core: _init_accounts coroutine started
2026-08-27 02:00:54,404 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 02:00:54,422 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:05:10,281 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 02:05:10,282 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 02:05:10,285 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:05:10,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 02:10:41,194 INFO core: Event loop thread started, running loop forever
2026-08-27 02:10:41,495 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 02:10:41,500 INFO core: _init_accounts coroutine started
2026-08-27 02:10:41,502 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 02:10:41,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:15:41,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:20:30,870 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 02:20:30,870 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 02:20:30,877 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 02:20:30,879 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 02:20:30,897 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 02:20:30,898 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 02:20:30,902 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 02:20:30,903 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 02:20:30,906 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:25:25,114 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 02:25:25,115 WARNING core: Account 2: connect timed out after 35s
2026-08-27 02:25:25,116 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-27 02:25:25,116 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-27 02:25:25,119 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 02:25:25,121 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-27 02:25:25,122 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-27 02:25:25,133 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:30:19,342 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 02:30:19,343 WARNING core: Account 2: connect timed out after 35s
2026-08-27 02:30:19,344 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-27 02:30:19,345 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-27 02:30:19,346 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 02:30:19,348 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-27 02:30:19,348 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-27 02:30:19,372 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:35:26,412 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 02:35:26,415 WARNING core: Account 2: connect timed out after 35s
2026-08-27 02:35:26,415 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-27 02:35:26,415 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-27 02:35:26,416 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 02:35:26,417 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-27 02:35:26,417 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-27 02:35:39,268 INFO core: Event loop thread started, running loop forever
2026-08-27 02:35:39,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 02:35:39,574 INFO core: _init_accounts coroutine started
2026-08-27 02:35:39,576 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 02:35:39,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:40:18,305 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 02:40:18,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:45:17,761 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:50:30,115 INFO core: Event loop thread started, running loop forever
2026-08-27 02:50:30,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 02:50:30,421 INFO core: _init_accounts coroutine started
2026-08-27 02:50:30,421 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 02:50:30,431 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 02:55:37,351 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 02:55:37,473 INFO core: Event loop thread started, running loop forever
2026-08-27 02:55:37,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 02:55:37,778 INFO core: _init_accounts coroutine started
2026-08-27 02:55:37,780 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 02:55:37,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:00:19,334 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 03:00:19,334 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 03:00:19,340 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:05:26,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 03:05:37,501 INFO core: Event loop thread started, running loop forever
2026-08-27 03:05:37,803 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:05:37,810 INFO core: _init_accounts coroutine started
2026-08-27 03:05:37,810 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:05:37,847 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 03:05:37,847 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 03:05:37,851 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:10:44,416 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 03:10:47,349 INFO core: Event loop thread started, running loop forever
2026-08-27 03:10:47,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:10:47,655 INFO core: _init_accounts coroutine started
2026-08-27 03:10:47,655 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:10:47,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:15:07,334 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 03:15:46,132 INFO core: Event loop thread started, running loop forever
2026-08-27 03:15:46,433 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:15:46,436 INFO core: _init_accounts coroutine started
2026-08-27 03:15:46,437 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:15:46,448 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:20:21,416 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:20:21,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 03:25:28,373 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 03:25:28,374 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 03:25:28,375 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 03:25:28,375 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 03:25:28,375 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 03:25:28,375 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 03:25:28,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 03:25:28,376 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 03:25:41,895 INFO core: Event loop thread started, running loop forever
2026-08-27 03:25:42,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:25:42,212 INFO core: _init_accounts coroutine started
2026-08-27 03:25:42,213 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:25:42,223 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:30:19,004 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 03:30:19,005 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 03:30:19,007 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 03:30:19,009 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 03:30:19,011 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:35:42,655 INFO core: Event loop thread started, running loop forever
2026-08-27 03:35:42,957 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:35:42,962 INFO core: _init_accounts coroutine started
2026-08-27 03:35:42,963 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:35:42,973 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:40:42,992 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:45:07,084 INFO core: Event loop thread started, running loop forever
2026-08-27 03:45:07,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:45:07,396 INFO core: _init_accounts coroutine started
2026-08-27 03:45:07,396 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:45:07,417 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:45:48,153 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 03:50:13,474 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 03:50:21,465 INFO core: Event loop thread started, running loop forever
2026-08-27 03:50:21,767 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:50:21,778 INFO core: _init_accounts coroutine started
2026-08-27 03:50:21,780 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:50:21,784 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 03:55:28,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 03:55:32,181 INFO core: Event loop thread started, running loop forever
2026-08-27 03:55:32,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 03:55:32,497 INFO core: _init_accounts coroutine started
2026-08-27 03:55:32,498 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 03:55:32,499 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:00:50,550 INFO core: Event loop thread started, running loop forever
2026-08-27 04:00:50,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 04:00:50,857 INFO core: _init_accounts coroutine started
2026-08-27 04:00:50,858 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 04:00:50,865 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:05:10,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:10:40,325 INFO core: Event loop thread started, running loop forever
2026-08-27 04:10:40,626 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 04:10:40,632 INFO core: _init_accounts coroutine started
2026-08-27 04:10:40,633 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 04:10:40,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:15:12,078 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 04:15:12,078 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 04:15:12,081 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 04:15:12,082 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:20:17,804 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 04:20:17,810 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:25:46,169 INFO core: Event loop thread started, running loop forever
2026-08-27 04:25:46,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 04:25:46,475 INFO core: _init_accounts coroutine started
2026-08-27 04:25:46,476 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 04:25:46,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:30:12,217 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 04:30:12,218 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 04:30:12,232 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 04:30:12,238 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 04:30:12,245 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:35:19,446 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 04:35:37,019 INFO core: Event loop thread started, running loop forever
2026-08-27 04:35:37,320 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 04:35:37,326 INFO core: _init_accounts coroutine started
2026-08-27 04:35:37,328 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 04:35:37,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:40:29,805 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 04:40:29,805 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 04:40:29,809 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:45:23,122 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 04:45:23,123 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 04:45:23,128 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 04:45:23,150 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:50:04,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 04:55:33,383 INFO core: Event loop thread started, running loop forever
2026-08-27 04:55:33,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 04:55:33,691 INFO core: _init_accounts coroutine started
2026-08-27 04:55:33,691 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 04:55:33,702 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:00:41,399 INFO core: Event loop thread started, running loop forever
2026-08-27 05:00:41,700 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 05:00:41,704 INFO core: _init_accounts coroutine started
2026-08-27 05:00:41,706 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 05:00:41,713 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:05:33,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:10:48,718 INFO core: Event loop thread started, running loop forever
2026-08-27 05:10:49,020 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 05:10:49,025 INFO core: _init_accounts coroutine started
2026-08-27 05:10:49,025 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 05:10:49,031 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:15:27,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:20:04,206 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 05:20:04,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:20:04,239 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 05:25:11,410 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-27 05:25:11,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 05:25:11,412 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 05:25:11,412 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 05:25:11,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 05:25:11,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 05:25:11,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 05:25:30,957 INFO core: Event loop thread started, running loop forever
2026-08-27 05:25:31,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 05:25:31,266 INFO core: _init_accounts coroutine started
2026-08-27 05:25:31,267 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 05:25:31,279 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:30:06,375 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 05:30:06,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 05:30:06,376 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 05:30:06,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 05:30:06,377 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 05:30:06,378 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 05:30:10,580 INFO core: Event loop thread started, running loop forever
2026-08-27 05:30:10,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 05:30:10,887 INFO core: _init_accounts coroutine started
2026-08-27 05:30:10,888 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 05:30:10,895 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:35:22,285 INFO core: Event loop thread started, running loop forever
2026-08-27 05:35:22,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 05:35:22,591 INFO core: _init_accounts coroutine started
2026-08-27 05:35:22,592 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 05:35:22,599 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:40:47,081 INFO core: Event loop thread started, running loop forever
2026-08-27 05:40:47,382 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 05:40:47,387 INFO core: _init_accounts coroutine started
2026-08-27 05:40:47,387 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 05:40:47,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:45:26,393 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:50:47,287 INFO core: Event loop thread started, running loop forever
2026-08-27 05:50:47,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 05:50:47,597 INFO core: _init_accounts coroutine started
2026-08-27 05:50:47,598 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 05:50:47,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:55:50,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 05:55:50,421 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 05:55:50,422 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 06:00:16,355 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 06:00:16,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:05:13,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:10:04,064 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 06:10:04,124 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 06:10:04,125 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 06:10:04,132 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 06:10:04,136 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 06:10:04,143 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:15:10,371 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 06:15:31,647 INFO core: Event loop thread started, running loop forever
2026-08-27 06:15:31,948 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 06:15:31,953 INFO core: _init_accounts coroutine started
2026-08-27 06:15:31,955 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 06:15:31,966 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:20:42,336 INFO core: Event loop thread started, running loop forever
2026-08-27 06:20:42,637 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 06:20:42,641 INFO core: _init_accounts coroutine started
2026-08-27 06:20:42,643 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 06:20:42,654 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:25:38,546 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 06:25:38,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:30:19,430 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:35:23,407 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-27 06:35:23,409 INFO core: _init_accounts coroutine started
2026-08-27 06:35:23,409 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 06:35:23,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:40:30,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 06:40:30,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 06:40:30,442 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 06:40:30,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 06:40:30,442 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 06:40:30,442 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 06:40:30,443 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 06:40:30,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 06:40:30,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 06:40:49,393 INFO core: Event loop thread started, running loop forever
2026-08-27 06:40:49,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 06:40:49,699 INFO core: _init_accounts coroutine started
2026-08-27 06:40:49,700 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 06:40:49,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:45:31,949 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 06:45:31,950 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 06:45:31,951 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:50:37,422 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 06:50:37,423 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 06:50:37,423 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 06:50:37,424 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 06:50:37,424 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 06:50:37,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 06:50:37,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 06:50:37,476 INFO core: Event loop thread started, running loop forever
2026-08-27 06:50:37,777 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 06:50:37,783 INFO core: _init_accounts coroutine started
2026-08-27 06:50:37,784 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 06:50:37,788 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 06:55:07,885 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:00:13,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 07:00:14,475 INFO core: Event loop thread started, running loop forever
2026-08-27 07:00:14,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 07:00:14,781 INFO core: _init_accounts coroutine started
2026-08-27 07:00:14,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 07:00:14,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:05:21,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 07:05:35,177 INFO core: Event loop thread started, running loop forever
2026-08-27 07:05:35,478 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 07:05:35,483 INFO core: _init_accounts coroutine started
2026-08-27 07:05:35,484 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 07:05:35,497 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:10:22,989 INFO core: Event loop thread started, running loop forever
2026-08-27 07:10:23,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 07:10:23,296 INFO core: _init_accounts coroutine started
2026-08-27 07:10:23,296 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 07:10:23,310 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:10:42,019 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 07:10:42,019 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 07:10:42,026 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 07:15:04,306 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
2026-08-27 07:15:04,329 INFO core: status() clients=0 connected=False forwarding=False
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-27 07:20:27,619 INFO core: Event loop thread started, running loop forever
2026-08-27 07:20:27,920 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 07:20:27,924 INFO core: _init_accounts coroutine started
2026-08-27 07:20:27,926 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 07:20:27,937 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:25:31,567 INFO core: Event loop thread started, running loop forever
2026-08-27 07:25:31,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 07:25:31,873 INFO core: _init_accounts coroutine started
2026-08-27 07:25:31,874 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 07:25:31,885 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 07:25:31,885 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 07:25:31,894 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 07:25:31,896 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:25:31,896 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 07:30:21,508 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:35:28,577 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 07:35:28,577 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 07:35:28,578 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 07:35:31,818 INFO core: Event loop thread started, running loop forever
2026-08-27 07:35:32,129 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 07:35:32,139 INFO core: _init_accounts coroutine started
2026-08-27 07:35:32,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 07:35:32,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:40:07,572 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:45:08,083 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:45:08,084 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 07:45:08,085 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 07:50:09,822 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 07:50:09,831 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 07:50:09,831 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 07:55:16,464 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 07:55:32,766 INFO core: Event loop thread started, running loop forever
2026-08-27 07:55:33,067 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 07:55:33,072 INFO core: _init_accounts coroutine started
2026-08-27 07:55:33,073 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 07:55:33,083 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:00:24,917 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 08:00:24,918 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 08:00:24,926 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 08:00:24,929 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 08:00:24,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:05:35,483 INFO core: Event loop thread started, running loop forever
2026-08-27 08:05:35,784 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 08:05:35,789 INFO core: _init_accounts coroutine started
2026-08-27 08:05:35,790 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 08:05:35,805 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:10:39,127 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 08:10:39,128 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 08:10:39,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:15:03,830 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 08:15:03,832 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 08:15:03,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:20:10,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 08:20:37,793 INFO core: Event loop thread started, running loop forever
2026-08-27 08:20:38,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 08:20:38,100 INFO core: _init_accounts coroutine started
2026-08-27 08:20:38,101 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 08:20:38,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:25:44,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 08:25:51,272 INFO core: Event loop thread started, running loop forever
2026-08-27 08:25:51,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 08:25:51,589 INFO core: _init_accounts coroutine started
2026-08-27 08:25:51,590 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 08:25:51,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:30:15,741 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:35:21,439 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 08:35:21,440 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 08:35:21,440 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 08:35:21,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 08:35:21,441 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 08:35:21,442 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 08:35:21,442 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 08:35:21,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 08:35:21,442 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 08:35:21,666 INFO core: Event loop thread started, running loop forever
2026-08-27 08:35:21,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 08:35:21,976 INFO core: _init_accounts coroutine started
2026-08-27 08:35:21,977 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 08:35:21,993 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:40:37,213 INFO core: Event loop thread started, running loop forever
2026-08-27 08:40:37,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 08:40:37,522 INFO core: _init_accounts coroutine started
2026-08-27 08:40:37,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:40:37,535 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 08:45:42,261 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:50:08,059 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 08:50:08,059 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 08:50:08,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 08:55:15,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 08:55:15,442 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 08:55:41,205 INFO core: Event loop thread started, running loop forever
2026-08-27 08:55:41,509 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 08:55:41,515 INFO core: _init_accounts coroutine started
2026-08-27 08:55:41,516 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 08:55:41,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:00:51,938 INFO core: Event loop thread started, running loop forever
2026-08-27 09:00:52,239 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 09:00:52,248 INFO core: _init_accounts coroutine started
2026-08-27 09:00:52,249 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 09:00:52,258 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:05:42,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:10:48,915 INFO core: Event loop thread started, running loop forever
2026-08-27 09:10:48,907 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 09:10:49,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 09:10:49,220 INFO core: _init_accounts coroutine started
2026-08-27 09:10:49,222 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 09:10:49,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:15:05,317 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-27 09:15:34,574 INFO core: Event loop thread started, running loop forever
2026-08-27 09:15:34,875 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 09:15:34,881 INFO core: _init_accounts coroutine started
2026-08-27 09:15:34,881 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 09:15:34,889 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:20:21,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:25:22,268 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:30:22,829 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 09:30:22,829 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 09:30:22,834 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:35:07,335 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 09:35:07,338 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:40:23,687 INFO core: Event loop thread started, running loop forever
2026-08-27 09:40:23,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 09:40:23,993 INFO core: _init_accounts coroutine started
2026-08-27 09:40:23,994 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 09:40:24,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:45:14,841 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 09:45:14,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:50:21,143 INFO core: Event loop thread started, running loop forever
2026-08-27 09:50:21,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 09:50:21,450 INFO core: _init_accounts coroutine started
2026-08-27 09:50:21,452 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 09:50:21,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 09:55:28,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 09:55:44,459 INFO core: Event loop thread started, running loop forever
2026-08-27 09:55:44,760 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 09:55:44,764 INFO core: _init_accounts coroutine started
2026-08-27 09:55:44,765 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 09:55:44,772 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:00:17,960 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:05:39,004 INFO core: Event loop thread started, running loop forever
2026-08-27 10:05:39,305 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 10:05:39,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:10:28,509 INFO core: _init_accounts coroutine started
2026-08-27 10:10:28,510 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 10:10:28,518 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:15:16,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:20:22,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 10:20:29,210 INFO core: Event loop thread started, running loop forever
2026-08-27 10:20:29,512 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 10:20:29,518 INFO core: _init_accounts coroutine started
2026-08-27 10:20:29,518 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 10:20:29,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:25:52,000 INFO core: Event loop thread started, running loop forever
2026-08-27 10:25:52,301 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 10:25:52,304 INFO core: _init_accounts coroutine started
2026-08-27 10:25:52,304 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 10:25:52,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:30:33,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:35:13,984 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 10:35:13,986 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 10:35:13,991 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 10:35:13,993 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 10:35:14,016 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 10:35:14,016 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 10:35:14,024 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 10:35:14,025 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 10:35:14,028 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:40:20,488 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 10:40:20,490 WARNING core: Account 2: connect timed out after 35s
2026-08-27 10:40:29,979 INFO core: Event loop thread started, running loop forever
2026-08-27 10:40:30,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 10:40:30,285 INFO core: _init_accounts coroutine started
2026-08-27 10:40:30,286 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 10:40:30,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:45:50,927 INFO core: Event loop thread started, running loop forever
2026-08-27 10:45:51,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 10:45:51,241 INFO core: _init_accounts coroutine started
2026-08-27 10:45:51,241 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 10:45:51,253 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:50:25,710 INFO core: Event loop thread started, running loop forever
2026-08-27 10:50:26,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 10:50:26,017 INFO core: _init_accounts coroutine started
2026-08-27 10:50:26,018 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 10:50:26,031 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 10:55:21,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 10:55:21,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 10:55:21,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 10:55:21,448 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 10:55:21,460 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:00:25,307 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 11:00:25,308 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 11:00:25,315 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 11:00:25,316 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 11:00:25,323 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:05:12,687 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 11:05:12,688 WARNING core: Account 2: connect timed out after 35s
2026-08-27 11:05:12,688 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-27 11:05:12,689 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-27 11:05:12,689 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 11:05:12,691 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-27 11:05:12,691 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-27 11:05:12,701 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:10:11,310 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 11:10:11,311 WARNING core: Account 2: connect timed out after 35s
2026-08-27 11:10:11,313 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-27 11:10:11,313 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-27 11:10:11,314 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 11:10:11,315 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-27 11:10:11,316 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-27 11:10:11,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:15:17,808 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 11:15:17,809 WARNING core: Account 2: connect timed out after 35s
2026-08-27 11:15:17,810 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-27 11:15:17,810 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-27 11:15:17,811 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 11:15:17,812 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-27 11:15:17,813 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-27 11:15:17,816 INFO core: Event loop thread started, running loop forever
2026-08-27 11:15:18,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 11:15:18,125 INFO core: _init_accounts coroutine started
2026-08-27 11:15:18,126 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 11:15:18,138 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:20:04,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:25:37,215 INFO core: Event loop thread started, running loop forever
2026-08-27 11:25:37,516 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 11:25:37,521 INFO core: _init_accounts coroutine started
2026-08-27 11:25:37,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 11:25:37,533 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:30:10,314 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 11:30:10,315 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 11:30:10,315 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 11:30:10,316 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 11:30:10,316 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 11:30:10,316 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 11:30:10,316 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 11:30:10,316 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 11:30:10,316 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 11:30:42,532 INFO core: Event loop thread started, running loop forever
2026-08-27 11:30:42,833 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 11:30:42,839 INFO core: _init_accounts coroutine started
2026-08-27 11:30:42,839 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 11:30:42,847 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:35:09,799 INFO core: Event loop thread started, running loop forever
2026-08-27 11:35:10,100 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 11:35:10,104 INFO core: _init_accounts coroutine started
2026-08-27 11:35:10,106 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 11:35:10,118 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:35:49,842 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 11:40:17,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 11:40:49,060 INFO core: Event loop thread started, running loop forever
2026-08-27 11:40:49,361 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 11:40:49,371 INFO core: _init_accounts coroutine started
2026-08-27 11:40:49,372 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 11:40:49,381 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:40:49,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 11:40:49,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 11:45:03,857 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:50:09,435 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 11:50:09,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 11:50:09,437 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 11:50:09,437 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 11:50:09,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 11:50:09,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 11:50:36,830 INFO core: Event loop thread started, running loop forever
2026-08-27 11:50:37,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 11:50:37,142 INFO core: _init_accounts coroutine started
2026-08-27 11:50:37,142 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 11:50:37,162 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:55:13,604 INFO core: Event loop thread started, running loop forever
2026-08-27 11:55:13,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 11:55:13,914 INFO core: _init_accounts coroutine started
2026-08-27 11:55:13,915 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 11:55:13,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 11:55:44,638 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-27 12:00:13,332 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:05:42,083 INFO core: Event loop thread started, running loop forever
2026-08-27 12:05:42,384 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 12:05:42,389 INFO core: _init_accounts coroutine started
2026-08-27 12:05:42,391 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 12:05:42,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:10:42,030 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 12:10:42,030 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:10:42,031 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 12:10:42,034 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 12:15:27,013 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 12:15:27,014 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:20:31,076 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:25:11,616 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 12:25:11,618 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:25:11,619 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 12:30:09,780 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 12:30:09,785 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 12:30:09,794 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:35:15,443 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 12:35:15,446 WARNING core: Account 2: connect timed out after 35s
2026-08-27 12:35:15,448 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-27 12:35:15,448 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-27 12:35:37,930 INFO core: Event loop thread started, running loop forever
2026-08-27 12:35:38,232 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 12:35:38,238 INFO core: _init_accounts coroutine started
2026-08-27 12:35:38,239 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 12:35:38,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:40:21,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:45:45,490 INFO core: Event loop thread started, running loop forever
2026-08-27 12:45:45,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 12:45:45,795 INFO core: _init_accounts coroutine started
2026-08-27 12:45:45,795 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 12:45:45,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:50:43,351 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:55:33,655 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 12:55:33,656 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 12:55:33,662 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 12:55:33,662 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 13:00:39,488 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 13:00:39,488 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 13:00:39,489 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 13:00:39,489 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 13:00:40,894 INFO core: Event loop thread started, running loop forever
2026-08-27 13:00:41,196 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 13:00:41,203 INFO core: _init_accounts coroutine started
2026-08-27 13:00:41,203 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 13:00:41,213 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:05:07,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:10:14,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 13:10:14,399 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 13:10:14,399 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 13:10:14,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 13:10:14,400 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 13:10:14,400 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 13:10:14,400 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 13:10:14,400 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 13:10:14,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 13:10:33,554 INFO core: Event loop thread started, running loop forever
2026-08-27 13:10:33,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 13:10:33,862 INFO core: _init_accounts coroutine started
2026-08-27 13:10:33,864 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 13:10:33,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:15:10,388 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:15:10,390 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 13:15:10,391 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 13:15:10,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 13:20:17,449 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 13:20:40,733 INFO core: Event loop thread started, running loop forever
2026-08-27 13:20:41,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 13:20:41,057 INFO core: _init_accounts coroutine started
2026-08-27 13:20:41,063 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 13:20:41,076 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:20:41,096 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 13:20:41,096 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 13:20:41,099 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 13:20:41,102 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 13:25:41,218 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 13:25:41,219 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 13:25:41,227 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 13:25:41,231 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 13:25:41,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:30:19,027 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 13:30:19,028 WARNING core: Account 2: connect timed out after 35s
2026-08-27 13:30:19,029 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-27 13:30:19,029 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-27 13:30:19,034 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 13:30:19,036 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-27 13:30:19,037 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-27 13:30:19,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:35:25,446 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 13:35:25,450 WARNING core: Account 2: connect timed out after 35s
2026-08-27 13:35:25,451 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-27 13:35:25,452 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-27 13:35:30,544 INFO core: Event loop thread started, running loop forever
2026-08-27 13:35:30,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 13:35:30,850 INFO core: _init_accounts coroutine started
2026-08-27 13:35:30,851 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 13:35:30,873 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:40:14,568 INFO core: Event loop thread started, running loop forever
2026-08-27 13:40:14,869 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 13:40:14,874 INFO core: _init_accounts coroutine started
2026-08-27 13:40:14,876 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 13:40:14,888 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
2026-08-27 13:40:14,894 INFO core: status() clients=0 connected=False forwarding=False
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-27 13:45:16,272 INFO core: Event loop thread started, running loop forever
2026-08-27 13:45:16,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 13:45:16,579 INFO core: _init_accounts coroutine started
2026-08-27 13:45:16,579 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 13:45:16,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:50:27,976 INFO core: Event loop thread started, running loop forever
2026-08-27 13:50:28,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 13:50:28,281 INFO core: _init_accounts coroutine started
2026-08-27 13:50:28,281 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 13:50:28,291 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 13:55:32,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 13:55:32,626 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 13:55:32,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:00:52,035 INFO core: Event loop thread started, running loop forever
2026-08-27 14:00:52,337 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 14:00:52,341 INFO core: _init_accounts coroutine started
2026-08-27 14:00:52,350 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 14:00:52,353 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:05:49,146 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:10:37,679 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:15:37,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 14:15:37,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 14:15:37,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:20:17,722 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 14:20:17,729 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:25:30,309 INFO core: Event loop thread started, running loop forever
2026-08-27 14:25:30,610 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 14:25:30,616 INFO core: _init_accounts coroutine started
2026-08-27 14:25:30,617 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 14:25:30,626 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:30:37,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 14:30:53,571 INFO core: Event loop thread started, running loop forever
2026-08-27 14:30:53,872 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 14:30:53,878 INFO core: _init_accounts coroutine started
2026-08-27 14:30:53,879 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 14:30:53,888 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:35:18,369 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:40:49,220 INFO core: Event loop thread started, running loop forever
2026-08-27 14:40:49,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 14:40:49,526 INFO core: _init_accounts coroutine started
2026-08-27 14:40:49,527 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 14:40:49,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:45:18,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:50:21,848 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 14:50:21,857 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 14:55:16,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:00:51,459 INFO core: Event loop thread started, running loop forever
2026-08-27 15:00:51,760 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 15:00:51,764 INFO core: _init_accounts coroutine started
2026-08-27 15:00:51,765 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 15:00:51,778 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:05:36,646 INFO core: Event loop thread started, running loop forever
2026-08-27 15:05:36,947 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 15:05:36,951 INFO core: _init_accounts coroutine started
2026-08-27 15:05:36,951 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 15:05:36,973 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:10:27,702 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 15:10:27,702 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 15:10:27,704 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 15:10:27,707 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 15:10:27,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:15:24,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:20:33,360 INFO core: Event loop thread started, running loop forever
2026-08-27 15:20:33,661 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 15:20:33,666 INFO core: _init_accounts coroutine started
2026-08-27 15:20:33,667 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 15:20:33,680 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 15:20:33,681 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 15:20:33,682 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 15:20:33,686 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 15:20:33,687 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:25:51,289 INFO core: Event loop thread started, running loop forever
2026-08-27 15:25:51,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 15:25:51,593 INFO core: _init_accounts coroutine started
2026-08-27 15:25:51,594 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 15:25:51,604 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:30:38,245 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:35:38,821 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 15:35:38,824 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 15:35:38,834 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:40:53,276 INFO core: Event loop thread started, running loop forever
2026-08-27 15:40:53,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 15:40:53,582 INFO core: _init_accounts coroutine started
2026-08-27 15:40:53,583 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 15:40:53,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:45:17,327 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 15:45:17,327 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 15:45:17,332 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 15:45:17,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:50:23,414 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 15:50:23,415 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 15:50:23,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 15:50:23,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 15:50:38,034 INFO core: Event loop thread started, running loop forever
2026-08-27 15:50:38,335 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 15:50:38,340 INFO core: _init_accounts coroutine started
2026-08-27 15:50:38,341 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 15:50:38,359 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 15:55:26,230 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 15:55:26,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:00:45,576 INFO core: Event loop thread started, running loop forever
2026-08-27 16:00:45,878 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 16:00:45,882 INFO core: _init_accounts coroutine started
2026-08-27 16:00:45,882 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 16:00:45,900 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:05:17,799 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 16:05:17,811 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:10:33,962 INFO core: Event loop thread started, running loop forever
2026-08-27 16:10:34,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 16:10:34,267 INFO core: _init_accounts coroutine started
2026-08-27 16:10:34,269 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 16:10:34,274 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:15:41,577 INFO core: Event loop thread started, running loop forever
2026-08-27 16:15:41,878 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 16:15:41,882 INFO core: _init_accounts coroutine started
2026-08-27 16:15:41,883 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 16:15:41,895 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:20:40,444 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 16:20:40,445 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 16:20:40,449 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:25:23,080 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 16:25:23,081 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 16:25:23,084 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:30:30,397 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 16:30:43,385 INFO core: Event loop thread started, running loop forever
2026-08-27 16:30:43,687 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 16:30:43,691 INFO core: _init_accounts coroutine started
2026-08-27 16:30:43,692 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 16:30:43,704 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:35:32,537 INFO core: Event loop thread started, running loop forever
2026-08-27 16:35:32,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 16:35:32,843 INFO core: _init_accounts coroutine started
2026-08-27 16:35:32,844 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 16:35:32,853 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:35:50,555 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 16:40:07,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:40:07,236 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 16:40:07,236 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 16:45:14,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 16:45:14,380 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 16:45:14,381 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 16:45:14,381 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 16:45:14,381 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 16:45:14,382 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 16:45:29,601 INFO core: Event loop thread started, running loop forever
2026-08-27 16:45:29,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 16:45:29,906 INFO core: _init_accounts coroutine started
2026-08-27 16:45:29,908 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 16:45:29,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:50:12,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 16:55:26,273 INFO core: Event loop thread started, running loop forever
2026-08-27 16:55:26,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 16:55:26,578 INFO core: _init_accounts coroutine started
2026-08-27 16:55:26,579 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 16:55:26,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:00:51,554 INFO core: Event loop thread started, running loop forever
2026-08-27 17:00:51,855 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 17:00:51,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:05:39,977 INFO core: _init_accounts coroutine started
2026-08-27 17:05:39,981 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 17:05:39,993 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:10:38,150 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 17:10:38,151 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 17:10:38,154 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:15:05,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 17:15:05,427 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 17:15:05,429 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:20:12,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 17:20:52,996 INFO core: Event loop thread started, running loop forever
2026-08-27 17:20:53,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 17:20:53,303 INFO core: _init_accounts coroutine started
2026-08-27 17:20:53,305 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 17:20:53,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:25:07,965 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 17:25:07,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:30:14,212 INFO core: Event loop thread started, running loop forever
2026-08-27 17:30:14,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 17:30:14,522 INFO core: _init_accounts coroutine started
2026-08-27 17:30:14,522 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 17:30:14,541 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:35:04,932 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:40:10,428 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 17:40:10,429 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 17:40:10,429 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 17:40:10,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 17:40:45,164 INFO core: Event loop thread started, running loop forever
2026-08-27 17:40:45,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 17:40:45,470 INFO core: _init_accounts coroutine started
2026-08-27 17:40:45,472 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 17:40:45,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:45:03,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:45:03,517 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 17:45:03,517 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 17:50:10,366 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 17:50:10,366 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-27 17:50:10,367 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 17:50:10,367 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-27 17:50:10,367 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 17:50:10,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 17:50:51,351 INFO core: Event loop thread started, running loop forever
2026-08-27 17:50:51,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 17:50:51,662 INFO core: _init_accounts coroutine started
2026-08-27 17:50:51,663 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 17:50:51,667 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 17:55:39,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:00:37,151 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 18:00:37,151 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 18:00:37,157 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 18:00:37,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:05:05,707 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 18:05:05,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:10:35,887 INFO core: Event loop thread started, running loop forever
2026-08-27 18:10:36,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 18:10:36,191 INFO core: _init_accounts coroutine started
2026-08-27 18:10:36,193 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 18:10:36,204 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:15:02,310 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 18:15:25,537 INFO core: Event loop thread started, running loop forever
2026-08-27 18:15:25,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 18:15:25,841 INFO core: _init_accounts coroutine started
2026-08-27 18:15:25,842 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 18:15:25,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:15:25,858 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 18:15:25,858 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 18:20:32,399 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 18:20:53,447 INFO core: Event loop thread started, running loop forever
2026-08-27 18:20:53,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 18:20:53,752 INFO core: _init_accounts coroutine started
2026-08-27 18:20:53,753 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 18:20:53,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:25:29,359 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 18:25:29,359 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 18:25:29,361 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:25:29,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 18:30:21,775 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 18:30:21,777 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:35:27,441 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 18:35:27,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 18:35:27,442 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-27 18:35:29,480 INFO core: Event loop thread started, running loop forever
2026-08-27 18:35:29,781 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 18:35:29,786 INFO core: _init_accounts coroutine started
2026-08-27 18:35:29,787 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 18:35:29,799 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:35:29,804 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 18:40:05,882 INFO core: Event loop thread started, running loop forever
2026-08-27 18:40:06,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 18:40:06,191 INFO core: _init_accounts coroutine started
2026-08-27 18:40:06,192 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 18:40:06,198 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:40:35,918 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 18:40:35,919 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 18:45:10,485 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:50:17,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 18:50:17,367 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 18:50:17,368 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-27 18:50:17,370 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 18:50:31,312 INFO core: Event loop thread started, running loop forever
2026-08-27 18:50:31,613 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 18:50:31,625 INFO core: _init_accounts coroutine started
2026-08-27 18:50:31,625 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 18:50:31,635 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 18:55:36,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 18:55:36,467 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 18:55:36,483 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 18:55:36,484 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 18:55:36,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:00:53,488 INFO core: Event loop thread started, running loop forever
2026-08-27 19:00:53,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 19:00:53,795 INFO core: _init_accounts coroutine started
2026-08-27 19:00:53,795 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 19:00:53,802 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:05:36,740 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 19:05:36,752 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:10:04,407 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:15:41,541 INFO core: Event loop thread started, running loop forever
2026-08-27 19:15:41,842 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 19:15:41,847 INFO core: _init_accounts coroutine started
2026-08-27 19:15:41,848 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 19:15:41,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:15:41,879 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 19:15:41,885 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 19:15:41,890 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 19:15:41,892 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 19:20:34,731 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:25:18,740 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:30:20,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:35:51,341 INFO core: Event loop thread started, running loop forever
2026-08-27 19:35:51,642 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 19:35:51,651 INFO core: _init_accounts coroutine started
2026-08-27 19:35:51,653 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 19:35:51,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:40:40,487 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 19:40:40,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:45:26,957 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:50:14,367 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-27 19:50:14,369 INFO core: _init_accounts coroutine started
2026-08-27 19:50:14,370 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 19:50:14,374 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:55:30,040 INFO core: Event loop thread started, running loop forever
2026-08-27 19:55:30,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 19:55:30,345 INFO core: _init_accounts coroutine started
2026-08-27 19:55:30,346 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 19:55:30,369 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 19:55:30,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 19:55:30,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 19:55:30,378 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 19:55:30,379 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 20:00:54,033 INFO core: Event loop thread started, running loop forever
2026-08-27 20:00:54,335 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 20:00:54,339 INFO core: _init_accounts coroutine started
2026-08-27 20:00:54,340 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 20:00:54,359 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:05:15,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:10:22,421 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 20:10:47,914 INFO core: Event loop thread started, running loop forever
2026-08-27 20:10:48,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 20:10:48,219 INFO core: _init_accounts coroutine started
2026-08-27 20:10:48,220 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 20:10:48,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:15:35,532 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:20:42,093 INFO core: Event loop thread started, running loop forever
2026-08-27 20:20:42,394 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 20:20:42,398 INFO core: _init_accounts coroutine started
2026-08-27 20:20:42,400 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 20:20:42,411 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:25:34,791 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:30:10,622 INFO core: Event loop thread started, running loop forever
2026-08-27 20:30:10,926 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 20:30:10,936 INFO core: _init_accounts coroutine started
2026-08-27 20:30:10,936 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 20:30:10,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:35:30,788 INFO core: Event loop thread started, running loop forever
2026-08-27 20:35:31,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 20:35:31,093 INFO core: _init_accounts coroutine started
2026-08-27 20:35:31,093 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 20:35:31,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:40:27,351 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 20:40:27,353 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 20:40:27,357 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 20:40:27,358 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 20:40:27,369 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 20:40:27,370 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 20:40:27,374 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 20:40:27,375 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 20:40:27,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:45:39,198 INFO core: Event loop thread started, running loop forever
2026-08-27 20:45:39,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 20:45:39,504 INFO core: _init_accounts coroutine started
2026-08-27 20:45:39,505 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 20:45:39,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:50:36,570 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 20:50:36,571 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 20:50:36,573 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 20:55:44,035 INFO core: Event loop thread started, running loop forever
2026-08-27 20:55:44,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 20:55:44,340 INFO core: _init_accounts coroutine started
2026-08-27 20:55:44,340 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 20:55:44,358 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:00:39,316 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 21:00:39,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:00:39,317 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 21:05:22,669 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 21:05:22,672 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:10:22,286 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 21:10:22,293 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:15:52,949 INFO core: Event loop thread started, running loop forever
2026-08-27 21:15:53,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 21:15:53,255 INFO core: _init_accounts coroutine started
2026-08-27 21:15:53,257 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 21:15:53,265 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:20:21,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:25:29,862 INFO core: Event loop thread started, running loop forever
2026-08-27 21:25:30,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 21:25:30,170 INFO core: _init_accounts coroutine started
2026-08-27 21:25:30,170 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 21:25:30,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:30:14,497 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 21:30:14,518 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:35:16,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:40:28,174 INFO core: Event loop thread started, running loop forever
2026-08-27 21:40:28,475 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 21:40:28,479 INFO core: _init_accounts coroutine started
2026-08-27 21:40:28,480 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 21:40:28,493 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 21:40:28,493 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 21:40:28,496 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 21:40:28,498 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 21:40:28,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:45:40,538 INFO core: Event loop thread started, running loop forever
2026-08-27 21:45:40,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 21:45:40,842 INFO core: _init_accounts coroutine started
2026-08-27 21:45:40,843 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 21:45:40,856 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:50:13,598 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 21:50:13,599 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 21:50:13,608 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 21:50:13,610 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 21:50:13,620 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 21:50:13,621 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 21:50:13,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 21:50:13,629 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 21:50:13,630 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 21:55:19,375 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 21:55:19,376 WARNING core: Account 2: connect timed out after 35s
2026-08-27 21:55:19,378 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-27 21:55:19,378 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-27 21:55:19,380 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 21:55:51,572 INFO core: Event loop thread started, running loop forever
2026-08-27 21:55:51,873 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 21:55:51,879 INFO core: _init_accounts coroutine started
2026-08-27 21:55:51,881 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 21:55:51,886 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:00:20,919 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-27 22:00:20,925 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:05:49,086 INFO core: Event loop thread started, running loop forever
2026-08-27 22:05:49,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 22:05:49,392 INFO core: _init_accounts coroutine started
2026-08-27 22:05:49,393 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 22:05:49,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:10:31,142 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 22:10:31,143 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 22:10:31,144 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 22:10:31,146 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 22:10:31,166 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:15:06,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:20:36,247 INFO core: Event loop thread started, running loop forever
2026-08-27 22:20:36,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 22:20:36,554 INFO core: _init_accounts coroutine started
2026-08-27 22:20:36,555 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 22:20:36,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:25:39,484 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:30:40,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 22:30:40,585 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 22:30:40,593 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 22:30:40,595 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 22:30:40,596 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:35:12,423 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:40:19,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 22:40:43,578 INFO core: Event loop thread started, running loop forever
2026-08-27 22:40:43,879 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 22:40:43,883 INFO core: _init_accounts coroutine started
2026-08-27 22:40:43,884 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 22:40:43,895 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:45:18,704 INFO core: Event loop thread started, running loop forever
2026-08-27 22:45:19,006 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 22:45:19,010 INFO core: _init_accounts coroutine started
2026-08-27 22:45:19,010 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 22:45:19,015 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:50:08,337 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 22:50:08,337 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 22:50:08,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 22:50:08,340 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 22:50:08,342 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 22:55:37,406 INFO core: Event loop thread started, running loop forever
2026-08-27 22:55:37,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 22:55:37,715 INFO core: _init_accounts coroutine started
2026-08-27 22:55:37,717 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 22:55:37,720 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:00:30,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:05:20,567 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 23:05:20,567 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 23:05:20,575 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:10:30,862 INFO core: Event loop thread started, running loop forever
2026-08-27 23:10:31,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 23:10:31,168 INFO core: _init_accounts coroutine started
2026-08-27 23:10:31,168 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 23:10:31,182 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 23:10:31,182 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 23:10:31,183 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 23:10:31,184 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 23:10:31,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:10:31,195 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-27 23:10:31,205 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-27 23:15:33,089 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-27 23:15:33,090 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-27 23:15:33,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:20:28,702 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 23:20:28,702 WARNING core: Account 2: connect timed out after 35s
2026-08-27 23:20:28,703 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-27 23:20:28,703 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-27 23:20:28,704 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 23:20:28,705 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-27 23:20:28,706 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-27 23:20:28,712 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:25:14,055 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 23:25:14,056 WARNING core: Account 2: connect timed out after 35s
2026-08-27 23:25:14,057 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-27 23:25:14,057 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-27 23:25:14,058 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 23:25:14,059 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-27 23:25:14,060 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-27 23:25:14,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:30:21,383 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-27 23:30:21,384 WARNING core: Account 2: connect timed out after 35s
2026-08-27 23:30:21,385 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-27 23:30:21,386 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-27 23:30:21,387 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-27 23:30:21,388 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-27 23:30:21,388 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-27 23:30:37,330 INFO core: Event loop thread started, running loop forever
2026-08-27 23:30:37,631 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 23:30:37,638 INFO core: _init_accounts coroutine started
2026-08-27 23:30:37,638 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 23:30:37,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:35:17,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-27 23:35:17,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-27 23:35:17,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:40:18,345 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-27 23:40:18,347 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:45:05,389 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:50:10,363 INFO core: _init_accounts_inner: reloading LLM config
2026-08-27 23:50:10,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-27 23:55:31,600 INFO core: Event loop thread started, running loop forever
2026-08-27 23:55:31,903 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-27 23:55:31,909 INFO core: _init_accounts coroutine started
2026-08-27 23:55:31,912 INFO core: _init_accounts_inner: starting DB migrations
2026-08-27 23:55:31,918 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:00:32,273 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 00:00:32,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:05:14,374 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:10:52,198 INFO core: Event loop thread started, running loop forever
2026-08-28 00:10:52,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 00:10:52,507 INFO core: _init_accounts coroutine started
2026-08-28 00:10:52,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 00:10:52,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:15:40,640 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:20:14,807 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 00:20:14,807 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 00:20:14,812 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:20:14,818 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 00:25:11,270 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:30:12,790 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:30:12,793 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 00:35:19,391 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 00:35:38,162 INFO core: Event loop thread started, running loop forever
2026-08-28 00:35:38,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 00:35:38,469 INFO core: _init_accounts coroutine started
2026-08-28 00:35:38,470 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 00:35:38,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:40:11,599 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 00:40:11,614 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:45:50,390 INFO core: Event loop thread started, running loop forever
2026-08-28 00:45:50,691 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 00:45:50,696 INFO core: _init_accounts coroutine started
2026-08-28 00:45:50,697 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 00:45:50,711 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 00:45:50,712 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 00:45:50,712 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:45:50,713 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 00:50:10,541 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 00:50:10,554 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 00:55:17,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 00:55:17,428 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 00:55:50,327 INFO core: Event loop thread started, running loop forever
2026-08-28 00:55:50,628 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 00:55:50,634 INFO core: _init_accounts coroutine started
2026-08-28 00:55:50,634 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 00:55:50,644 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:00:14,864 INFO core: Event loop thread started, running loop forever
2026-08-28 01:00:15,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 01:00:15,172 INFO core: _init_accounts coroutine started
2026-08-28 01:00:15,176 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 01:00:15,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:05:18,482 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:05:18,490 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 01:05:18,490 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 01:05:18,491 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 01:05:18,493 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 01:05:18,503 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 01:05:18,503 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 01:05:18,508 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 01:10:19,186 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 01:10:19,199 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:15:23,646 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 01:15:23,647 WARNING core: Account 2: connect timed out after 35s
2026-08-28 01:15:23,650 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 01:15:23,650 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 01:15:23,651 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 01:15:23,652 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 01:15:23,653 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 01:15:23,671 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:20:29,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 01:20:29,394 WARNING core: Account 2: connect timed out after 35s
2026-08-28 01:20:29,395 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-28 01:20:29,395 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-28 01:20:29,395 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 01:20:29,396 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-28 01:20:29,396 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-28 01:20:48,909 INFO core: Event loop thread started, running loop forever
2026-08-28 01:20:49,210 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 01:20:49,215 INFO core: _init_accounts coroutine started
2026-08-28 01:20:49,216 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 01:20:49,226 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:25:11,731 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 01:25:11,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:25:11,733 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 01:30:51,968 INFO core: Event loop thread started, running loop forever
2026-08-28 01:30:52,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 01:30:52,272 INFO core: _init_accounts coroutine started
2026-08-28 01:30:52,273 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 01:30:52,285 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:35:22,343 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:40:16,078 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 01:40:16,078 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 01:40:16,084 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 01:40:16,087 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:40:16,088 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 01:45:23,422 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 01:45:23,422 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 01:45:23,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 01:45:27,984 INFO core: Event loop thread started, running loop forever
2026-08-28 01:45:28,284 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 01:45:28,290 INFO core: _init_accounts coroutine started
2026-08-28 01:45:28,290 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 01:45:28,299 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:50:06,913 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 01:50:06,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 01:50:06,916 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 01:55:12,379 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 01:55:12,379 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-28 01:55:12,861 INFO core: Event loop thread started, running loop forever
2026-08-28 01:55:13,162 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 01:55:13,166 INFO core: _init_accounts coroutine started
2026-08-28 01:55:13,167 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 01:55:13,176 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:00:19,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 02:00:49,847 INFO core: Event loop thread started, running loop forever
2026-08-28 02:00:50,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 02:00:50,155 INFO core: _init_accounts coroutine started
2026-08-28 02:00:50,156 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 02:00:50,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:05:11,220 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 02:05:11,221 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 02:05:11,223 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 02:05:11,227 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:10:18,377 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 02:10:18,378 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 02:10:18,380 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 02:10:50,162 INFO core: Event loop thread started, running loop forever
2026-08-28 02:10:50,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 02:10:50,476 INFO core: _init_accounts coroutine started
2026-08-28 02:10:50,477 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 02:10:50,514 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 02:10:50,514 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 02:10:50,516 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 02:10:50,517 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 02:10:50,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:15:14,077 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:20:44,870 INFO core: Event loop thread started, running loop forever
2026-08-28 02:20:45,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 02:20:45,179 INFO core: _init_accounts coroutine started
2026-08-28 02:20:45,186 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 02:20:45,189 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:25:37,207 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:30:40,609 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 02:30:40,609 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 02:30:40,610 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:35:06,476 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 02:35:06,482 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 02:35:06,484 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:40:04,601 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:45:06,061 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 02:45:06,062 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 02:45:06,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:50:13,431 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 02:50:16,786 INFO core: Event loop thread started, running loop forever
2026-08-28 02:50:17,088 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 02:50:17,092 INFO core: _init_accounts coroutine started
2026-08-28 02:50:17,093 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 02:50:17,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 02:55:23,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 02:55:51,806 INFO core: Event loop thread started, running loop forever
2026-08-28 02:55:52,106 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 02:55:52,110 INFO core: _init_accounts coroutine started
2026-08-28 02:55:52,110 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 02:55:52,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:00:45,494 INFO core: Event loop thread started, running loop forever
2026-08-28 03:00:45,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 03:00:45,801 INFO core: _init_accounts coroutine started
2026-08-28 03:00:45,802 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 03:00:45,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:00:59,515 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 03:05:06,993 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 03:05:07,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:10:32,678 INFO core: Event loop thread started, running loop forever
2026-08-28 03:10:32,979 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 03:10:32,989 INFO core: _init_accounts coroutine started
2026-08-28 03:10:32,989 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 03:10:33,009 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 03:10:33,010 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 03:10:33,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:15:11,363 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 03:15:11,366 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-28 03:15:11,367 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 03:15:11,367 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 03:15:11,367 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 03:15:11,368 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 03:15:23,686 INFO core: Event loop thread started, running loop forever
2026-08-28 03:15:23,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 03:15:23,991 INFO core: _init_accounts coroutine started
2026-08-28 03:15:23,991 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 03:15:24,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:20:42,185 INFO core: Event loop thread started, running loop forever
2026-08-28 03:20:42,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 03:20:42,491 INFO core: _init_accounts coroutine started
2026-08-28 03:20:42,492 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 03:20:42,504 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 03:20:42,504 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 03:20:42,506 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:25:47,646 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 03:25:47,656 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:30:31,557 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 03:30:31,558 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:35:37,159 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:40:16,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:45:05,803 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 03:45:05,805 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 03:45:06,051 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 03:45:06,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:45:06,059 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 03:50:12,479 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 03:50:12,479 WARNING core: Account 2: connect timed out after 35s
2026-08-28 03:50:12,480 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 03:50:12,480 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 03:50:15,598 INFO core: Event loop thread started, running loop forever
2026-08-28 03:50:15,899 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 03:50:15,902 INFO core: _init_accounts coroutine started
2026-08-28 03:50:15,904 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 03:50:15,912 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 03:55:46,686 INFO core: Event loop thread started, running loop forever
2026-08-28 03:55:46,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 03:55:46,991 INFO core: _init_accounts coroutine started
2026-08-28 03:55:46,992 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 03:55:47,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:00:29,138 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 04:00:29,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:00:29,140 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 04:05:36,402 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 04:05:38,864 INFO core: Event loop thread started, running loop forever
2026-08-28 04:05:39,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 04:05:39,170 INFO core: _init_accounts coroutine started
2026-08-28 04:05:39,170 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 04:05:39,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:10:34,081 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 04:10:34,082 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 04:10:34,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:15:41,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 04:15:49,815 INFO core: Event loop thread started, running loop forever
2026-08-28 04:15:50,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 04:15:50,123 INFO core: _init_accounts coroutine started
2026-08-28 04:15:50,123 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 04:15:50,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:20:48,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:20:48,618 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 04:25:05,588 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 04:25:05,603 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 04:25:05,608 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 04:25:05,608 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:30:24,388 INFO core: Event loop thread started, running loop forever
2026-08-28 04:30:24,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 04:30:24,698 INFO core: _init_accounts coroutine started
2026-08-28 04:30:24,698 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 04:30:24,708 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:35:31,304 INFO core: Event loop thread started, running loop forever
2026-08-28 04:35:31,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 04:35:31,612 INFO core: _init_accounts coroutine started
2026-08-28 04:35:31,612 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 04:35:31,622 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:40:24,271 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 04:40:24,271 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 04:40:24,281 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:40:24,283 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 04:45:23,568 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 04:45:23,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:50:36,425 INFO core: Event loop thread started, running loop forever
2026-08-28 04:50:36,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 04:50:36,731 INFO core: _init_accounts coroutine started
2026-08-28 04:50:36,732 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 04:50:36,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 04:55:31,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:00:37,463 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 05:00:37,464 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 05:00:37,464 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-28 05:00:37,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 05:00:37,466 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-28 05:00:37,466 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 05:00:37,466 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 05:00:37,466 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 05:00:37,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 05:00:51,999 INFO core: Event loop thread started, running loop forever
2026-08-28 05:00:52,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 05:00:52,307 INFO core: _init_accounts coroutine started
2026-08-28 05:00:52,311 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 05:00:52,322 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:05:46,095 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:05:46,095 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 05:05:46,096 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 05:10:21,277 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 05:10:21,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:15:17,125 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 05:15:17,133 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:20:10,747 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:20:10,748 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 05:25:10,398 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 05:25:10,406 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 05:25:10,407 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 05:25:10,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:30:09,518 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 05:30:09,519 WARNING core: Account 2: connect timed out after 35s
2026-08-28 05:30:09,520 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 05:30:09,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 05:30:09,522 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 05:30:09,523 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 05:30:09,525 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 05:30:54,903 INFO core: Event loop thread started, running loop forever
2026-08-28 05:30:55,209 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 05:30:55,215 INFO core: _init_accounts coroutine started
2026-08-28 05:30:55,215 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 05:30:55,228 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:35:27,928 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 05:35:27,928 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 05:35:27,932 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 05:35:27,935 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 05:35:27,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:40:10,900 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 05:40:10,903 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 05:40:10,908 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 05:40:10,909 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 05:40:10,919 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:45:17,419 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 05:45:17,420 WARNING core: Account 2: connect timed out after 35s
2026-08-28 05:45:17,420 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 05:45:17,421 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 05:45:45,820 INFO core: Event loop thread started, running loop forever
2026-08-28 05:45:46,121 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 05:45:46,124 INFO core: _init_accounts coroutine started
2026-08-28 05:45:46,125 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 05:45:46,136 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:50:44,477 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 05:50:44,494 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 05:50:44,504 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 05:55:18,076 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 05:55:18,080 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:00:25,433 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 06:00:31,185 INFO core: Event loop thread started, running loop forever
2026-08-28 06:00:31,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 06:00:31,492 INFO core: _init_accounts coroutine started
2026-08-28 06:00:31,493 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 06:00:31,503 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:05:38,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 06:05:39,229 INFO core: Event loop thread started, running loop forever
2026-08-28 06:05:39,530 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 06:05:39,534 INFO core: _init_accounts coroutine started
2026-08-28 06:05:39,535 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 06:05:39,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:10:14,346 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 06:10:14,347 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 06:10:14,357 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 06:10:14,368 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 06:10:14,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:15:15,810 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:20:05,332 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 06:20:05,333 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 06:20:05,363 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 06:20:05,364 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 06:20:05,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:25:12,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 06:25:12,378 WARNING core: Account 2: connect timed out after 35s
2026-08-28 06:25:12,379 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 06:25:12,379 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 06:25:12,380 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 06:25:12,381 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 06:25:12,382 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 06:25:51,581 INFO core: Event loop thread started, running loop forever
2026-08-28 06:25:51,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 06:25:51,886 INFO core: _init_accounts coroutine started
2026-08-28 06:25:51,888 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 06:25:51,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:30:11,374 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 06:30:11,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:35:44,613 INFO core: Event loop thread started, running loop forever
2026-08-28 06:35:44,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 06:35:44,919 INFO core: _init_accounts coroutine started
2026-08-28 06:35:44,919 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 06:35:44,929 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 06:35:44,929 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 06:35:44,931 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 06:35:44,934 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 06:35:44,938 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:40:11,625 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:45:38,806 INFO core: Event loop thread started, running loop forever
2026-08-28 06:45:39,107 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 06:45:39,112 INFO core: _init_accounts coroutine started
2026-08-28 06:45:39,113 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 06:45:39,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:50:11,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 06:55:18,367 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 06:55:27,351 INFO core: Event loop thread started, running loop forever
2026-08-28 06:55:27,654 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 06:55:27,659 INFO core: _init_accounts coroutine started
2026-08-28 06:55:27,659 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 06:55:27,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:00:06,471 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 07:00:06,487 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:05:38,970 INFO core: Event loop thread started, running loop forever
2026-08-28 07:05:39,272 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 07:05:39,277 INFO core: _init_accounts coroutine started
2026-08-28 07:05:39,278 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 07:05:39,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:10:07,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:15:13,409 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-28 07:15:39,093 INFO core: Event loop thread started, running loop forever
2026-08-28 07:15:39,394 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 07:15:39,398 INFO core: _init_accounts coroutine started
2026-08-28 07:15:39,399 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 07:15:39,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:20:14,666 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:20:14,668 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 07:25:21,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 07:25:21,411 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-28 07:25:21,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 07:25:21,412 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-28 07:25:21,412 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 07:25:21,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 07:25:21,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 07:25:21,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 07:25:26,353 INFO core: Event loop thread started, running loop forever
2026-08-28 07:25:26,654 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 07:25:26,660 INFO core: _init_accounts coroutine started
2026-08-28 07:25:26,660 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 07:25:26,669 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:30:28,969 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:35:34,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 07:35:39,748 INFO core: Event loop thread started, running loop forever
2026-08-28 07:35:40,050 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 07:35:40,056 INFO core: _init_accounts coroutine started
2026-08-28 07:35:40,058 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 07:35:40,065 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:40:25,192 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:45:08,384 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 07:45:53,751 INFO core: Event loop thread started, running loop forever
2026-08-28 07:45:54,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 07:45:54,057 INFO core: _init_accounts coroutine started
2026-08-28 07:45:54,058 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 07:45:54,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:50:03,895 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 07:55:05,884 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 07:55:05,885 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 07:55:05,888 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 07:55:05,890 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:00:16,280 INFO core: Event loop thread started, running loop forever
2026-08-28 08:00:16,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 08:00:16,587 INFO core: _init_accounts coroutine started
2026-08-28 08:00:16,588 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 08:00:16,594 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:05:45,700 INFO core: Event loop thread started, running loop forever
2026-08-28 08:05:46,002 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 08:05:46,006 INFO core: _init_accounts coroutine started
2026-08-28 08:05:46,007 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 08:05:46,022 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:05:46,024 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 08:05:46,025 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 08:10:16,076 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:10:16,076 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 08:15:23,440 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 08:15:23,441 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 08:15:23,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 08:15:34,251 INFO core: Event loop thread started, running loop forever
2026-08-28 08:15:34,553 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 08:15:34,556 INFO core: _init_accounts coroutine started
2026-08-28 08:15:34,557 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 08:15:34,567 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:20:19,992 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 08:20:19,992 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 08:20:19,994 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 08:20:19,996 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 08:20:20,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:25:10,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:30:09,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:35:34,488 INFO core: Event loop thread started, running loop forever
2026-08-28 08:35:34,792 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 08:35:34,798 INFO core: _init_accounts coroutine started
2026-08-28 08:35:34,800 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 08:35:34,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:35:34,815 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 08:35:34,815 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 08:40:48,826 INFO core: Event loop thread started, running loop forever
2026-08-28 08:40:49,127 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 08:40:49,132 INFO core: _init_accounts coroutine started
2026-08-28 08:40:49,133 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 08:40:49,142 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:45:15,265 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 08:45:15,266 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 08:45:15,267 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 08:45:15,269 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 08:45:15,283 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 08:45:15,283 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 08:45:15,288 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 08:45:15,288 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 08:45:15,295 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:50:06,081 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 08:50:06,082 WARNING core: Account 2: connect timed out after 35s
2026-08-28 08:50:06,083 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 08:50:06,083 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 08:50:06,085 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 08:50:06,086 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 08:50:06,086 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 08:50:06,284 INFO telethon.network.mtprotosender: Connection to 91.108.56.181:443/TcpAbridged complete!
2026-08-28 08:50:06,317 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 08:55:13,338 WARNING core: Account 2: connect timed out after 35s
2026-08-28 08:55:40,720 INFO core: Event loop thread started, running loop forever
2026-08-28 08:55:41,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 08:55:41,032 INFO core: _init_accounts coroutine started
2026-08-28 08:55:41,033 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 08:55:41,040 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 08:55:41,041 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 08:55:41,042 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 08:55:41,043 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 08:55:41,055 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:00:25,215 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:05:51,201 INFO core: Event loop thread started, running loop forever
2026-08-28 09:05:51,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 09:05:51,507 INFO core: _init_accounts coroutine started
2026-08-28 09:05:51,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 09:05:51,517 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:10:25,178 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:15:46,183 INFO core: Event loop thread started, running loop forever
2026-08-28 09:15:46,484 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 09:15:46,490 INFO core: _init_accounts coroutine started
2026-08-28 09:15:46,491 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 09:15:46,504 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:20:40,804 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 09:20:40,805 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 09:20:40,810 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 09:20:40,811 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 09:20:40,827 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 09:20:40,827 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 09:20:40,831 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 09:20:40,832 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 09:20:40,836 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:25:23,398 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 09:25:23,399 WARNING core: Account 2: connect timed out after 35s
2026-08-28 09:25:23,400 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 09:25:23,400 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 09:25:23,401 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 09:25:23,402 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 09:25:23,402 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 09:25:23,405 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:30:30,364 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 09:30:30,365 WARNING core: Account 2: connect timed out after 35s
2026-08-28 09:30:30,365 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-28 09:30:30,365 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-28 09:30:30,366 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 09:30:30,367 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-28 09:30:30,367 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-28 09:30:38,887 INFO core: Event loop thread started, running loop forever
2026-08-28 09:30:39,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 09:30:39,198 INFO core: _init_accounts coroutine started
2026-08-28 09:30:39,198 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 09:30:39,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:35:24,157 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 09:35:24,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:40:40,743 INFO core: Event loop thread started, running loop forever
2026-08-28 09:40:41,044 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 09:40:41,048 INFO core: _init_accounts coroutine started
2026-08-28 09:40:41,049 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 09:40:41,057 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:45:39,547 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:50:46,563 INFO core: Event loop thread started, running loop forever
2026-08-28 09:50:46,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 09:50:46,869 INFO core: _init_accounts coroutine started
2026-08-28 09:50:46,869 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 09:50:46,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 09:55:05,516 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 09:55:05,516 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 09:55:05,517 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:00:08,334 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 10:00:08,335 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-28 10:00:08,336 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 10:00:08,336 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 10:00:08,336 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 10:00:08,336 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 10:00:29,414 INFO core: Event loop thread started, running loop forever
2026-08-28 10:00:29,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 10:00:29,722 INFO core: _init_accounts coroutine started
2026-08-28 10:00:29,722 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 10:00:29,723 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:05:07,975 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 10:05:07,976 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 10:05:07,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:10:30,246 INFO core: Event loop thread started, running loop forever
2026-08-28 10:10:30,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 10:10:30,552 INFO core: _init_accounts coroutine started
2026-08-28 10:10:30,553 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 10:10:30,566 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:15:41,593 INFO core: Event loop thread started, running loop forever
2026-08-28 10:15:41,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 10:15:41,899 INFO core: _init_accounts coroutine started
2026-08-28 10:15:41,901 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 10:15:41,911 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:20:28,597 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:25:04,261 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 10:25:04,261 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 10:25:04,265 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 10:25:04,267 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:30:11,475 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 10:30:11,476 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 10:30:11,477 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 10:30:11,477 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 10:30:20,388 INFO core: Event loop thread started, running loop forever
2026-08-28 10:30:20,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 10:30:20,709 INFO core: _init_accounts coroutine started
2026-08-28 10:30:20,709 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 10:30:20,715 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:35:27,472 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-28 10:35:53,387 INFO core: Event loop thread started, running loop forever
2026-08-28 10:35:53,688 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 10:35:53,698 INFO core: _init_accounts coroutine started
2026-08-28 10:35:53,698 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 10:35:53,706 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:40:20,222 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 10:40:20,222 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 10:40:20,224 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 10:40:20,226 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 10:40:20,232 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:45:26,398 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 10:45:32,355 INFO core: Event loop thread started, running loop forever
2026-08-28 10:45:32,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 10:45:32,662 INFO core: _init_accounts coroutine started
2026-08-28 10:45:32,662 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 10:45:32,673 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:50:28,025 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 10:50:28,026 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 10:50:28,029 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 10:50:28,031 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 10:50:28,035 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 10:55:06,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:00:25,957 INFO core: Event loop thread started, running loop forever
2026-08-28 11:00:26,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 11:00:26,265 INFO core: _init_accounts coroutine started
2026-08-28 11:00:26,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 11:00:26,276 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:05:10,657 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 11:05:10,657 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 11:05:10,662 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 11:05:10,664 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:05:10,665 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 11:10:38,254 INFO core: Event loop thread started, running loop forever
2026-08-28 11:10:38,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 11:10:38,561 INFO core: _init_accounts coroutine started
2026-08-28 11:10:38,561 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 11:10:38,569 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 11:10:38,569 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 11:10:38,570 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 11:10:38,571 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 11:10:38,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:10:38,586 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 11:10:38,589 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 11:15:12,074 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 11:15:12,076 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 11:15:12,081 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:20:51,826 INFO core: Event loop thread started, running loop forever
2026-08-28 11:20:52,138 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 11:20:52,145 INFO core: _init_accounts coroutine started
2026-08-28 11:20:52,145 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 11:20:52,154 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:25:37,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:30:36,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:35:37,114 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 11:35:37,115 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 11:35:37,120 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 11:35:37,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:35:37,123 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 11:40:06,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:45:13,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 11:45:13,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 11:45:13,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 11:45:20,225 INFO core: Event loop thread started, running loop forever
2026-08-28 11:45:20,527 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 11:45:20,533 INFO core: _init_accounts coroutine started
2026-08-28 11:45:20,534 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 11:45:20,548 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 11:45:20,548 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 11:45:20,549 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:45:20,550 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 11:45:20,558 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 11:50:36,643 INFO core: Event loop thread started, running loop forever
2026-08-28 11:50:36,944 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 11:50:36,949 INFO core: _init_accounts coroutine started
2026-08-28 11:50:36,949 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 11:50:36,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 11:55:21,091 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 11:55:21,094 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 11:55:21,104 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 11:55:21,113 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 11:55:21,116 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:00:22,202 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 12:00:22,203 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 12:00:22,208 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 12:00:22,209 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 12:00:22,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:05:26,999 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 12:05:27,000 WARNING core: Account 2: connect timed out after 35s
2026-08-28 12:05:27,001 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 12:05:27,007 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 12:05:27,009 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 12:05:27,011 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 12:05:27,012 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 12:05:27,016 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:10:33,509 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 12:10:33,510 WARNING core: Account 2: connect timed out after 35s
2026-08-28 12:10:33,510 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-28 12:10:33,511 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-28 12:10:33,511 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 12:10:33,512 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-28 12:10:33,512 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-28 12:10:49,236 INFO core: Event loop thread started, running loop forever
2026-08-28 12:10:49,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 12:10:49,543 INFO core: _init_accounts coroutine started
2026-08-28 12:10:49,544 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 12:10:49,552 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:15:11,362 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 12:15:42,832 INFO core: Event loop thread started, running loop forever
2026-08-28 12:15:43,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 12:15:43,138 INFO core: _init_accounts coroutine started
2026-08-28 12:15:43,138 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 12:15:43,142 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:20:31,870 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 12:20:31,870 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 12:20:31,872 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 12:20:31,874 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 12:20:31,898 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:25:17,026 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 12:25:17,027 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 12:25:17,033 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:25:17,038 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 12:25:17,039 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 12:30:31,520 INFO core: Event loop thread started, running loop forever
2026-08-28 12:30:31,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 12:30:31,827 INFO core: _init_accounts coroutine started
2026-08-28 12:30:31,828 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 12:30:31,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:35:13,145 INFO core: Event loop thread started, running loop forever
2026-08-28 12:35:13,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 12:35:13,449 INFO core: _init_accounts coroutine started
2026-08-28 12:35:13,452 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 12:35:13,466 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:40:19,449 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 12:40:26,779 INFO core: Event loop thread started, running loop forever
2026-08-28 12:40:27,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 12:40:27,089 INFO core: _init_accounts coroutine started
2026-08-28 12:40:27,089 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 12:40:27,096 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:45:33,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 12:45:43,374 INFO core: Event loop thread started, running loop forever
2026-08-28 12:45:43,675 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 12:45:43,680 INFO core: _init_accounts coroutine started
2026-08-28 12:45:43,682 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 12:45:43,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:50:10,283 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 12:50:10,284 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 12:50:10,287 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 12:50:10,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 12:55:17,457 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 12:55:17,458 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 12:55:17,459 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 12:55:17,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 12:55:20,694 INFO core: Event loop thread started, running loop forever
2026-08-28 12:55:20,996 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 12:55:21,001 INFO core: _init_accounts coroutine started
2026-08-28 12:55:21,002 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 12:55:21,021 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:00:23,292 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 13:00:23,293 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 13:00:23,295 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:00:23,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 13:05:06,701 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 13:05:06,702 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:10:12,463 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 13:10:51,853 INFO core: Event loop thread started, running loop forever
2026-08-28 13:10:52,154 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 13:10:52,158 INFO core: _init_accounts coroutine started
2026-08-28 13:10:52,159 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 13:10:52,170 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:15:07,685 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:20:14,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 13:20:52,419 INFO core: Event loop thread started, running loop forever
2026-08-28 13:20:52,720 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 13:20:52,728 INFO core: _init_accounts coroutine started
2026-08-28 13:20:52,728 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 13:20:52,743 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 13:20:52,743 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 13:20:52,745 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 13:20:52,747 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 13:20:52,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:25:19,381 INFO core: Event loop thread started, running loop forever
2026-08-28 13:25:19,682 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 13:25:19,687 INFO core: _init_accounts coroutine started
2026-08-28 13:25:19,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 13:25:19,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:25:59,475 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 13:25:59,476 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 13:25:59,476 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 13:30:15,968 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-28 13:30:15,985 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-28 13:35:46,316 INFO core: Event loop thread started, running loop forever
2026-08-28 13:35:46,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 13:35:46,622 INFO core: _init_accounts coroutine started
2026-08-28 13:35:46,623 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 13:35:46,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:40:06,203 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 13:40:06,204 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 13:40:06,456 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:45:11,094 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 13:45:11,116 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:50:42,860 INFO core: Event loop thread started, running loop forever
2026-08-28 13:50:43,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 13:50:43,168 INFO core: _init_accounts coroutine started
2026-08-28 13:50:43,168 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 13:50:43,181 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 13:50:43,181 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 13:50:43,182 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 13:50:43,184 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 13:50:43,188 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 13:55:29,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:00:16,778 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:05:09,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:10:51,940 INFO core: Event loop thread started, running loop forever
2026-08-28 14:10:52,241 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 14:10:52,247 INFO core: _init_accounts coroutine started
2026-08-28 14:10:52,247 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 14:10:52,257 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:15:23,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:20:27,173 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 14:20:27,184 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:25:05,917 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:30:48,385 INFO core: Event loop thread started, running loop forever
2026-08-28 14:30:48,686 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 14:30:48,695 INFO core: _init_accounts coroutine started
2026-08-28 14:30:48,696 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 14:30:48,710 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:35:06,820 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 14:35:06,856 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:40:48,666 INFO core: Event loop thread started, running loop forever
2026-08-28 14:40:48,968 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 14:40:48,972 INFO core: _init_accounts coroutine started
2026-08-28 14:40:48,973 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 14:40:48,983 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:45:50,727 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 14:45:50,728 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 14:45:50,730 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 14:45:50,731 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 14:45:50,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:50:25,069 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 14:55:32,433 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 14:55:34,703 INFO core: Event loop thread started, running loop forever
2026-08-28 14:55:35,004 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 14:55:35,008 INFO core: _init_accounts coroutine started
2026-08-28 14:55:35,010 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 14:55:35,025 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:00:27,934 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:05:51,288 INFO core: Event loop thread started, running loop forever
2026-08-28 15:05:51,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 15:05:51,595 INFO core: _init_accounts coroutine started
2026-08-28 15:05:51,596 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 15:05:51,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:10:27,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:15:24,800 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 15:15:24,801 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 15:15:24,803 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 15:15:24,806 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 15:15:24,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:20:21,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:25:28,484 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 15:25:40,699 INFO core: Event loop thread started, running loop forever
2026-08-28 15:25:41,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 15:25:41,005 INFO core: _init_accounts coroutine started
2026-08-28 15:25:41,008 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 15:25:41,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:30:53,204 INFO core: Event loop thread started, running loop forever
2026-08-28 15:30:53,506 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 15:30:53,513 INFO core: _init_accounts coroutine started
2026-08-28 15:30:53,513 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 15:30:53,521 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:35:37,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:40:33,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 15:40:33,573 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 15:40:33,579 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 15:40:33,583 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 15:40:33,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:45:39,519 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 15:45:40,217 INFO core: Event loop thread started, running loop forever
2026-08-28 15:45:40,518 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 15:45:40,526 INFO core: _init_accounts coroutine started
2026-08-28 15:45:40,528 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 15:45:40,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:45:40,541 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 15:45:40,542 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 15:50:46,320 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 15:50:46,333 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 15:50:46,346 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 15:55:08,147 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:00:15,431 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 16:00:46,193 INFO core: Event loop thread started, running loop forever
2026-08-28 16:00:46,494 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 16:00:46,502 INFO core: _init_accounts coroutine started
2026-08-28 16:00:46,502 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 16:00:46,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:05:36,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:05:36,816 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 16:05:36,817 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 16:10:13,532 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 16:10:13,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:15:12,622 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 16:15:12,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:20:18,375 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 16:20:18,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 16:20:52,081 INFO core: Event loop thread started, running loop forever
2026-08-28 16:20:52,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 16:20:52,389 INFO core: _init_accounts coroutine started
2026-08-28 16:20:52,390 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 16:20:52,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:25:39,911 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 16:25:39,912 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 16:25:39,914 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 16:25:39,915 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 16:25:39,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:30:15,845 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 16:30:15,846 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 16:30:15,856 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 16:30:15,857 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 16:30:15,862 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:35:21,450 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 16:35:21,451 WARNING core: Account 2: connect timed out after 35s
2026-08-28 16:35:21,452 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 16:35:25,355 INFO core: Event loop thread started, running loop forever
2026-08-28 16:35:25,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 16:35:25,662 INFO core: _init_accounts coroutine started
2026-08-28 16:35:25,663 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 16:35:25,670 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:40:04,542 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:45:47,328 INFO core: Event loop thread started, running loop forever
2026-08-28 16:45:47,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 16:45:47,639 INFO core: _init_accounts coroutine started
2026-08-28 16:45:47,639 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 16:45:47,646 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:50:10,195 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 16:55:17,746 INFO core: Event loop thread started, running loop forever
2026-08-28 16:55:18,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 16:55:18,056 INFO core: _init_accounts coroutine started
2026-08-28 16:55:18,056 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 16:55:18,061 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:00:14,778 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 17:00:14,845 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:05:15,783 INFO core: Event loop thread started, running loop forever
2026-08-28 17:05:16,088 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 17:05:16,100 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:10:45,464 INFO core: Event loop thread started, running loop forever
2026-08-28 17:10:45,765 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 17:10:45,770 INFO core: _init_accounts coroutine started
2026-08-28 17:10:45,771 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 17:10:45,785 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 17:10:45,785 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 17:10:45,786 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 17:10:45,787 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 17:10:45,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:15:18,792 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:20:37,423 INFO core: Event loop thread started, running loop forever
2026-08-28 17:20:37,724 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 17:20:37,729 INFO core: _init_accounts coroutine started
2026-08-28 17:20:37,731 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 17:20:37,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:25:42,980 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 17:25:42,986 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:30:09,798 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:35:49,646 INFO core: Event loop thread started, running loop forever
2026-08-28 17:35:49,951 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 17:35:49,957 INFO core: _init_accounts coroutine started
2026-08-28 17:35:49,957 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 17:35:49,970 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:40:30,074 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 17:40:30,075 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 17:40:30,086 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 17:40:30,088 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 17:40:30,101 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 17:40:30,101 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 17:40:30,108 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 17:40:30,109 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 17:40:30,121 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:45:22,507 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 17:45:22,507 WARNING core: Account 2: connect timed out after 35s
2026-08-28 17:45:22,508 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 17:45:22,509 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 17:45:22,509 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 17:45:22,510 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 17:45:22,510 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 17:45:22,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:50:29,404 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 17:50:29,409 WARNING core: Account 2: connect timed out after 35s
2026-08-28 17:50:33,246 INFO core: Event loop thread started, running loop forever
2026-08-28 17:50:33,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 17:50:33,554 INFO core: _init_accounts coroutine started
2026-08-28 17:50:33,554 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 17:50:33,586 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 17:55:40,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 17:55:51,511 INFO core: Event loop thread started, running loop forever
2026-08-28 17:55:51,812 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 17:55:51,816 INFO core: _init_accounts coroutine started
2026-08-28 17:55:51,817 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 17:55:51,827 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:00:46,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:05:34,281 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 18:05:34,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:10:22,493 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:15:45,431 INFO core: Event loop thread started, running loop forever
2026-08-28 18:15:45,732 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 18:15:45,738 INFO core: _init_accounts coroutine started
2026-08-28 18:15:45,739 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 18:15:45,753 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:20:43,603 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 18:20:43,603 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 18:20:43,607 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 18:20:43,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:25:15,144 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 18:25:15,163 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:25:15,169 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 18:25:15,169 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 18:30:17,736 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 18:30:17,737 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 18:30:17,768 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:35:23,416 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 18:35:23,417 WARNING core: Account 2: connect timed out after 35s
2026-08-28 18:35:23,418 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 18:35:23,418 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 18:35:23,419 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 18:35:23,421 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 18:35:23,421 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 18:35:48,173 INFO core: Event loop thread started, running loop forever
2026-08-28 18:35:48,474 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 18:35:48,478 INFO core: _init_accounts coroutine started
2026-08-28 18:35:48,480 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 18:35:48,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:40:09,547 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:45:16,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 18:45:51,798 INFO core: Event loop thread started, running loop forever
2026-08-28 18:45:52,099 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 18:45:52,105 INFO core: _init_accounts coroutine started
2026-08-28 18:45:52,106 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 18:45:52,114 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:50:41,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 18:50:41,479 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 18:50:41,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 18:50:41,483 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 18:55:30,607 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 18:55:30,612 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:00:28,819 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 19:00:28,822 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 19:00:28,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:05:24,467 INFO core: Event loop thread started, running loop forever
2026-08-28 19:05:24,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 19:05:24,778 INFO core: _init_accounts coroutine started
2026-08-28 19:05:24,779 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 19:05:24,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:05:35,475 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 19:10:15,376 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 19:10:15,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 19:10:15,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:10:15,381 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 19:15:22,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 19:15:30,795 INFO core: Event loop thread started, running loop forever
2026-08-28 19:15:31,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 19:15:31,103 INFO core: _init_accounts coroutine started
2026-08-28 19:15:31,104 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 19:15:31,112 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:20:43,999 INFO core: Event loop thread started, running loop forever
2026-08-28 19:20:44,300 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 19:20:44,304 INFO core: _init_accounts coroutine started
2026-08-28 19:20:44,305 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 19:20:44,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:25:43,469 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-28 19:25:43,499 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:30:36,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:35:06,387 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-28 19:35:06,389 INFO core: _init_accounts coroutine started
2026-08-28 19:35:06,389 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 19:35:06,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 19:35:06,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 19:35:06,396 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:40:13,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 19:40:13,405 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-28 19:40:13,406 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 19:40:13,406 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-28 19:40:13,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 19:40:13,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 19:40:13,818 INFO core: Event loop thread started, running loop forever
2026-08-28 19:40:14,123 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 19:40:14,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:45:21,390 INFO core: _init_accounts coroutine started
2026-08-28 19:45:21,391 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 19:45:21,391 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-28 19:45:32,893 INFO core: Event loop thread started, running loop forever
2026-08-28 19:45:33,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 19:45:33,197 INFO core: _init_accounts coroutine started
2026-08-28 19:45:33,198 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 19:45:33,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:50:05,018 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 19:55:12,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 19:55:37,884 INFO core: Event loop thread started, running loop forever
2026-08-28 19:55:38,185 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 19:55:38,189 INFO core: _init_accounts coroutine started
2026-08-28 19:55:38,189 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 19:55:38,199 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 19:55:38,199 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 19:55:38,203 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 19:55:38,204 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 19:55:38,217 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 19:55:38,217 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 19:55:38,222 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:00:20,459 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 20:00:20,461 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 20:00:20,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:05:27,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 20:05:27,379 WARNING core: Account 2: connect timed out after 35s
2026-08-28 20:05:27,380 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 20:05:27,380 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 20:05:27,381 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 20:05:27,382 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 20:05:27,383 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 20:05:41,886 INFO core: Event loop thread started, running loop forever
2026-08-28 20:05:42,191 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 20:05:42,195 INFO core: _init_accounts coroutine started
2026-08-28 20:05:42,195 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 20:05:42,203 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:10:24,654 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 20:10:24,654 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 20:10:24,656 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 20:10:24,657 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 20:10:24,675 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:15:31,285 INFO core: Event loop thread started, running loop forever
2026-08-28 20:15:31,287 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 20:15:31,287 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 20:15:31,287 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-28 20:15:31,587 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 20:15:31,591 INFO core: _init_accounts coroutine started
2026-08-28 20:15:31,592 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 20:15:31,602 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:20:47,444 INFO core: Event loop thread started, running loop forever
2026-08-28 20:20:47,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 20:20:47,753 INFO core: _init_accounts coroutine started
2026-08-28 20:20:47,753 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 20:20:47,769 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:25:07,115 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 20:25:07,116 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 20:25:07,121 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 20:25:07,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:30:13,858 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 20:30:18,964 INFO core: Event loop thread started, running loop forever
2026-08-28 20:30:19,265 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 20:30:19,270 INFO core: _init_accounts coroutine started
2026-08-28 20:30:19,271 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 20:30:19,306 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:35:05,710 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 20:35:05,711 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 20:35:05,713 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 20:35:05,717 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 20:35:05,738 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:40:06,180 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:45:07,792 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 20:45:07,793 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 20:45:07,802 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-28 20:45:07,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:45:07,804 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-28 20:50:14,404 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-28 20:50:14,405 WARNING core: Account 2: connect timed out after 35s
2026-08-28 20:50:14,406 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-28 20:50:14,406 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-28 20:50:14,407 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-28 20:50:14,409 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-28 20:50:14,409 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-28 20:50:35,296 INFO core: Event loop thread started, running loop forever
2026-08-28 20:50:35,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 20:50:35,604 INFO core: _init_accounts coroutine started
2026-08-28 20:50:35,605 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 20:50:35,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 20:55:18,369 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:00:11,546 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:05:49,780 INFO core: Event loop thread started, running loop forever
2026-08-28 21:05:50,083 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 21:05:50,094 INFO core: _init_accounts coroutine started
2026-08-28 21:05:50,095 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 21:05:50,095 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:10:45,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:15:49,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:20:19,286 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 21:20:19,286 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 21:20:19,288 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 21:20:19,290 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 21:20:19,291 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:25:16,688 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:30:53,367 INFO core: Event loop thread started, running loop forever
2026-08-28 21:30:53,668 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 21:30:53,673 INFO core: _init_accounts coroutine started
2026-08-28 21:30:53,674 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 21:30:53,686 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:35:13,305 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 21:35:13,305 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 21:35:13,310 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:40:20,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 21:40:32,863 INFO core: Event loop thread started, running loop forever
2026-08-28 21:40:33,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 21:40:33,171 INFO core: _init_accounts coroutine started
2026-08-28 21:40:33,171 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 21:40:33,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:45:22,033 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 21:45:22,033 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 21:45:22,035 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:45:22,036 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 21:50:23,299 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 21:50:23,310 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 21:55:30,393 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 21:55:30,394 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 21:55:30,395 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-28 21:55:48,411 INFO core: Event loop thread started, running loop forever
2026-08-28 21:55:48,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 21:55:48,718 INFO core: _init_accounts coroutine started
2026-08-28 21:55:48,719 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 21:55:48,729 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:00:06,108 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:05:20,046 INFO core: Event loop thread started, running loop forever
2026-08-28 22:05:20,347 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 22:05:20,352 INFO core: _init_accounts coroutine started
2026-08-28 22:05:20,353 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 22:05:20,367 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:10:49,790 INFO core: Event loop thread started, running loop forever
2026-08-28 22:10:50,091 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 22:10:50,096 INFO core: _init_accounts coroutine started
2026-08-28 22:10:50,097 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 22:10:50,107 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:15:44,997 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 22:15:44,997 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 22:15:45,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:15:45,001 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 22:20:33,714 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 22:20:33,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:25:33,402 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:30:26,742 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:35:32,414 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 22:35:32,415 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 22:35:34,488 INFO core: Event loop thread started, running loop forever
2026-08-28 22:35:34,789 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 22:35:34,795 INFO core: _init_accounts coroutine started
2026-08-28 22:35:34,797 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 22:35:34,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:40:29,819 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:45:08,374 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 22:45:08,378 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 22:45:08,378 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-28 22:45:08,379 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 22:45:08,379 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-28 22:45:08,381 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 22:45:52,955 INFO core: Event loop thread started, running loop forever
2026-08-28 22:45:53,256 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 22:45:53,261 INFO core: _init_accounts coroutine started
2026-08-28 22:45:53,261 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 22:45:53,267 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:50:48,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 22:55:17,513 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 22:55:17,514 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 22:55:17,516 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 22:55:17,519 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 22:55:17,526 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:00:07,245 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-28 23:00:07,246 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:00:07,250 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-28 23:05:25,198 INFO core: Event loop thread started, running loop forever
2026-08-28 23:05:25,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 23:05:25,510 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:10:30,334 INFO core: _init_accounts coroutine started
2026-08-28 23:10:30,335 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 23:10:30,371 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:15:46,954 INFO core: Event loop thread started, running loop forever
2026-08-28 23:15:47,256 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 23:15:47,263 INFO core: _init_accounts coroutine started
2026-08-28 23:15:47,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 23:15:47,271 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:20:46,454 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:25:38,778 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 23:25:38,778 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 23:25:38,786 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 23:25:38,789 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 23:25:38,797 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:30:23,953 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:35:48,907 INFO core: Event loop thread started, running loop forever
2026-08-28 23:35:49,209 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 23:35:49,217 INFO core: _init_accounts coroutine started
2026-08-28 23:35:49,218 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 23:35:49,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:40:05,360 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 23:40:05,361 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 23:40:05,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-28 23:40:05,364 INFO core: _init_accounts_inner: reloading LLM config
2026-08-28 23:40:05,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:45:33,896 INFO core: Event loop thread started, running loop forever
2026-08-28 23:45:34,197 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-28 23:45:34,202 INFO core: _init_accounts coroutine started
2026-08-28 23:45:34,202 INFO core: _init_accounts_inner: starting DB migrations
2026-08-28 23:45:34,211 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:50:12,946 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:55:06,684 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-28 23:55:06,684 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-28 23:55:06,694 INFO core: status() clients=0 connected=False forwarding=False
2026-08-28 23:55:06,695 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 00:00:12,435 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 00:00:12,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 00:00:12,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 00:00:12,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 00:00:26,340 INFO core: Event loop thread started, running loop forever
2026-08-29 00:00:26,642 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 00:00:26,647 INFO core: _init_accounts coroutine started
2026-08-29 00:00:26,648 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 00:00:26,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:05:07,091 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 00:05:07,091 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 00:05:07,096 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 00:05:07,097 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:10:45,963 INFO core: Event loop thread started, running loop forever
2026-08-29 00:10:46,265 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 00:10:46,269 INFO core: _init_accounts coroutine started
2026-08-29 00:10:46,271 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 00:10:46,282 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:15:30,707 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 00:15:30,707 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 00:15:30,712 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 00:15:30,714 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 00:15:30,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:20:28,975 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:25:35,530 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 00:25:35,531 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 00:25:35,531 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 00:25:37,118 INFO core: Event loop thread started, running loop forever
2026-08-29 00:25:37,419 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 00:25:37,424 INFO core: _init_accounts coroutine started
2026-08-29 00:25:37,425 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 00:25:37,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:30:47,145 INFO core: Event loop thread started, running loop forever
2026-08-29 00:30:47,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 00:30:47,451 INFO core: _init_accounts coroutine started
2026-08-29 00:30:47,453 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 00:30:47,465 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:35:17,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:40:53,999 INFO core: Event loop thread started, running loop forever
2026-08-29 00:40:54,301 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 00:40:54,307 INFO core: _init_accounts coroutine started
2026-08-29 00:40:54,308 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 00:40:54,331 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:45:52,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:50:26,547 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 00:50:26,547 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 00:50:26,551 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 00:50:26,553 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 00:50:26,560 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:55:32,429 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 00:55:32,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 00:55:32,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 00:55:51,448 INFO core: Event loop thread started, running loop forever
2026-08-29 00:55:51,749 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 00:55:51,764 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 00:55:51,765 INFO core: _init_accounts coroutine started
2026-08-29 00:55:51,767 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 01:00:12,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 01:00:34,998 INFO core: Event loop thread started, running loop forever
2026-08-29 01:00:35,300 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 01:00:35,304 INFO core: _init_accounts coroutine started
2026-08-29 01:00:35,305 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 01:00:35,312 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:05:06,455 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 01:05:06,479 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:10:36,710 INFO core: Event loop thread started, running loop forever
2026-08-29 01:10:37,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 01:10:37,017 INFO core: _init_accounts coroutine started
2026-08-29 01:10:37,018 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 01:10:37,034 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 01:10:37,034 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 01:10:37,039 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 01:10:37,051 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:15:09,725 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 01:15:09,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:20:16,494 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 01:20:16,497 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 01:20:16,497 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-29 01:20:40,322 INFO core: Event loop thread started, running loop forever
2026-08-29 01:20:40,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 01:20:40,628 INFO core: _init_accounts coroutine started
2026-08-29 01:20:40,629 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 01:20:40,636 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:25:05,732 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:30:10,035 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 01:30:10,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 01:30:10,039 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 01:30:10,064 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 01:30:10,098 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:35:39,892 INFO core: Event loop thread started, running loop forever
2026-08-29 01:35:40,193 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 01:35:40,199 INFO core: _init_accounts coroutine started
2026-08-29 01:35:40,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 01:35:40,208 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:40:37,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:45:44,496 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 01:45:46,143 INFO core: Event loop thread started, running loop forever
2026-08-29 01:45:46,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 01:45:46,449 INFO core: _init_accounts coroutine started
2026-08-29 01:45:46,450 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 01:45:46,474 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:50:25,125 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 01:50:25,126 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 01:50:25,130 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 01:50:25,132 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 01:50:25,137 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 01:55:32,561 INFO core: Event loop thread started, running loop forever
2026-08-29 01:55:32,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 01:55:32,866 INFO core: _init_accounts coroutine started
2026-08-29 01:55:32,866 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 01:55:32,887 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-08-29 01:55:32,888 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-29 02:00:35,578 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:05:38,070 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-29 02:05:38,071 INFO core: _init_accounts coroutine started
2026-08-29 02:05:38,071 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 02:05:38,087 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 02:05:38,087 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 02:05:38,089 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 02:05:38,091 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 02:05:38,105 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 02:05:38,105 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 02:05:38,110 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 02:05:38,110 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 02:05:38,126 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:10:45,484 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 02:10:45,485 WARNING core: Account 2: connect timed out after 35s
2026-08-29 02:10:45,486 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-29 02:10:51,345 INFO core: Event loop thread started, running loop forever
2026-08-29 02:10:51,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 02:10:51,652 INFO core: _init_accounts coroutine started
2026-08-29 02:10:51,652 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 02:10:51,667 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:15:52,307 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 02:15:52,309 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 02:15:52,313 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:20:50,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:25:17,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 02:25:17,415 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 02:25:17,423 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:30:44,535 INFO core: Event loop thread started, running loop forever
2026-08-29 02:30:44,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 02:30:44,841 INFO core: _init_accounts coroutine started
2026-08-29 02:30:44,841 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 02:30:44,857 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 02:30:44,857 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 02:30:44,859 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 02:30:44,862 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 02:30:44,875 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:35:18,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:35:18,459 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 02:40:05,082 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 02:40:05,092 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:40:05,098 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 02:45:11,402 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 02:45:48,913 INFO core: Event loop thread started, running loop forever
2026-08-29 02:45:49,214 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 02:45:49,223 INFO core: _init_accounts coroutine started
2026-08-29 02:45:49,224 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 02:45:49,232 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:50:47,461 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 02:50:47,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 02:55:14,728 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:00:52,735 INFO core: Event loop thread started, running loop forever
2026-08-29 03:00:53,037 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 03:00:53,043 INFO core: _init_accounts coroutine started
2026-08-29 03:00:53,044 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 03:00:53,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:05:51,271 INFO core: Event loop thread started, running loop forever
2026-08-29 03:05:51,572 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 03:05:51,581 INFO core: _init_accounts coroutine started
2026-08-29 03:05:51,581 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 03:05:51,613 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:06:00,302 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 03:10:48,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:15:11,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 03:15:42,768 INFO core: Event loop thread started, running loop forever
2026-08-29 03:15:43,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 03:15:43,079 INFO core: _init_accounts coroutine started
2026-08-29 03:15:43,079 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 03:15:43,083 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:20:19,693 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:25:08,201 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 03:25:08,204 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 03:25:08,230 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 03:25:08,234 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 03:25:08,245 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:30:15,462 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 03:30:52,587 INFO core: Event loop thread started, running loop forever
2026-08-29 03:30:52,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 03:30:52,894 INFO core: _init_accounts coroutine started
2026-08-29 03:30:52,894 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 03:30:52,904 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:35:07,427 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:35:07,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 03:35:07,429 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 03:40:12,648 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:45:25,260 INFO core: Event loop thread started, running loop forever
2026-08-29 03:45:25,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 03:45:25,566 INFO core: _init_accounts coroutine started
2026-08-29 03:45:25,567 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 03:45:25,576 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:50:32,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 03:50:54,216 INFO core: Event loop thread started, running loop forever
2026-08-29 03:50:54,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 03:50:54,522 INFO core: _init_accounts coroutine started
2026-08-29 03:50:54,527 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 03:50:54,528 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 03:55:31,143 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:00:12,399 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 04:00:12,421 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:05:40,514 INFO core: Event loop thread started, running loop forever
2026-08-29 04:05:40,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 04:05:40,820 INFO core: _init_accounts coroutine started
2026-08-29 04:05:40,822 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 04:05:40,833 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:10:14,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:15:21,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 04:15:44,684 INFO core: Event loop thread started, running loop forever
2026-08-29 04:15:44,986 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 04:15:44,991 INFO core: _init_accounts coroutine started
2026-08-29 04:15:44,992 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 04:15:45,002 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:20:45,424 INFO core: Event loop thread started, running loop forever
2026-08-29 04:20:45,728 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 04:20:45,732 INFO core: _init_accounts coroutine started
2026-08-29 04:20:45,733 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 04:20:45,748 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:20:52,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 04:25:06,672 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 04:25:06,674 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 04:25:06,678 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 04:25:06,685 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 04:25:06,708 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:30:13,459 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 04:30:13,460 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 04:30:13,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 04:30:55,436 INFO core: Event loop thread started, running loop forever
2026-08-29 04:30:55,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 04:30:55,740 INFO core: _init_accounts coroutine started
2026-08-29 04:30:55,740 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 04:30:55,754 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:35:29,049 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 04:35:29,074 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:40:22,906 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:45:28,616 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-29 04:45:28,640 INFO core: _init_accounts coroutine started
2026-08-29 04:45:28,640 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 04:45:28,649 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:50:34,511 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 04:50:34,512 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 04:50:34,516 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 04:50:34,516 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 04:50:34,517 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 04:50:34,517 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 04:50:34,517 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 04:50:34,517 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 04:50:46,662 INFO core: Event loop thread started, running loop forever
2026-08-29 04:50:46,972 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 04:50:46,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 04:55:49,439 INFO core: Event loop thread started, running loop forever
2026-08-29 04:55:49,740 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 04:55:49,747 INFO core: _init_accounts coroutine started
2026-08-29 04:55:49,747 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 04:55:49,774 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:00:18,529 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:05:25,604 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 05:05:25,604 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 05:05:25,605 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-29 05:05:25,606 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 05:05:25,606 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 05:05:25,608 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 05:05:25,608 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 05:05:27,465 INFO core: Event loop thread started, running loop forever
2026-08-29 05:05:27,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 05:05:27,785 INFO core: _init_accounts coroutine started
2026-08-29 05:05:27,785 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 05:05:27,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:10:09,179 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 05:10:09,180 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 05:10:09,182 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 05:10:09,184 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 05:10:09,200 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:15:33,032 INFO core: Event loop thread started, running loop forever
2026-08-29 05:15:33,334 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 05:15:33,343 INFO core: _init_accounts coroutine started
2026-08-29 05:15:33,345 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 05:15:33,347 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:20:30,359 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 05:20:30,360 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 05:20:30,361 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 05:20:30,363 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 05:20:30,385 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 05:20:30,386 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 05:20:30,390 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:25:11,917 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 05:25:11,918 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 05:25:11,925 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:30:06,853 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 05:30:06,853 WARNING core: Account 2: connect timed out after 35s
2026-08-29 05:30:06,854 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-29 05:30:06,854 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-29 05:30:06,855 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 05:30:06,856 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-29 05:30:06,856 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-29 05:30:06,907 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:30:11,916 INFO telethon.network.mtprotosender: Connection to 91.108.56.181:443/TcpAbridged complete!
2026-08-29 05:35:34,558 INFO core: Event loop thread started, running loop forever
2026-08-29 05:35:34,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 05:35:34,864 INFO core: _init_accounts coroutine started
2026-08-29 05:35:34,865 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 05:35:34,874 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:40:08,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:45:14,543 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 05:45:14,546 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 05:45:14,547 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:50:20,450 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 05:50:23,034 INFO core: Event loop thread started, running loop forever
2026-08-29 05:50:23,338 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 05:50:23,346 INFO core: _init_accounts coroutine started
2026-08-29 05:50:23,346 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 05:50:23,349 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 05:55:24,200 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 05:55:24,216 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:00:11,215 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:05:52,939 INFO core: Event loop thread started, running loop forever
2026-08-29 06:05:53,240 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 06:05:53,247 INFO core: _init_accounts coroutine started
2026-08-29 06:05:53,247 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 06:05:53,254 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:10:20,959 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:15:10,898 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 06:15:10,899 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 06:15:10,906 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 06:15:10,908 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 06:15:10,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:20:17,495 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 06:20:17,496 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 06:20:17,496 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 06:20:27,229 INFO core: Event loop thread started, running loop forever
2026-08-29 06:20:27,530 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 06:20:27,534 INFO core: _init_accounts coroutine started
2026-08-29 06:20:27,535 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 06:20:27,552 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 06:20:27,552 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 06:20:27,554 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 06:20:27,556 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 06:20:27,561 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:25:08,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:30:14,472 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 06:30:14,474 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 06:30:14,474 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 06:30:49,844 INFO core: Event loop thread started, running loop forever
2026-08-29 06:30:50,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 06:30:50,152 INFO core: _init_accounts coroutine started
2026-08-29 06:30:50,153 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 06:30:50,162 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:35:14,317 INFO core: Event loop thread started, running loop forever
2026-08-29 06:35:14,618 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 06:35:14,624 INFO core: _init_accounts coroutine started
2026-08-29 06:35:14,624 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 06:35:14,635 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:40:17,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:45:11,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:50:17,451 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 06:50:17,452 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 06:50:17,452 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-29 06:50:17,453 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 06:50:17,453 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 06:50:17,453 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 06:50:17,453 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 06:50:17,453 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 06:50:17,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 06:50:23,216 INFO core: Event loop thread started, running loop forever
2026-08-29 06:50:23,518 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 06:50:23,523 INFO core: _init_accounts coroutine started
2026-08-29 06:50:23,524 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 06:50:23,544 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 06:55:30,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 06:55:43,714 INFO core: Event loop thread started, running loop forever
2026-08-29 06:55:44,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 06:55:44,020 INFO core: _init_accounts coroutine started
2026-08-29 06:55:44,022 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 06:55:44,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:00:49,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:05:24,821 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 07:05:24,821 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 07:05:24,823 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 07:05:24,827 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:05:24,827 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 07:10:06,181 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:15:13,470 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 07:15:13,471 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 07:15:13,471 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 07:15:49,776 INFO core: Event loop thread started, running loop forever
2026-08-29 07:15:50,084 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 07:15:50,091 INFO core: _init_accounts coroutine started
2026-08-29 07:15:50,095 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 07:15:50,105 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 07:15:50,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 07:15:50,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 07:15:50,109 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 07:15:50,127 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:20:27,598 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 07:20:27,598 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 07:20:27,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:25:37,960 INFO core: Event loop thread started, running loop forever
2026-08-29 07:25:38,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 07:25:38,269 INFO core: _init_accounts coroutine started
2026-08-29 07:25:38,270 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 07:25:38,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:30:32,825 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:30:32,827 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 07:30:32,827 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 07:35:25,597 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 07:35:25,599 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:40:34,220 INFO core: Event loop thread started, running loop forever
2026-08-29 07:40:34,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 07:40:34,526 INFO core: _init_accounts coroutine started
2026-08-29 07:40:34,526 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 07:40:34,538 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:45:41,617 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 07:45:41,618 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 07:45:41,618 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-29 07:45:41,619 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 07:45:41,619 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 07:45:41,619 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 07:45:41,619 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 07:45:41,619 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 07:45:41,620 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 07:45:49,250 INFO core: Event loop thread started, running loop forever
2026-08-29 07:45:49,551 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 07:45:49,556 INFO core: _init_accounts coroutine started
2026-08-29 07:45:49,556 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 07:45:49,566 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 07:45:49,567 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 07:45:49,570 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 07:45:49,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:50:05,542 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 07:50:05,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 07:55:27,255 INFO core: Event loop thread started, running loop forever
2026-08-29 07:55:27,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 07:55:27,561 INFO core: _init_accounts coroutine started
2026-08-29 07:55:27,562 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 07:55:27,577 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:00:07,855 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 08:00:07,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:05:39,391 INFO core: Event loop thread started, running loop forever
2026-08-29 08:05:39,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 08:05:39,698 INFO core: _init_accounts coroutine started
2026-08-29 08:05:39,699 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 08:05:39,719 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:10:22,994 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 08:10:22,995 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 08:10:23,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:10:23,004 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 08:15:23,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:20:29,449 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 08:20:29,449 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 08:20:29,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 08:20:29,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 08:20:32,554 INFO core: Event loop thread started, running loop forever
2026-08-29 08:20:32,855 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 08:20:32,860 INFO core: _init_accounts coroutine started
2026-08-29 08:20:32,862 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 08:20:32,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:25:39,572 INFO core: Event loop thread started, running loop forever
2026-08-29 08:25:39,873 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 08:25:39,878 INFO core: _init_accounts coroutine started
2026-08-29 08:25:39,878 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 08:25:39,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:25:39,899 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 08:25:39,900 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 08:30:24,567 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 08:30:24,587 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 08:30:24,599 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:35:42,686 INFO core: Event loop thread started, running loop forever
2026-08-29 08:35:42,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 08:35:42,993 INFO core: _init_accounts coroutine started
2026-08-29 08:35:42,996 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 08:35:43,016 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 08:35:43,016 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 08:35:43,018 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 08:35:43,022 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 08:35:43,033 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:35:43,040 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 08:35:43,042 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 08:40:48,954 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 08:40:48,956 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 08:40:48,965 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:45:54,309 INFO core: Event loop thread started, running loop forever
2026-08-29 08:45:54,610 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 08:45:54,614 INFO core: _init_accounts coroutine started
2026-08-29 08:45:54,615 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 08:45:54,627 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:45:55,300 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 08:45:55,300 WARNING core: Account 2: connect timed out after 35s
2026-08-29 08:45:55,301 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-29 08:45:55,301 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-29 08:45:55,302 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 08:45:55,303 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-29 08:45:55,304 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-29 08:50:44,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 08:55:41,694 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 08:55:41,695 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 08:55:41,758 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 08:55:41,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:00:56,553 INFO core: Event loop thread started, running loop forever
2026-08-29 09:00:56,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 09:00:56,863 INFO core: _init_accounts coroutine started
2026-08-29 09:00:56,864 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 09:00:56,877 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:05:13,163 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:10:15,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 09:10:15,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 09:10:15,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 09:10:15,109 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:15:12,973 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 09:15:12,981 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:20:16,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:25:23,529 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 09:25:23,530 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 09:25:23,530 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 09:25:26,933 INFO core: Event loop thread started, running loop forever
2026-08-29 09:25:27,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 09:25:27,240 INFO core: _init_accounts coroutine started
2026-08-29 09:25:27,241 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 09:25:27,257 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:30:17,683 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:35:18,044 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 09:35:18,044 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 09:35:18,087 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 09:35:18,090 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 09:35:18,094 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:40:25,432 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 09:40:47,258 INFO core: Event loop thread started, running loop forever
2026-08-29 09:40:47,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 09:40:47,563 INFO core: _init_accounts coroutine started
2026-08-29 09:40:47,565 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 09:40:47,572 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:45:24,085 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 09:45:24,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 09:45:24,088 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 09:45:24,090 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 09:45:24,096 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:50:30,536 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 09:50:30,536 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 09:50:30,537 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 09:50:38,105 INFO core: Event loop thread started, running loop forever
2026-08-29 09:50:38,412 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 09:50:38,418 INFO core: _init_accounts coroutine started
2026-08-29 09:50:38,419 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 09:50:38,430 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 09:55:25,274 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 09:55:25,275 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 09:55:25,276 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 09:55:25,281 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 09:55:25,294 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 09:55:25,295 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 09:55:25,299 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 09:55:25,300 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 09:55:25,311 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:00:18,672 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 10:00:18,676 WARNING core: Account 2: connect timed out after 35s
2026-08-29 10:00:18,677 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-29 10:00:18,678 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-29 10:00:18,679 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 10:00:18,681 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-29 10:00:18,682 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-29 10:00:18,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:05:18,071 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 10:05:18,072 WARNING core: Account 2: connect timed out after 35s
2026-08-29 10:05:18,073 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-29 10:05:18,073 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-29 10:05:18,074 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 10:05:18,075 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-29 10:05:18,076 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-29 10:05:18,086 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:10:21,940 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 10:10:21,946 WARNING core: Account 2: connect timed out after 35s
2026-08-29 10:10:21,948 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-29 10:10:21,948 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-29 10:10:21,951 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:15:20,459 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 10:15:20,464 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-29 10:15:20,465 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-29 10:15:20,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:20:17,137 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 10:20:17,139 WARNING core: Account 2: connect timed out after 35s
2026-08-29 10:20:17,140 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-08-29 10:20:17,141 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-08-29 10:20:17,142 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 10:20:17,143 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-08-29 10:20:17,144 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-08-29 10:20:17,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:25:24,470 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 10:25:24,470 WARNING core: Account 2: connect timed out after 35s
2026-08-29 10:25:24,471 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-08-29 10:25:24,471 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-08-29 10:25:24,471 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 10:25:24,472 WARNING core: Account 2: exhausted all Telegram server candidates
2026-08-29 10:25:24,497 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-08-29 10:25:24,498 INFO core: Signal processor started
2026-08-29 10:25:24,498 INFO core: Initialized 0 account(s), 1 pair(s)
2026-08-29 10:25:24,499 INFO core: Memory RSS: 90.58 MB
2026-08-29 10:25:51,664 INFO core: Event loop thread started, running loop forever
2026-08-29 10:25:51,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 10:25:51,971 INFO core: _init_accounts coroutine started
2026-08-29 10:25:51,973 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 10:25:51,991 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:30:23,749 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:35:11,502 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 10:35:11,503 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 10:35:11,507 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:40:18,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 10:40:18,441 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 10:40:18,442 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 10:40:18,442 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 10:40:18,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 10:40:44,629 INFO core: Event loop thread started, running loop forever
2026-08-29 10:40:44,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 10:40:44,935 INFO core: _init_accounts coroutine started
2026-08-29 10:40:44,935 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 10:40:44,946 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:45:29,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:50:52,472 INFO core: Event loop thread started, running loop forever
2026-08-29 10:50:52,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 10:50:52,784 INFO core: _init_accounts coroutine started
2026-08-29 10:50:52,784 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 10:50:52,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:55:31,524 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 10:55:31,525 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 10:55:31,526 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 10:55:31,530 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 10:55:31,531 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 11:00:14,396 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 11:00:14,397 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 11:00:14,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 11:00:28,289 INFO core: Event loop thread started, running loop forever
2026-08-29 11:00:28,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 11:00:28,594 INFO core: _init_accounts coroutine started
2026-08-29 11:00:28,595 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 11:00:28,604 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:05:23,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:10:30,506 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 11:10:53,202 INFO core: Event loop thread started, running loop forever
2026-08-29 11:10:53,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 11:10:53,507 INFO core: _init_accounts coroutine started
2026-08-29 11:10:53,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 11:10:53,518 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:15:08,385 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:20:45,072 INFO core: Event loop thread started, running loop forever
2026-08-29 11:20:45,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 11:20:45,381 INFO core: _init_accounts coroutine started
2026-08-29 11:20:45,381 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 11:20:45,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 11:20:45,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 11:20:45,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 11:20:45,415 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 11:20:45,441 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:25:24,217 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:30:53,120 INFO core: Event loop thread started, running loop forever
2026-08-29 11:30:53,421 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 11:30:53,426 INFO core: _init_accounts coroutine started
2026-08-29 11:30:53,428 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 11:30:53,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:35:17,849 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:35:17,851 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 11:35:17,851 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 11:40:28,678 INFO core: Event loop thread started, running loop forever
2026-08-29 11:40:28,979 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 11:40:28,983 INFO core: _init_accounts coroutine started
2026-08-29 11:40:28,984 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 11:40:28,992 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:45:16,661 INFO core: Event loop thread started, running loop forever
2026-08-29 11:45:16,962 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 11:45:16,968 INFO core: _init_accounts coroutine started
2026-08-29 11:45:16,969 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 11:45:16,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:45:34,699 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-29 11:50:23,493 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 11:50:40,907 INFO core: Event loop thread started, running loop forever
2026-08-29 11:50:41,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 11:50:41,215 INFO core: _init_accounts coroutine started
2026-08-29 11:50:41,215 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 11:50:41,266 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:55:31,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 11:55:31,434 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 11:55:31,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 12:00:09,261 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 12:00:09,264 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 12:00:09,284 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 12:00:09,285 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 12:00:09,291 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 12:00:09,292 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 12:00:09,293 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:05:15,407 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 12:05:15,407 WARNING core: Account 2: connect timed out after 35s
2026-08-29 12:05:15,408 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-29 12:05:15,408 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-29 12:05:16,679 INFO core: Event loop thread started, running loop forever
2026-08-29 12:05:16,980 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 12:05:16,986 INFO core: _init_accounts coroutine started
2026-08-29 12:05:16,987 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 12:05:16,994 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:10:36,305 INFO core: Event loop thread started, running loop forever
2026-08-29 12:10:36,606 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 12:10:36,610 INFO core: _init_accounts coroutine started
2026-08-29 12:10:36,611 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 12:10:36,618 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:15:43,385 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 12:15:49,210 INFO core: Event loop thread started, running loop forever
2026-08-29 12:15:49,512 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 12:15:49,518 INFO core: _init_accounts coroutine started
2026-08-29 12:15:49,520 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 12:15:49,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:15:49,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 12:15:49,541 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 12:15:49,543 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 12:15:49,544 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 12:20:13,008 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:25:15,241 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 12:25:15,241 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 12:25:15,248 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:30:14,855 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 12:30:14,856 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 12:30:14,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:35:20,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 12:35:20,382 WARNING core: Account 2: connect timed out after 35s
2026-08-29 12:35:20,383 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-29 12:35:20,384 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-29 12:35:20,385 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 12:35:20,387 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-29 12:35:20,387 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-29 12:35:22,891 INFO core: Event loop thread started, running loop forever
2026-08-29 12:35:23,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 12:35:23,199 INFO core: _init_accounts coroutine started
2026-08-29 12:35:23,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 12:35:23,207 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:40:28,833 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:45:16,579 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 12:45:16,579 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 12:45:16,586 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 12:45:16,590 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 12:45:16,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:50:23,456 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 12:50:33,621 INFO core: Event loop thread started, running loop forever
2026-08-29 12:50:33,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 12:50:33,927 INFO core: _init_accounts coroutine started
2026-08-29 12:50:33,928 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 12:50:33,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 12:55:35,575 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:00:29,176 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:05:36,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 13:05:46,424 INFO core: Event loop thread started, running loop forever
2026-08-29 13:05:46,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 13:05:46,730 INFO core: _init_accounts coroutine started
2026-08-29 13:05:46,732 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 13:05:46,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:10:26,549 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 13:10:26,550 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 13:10:26,553 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 13:10:26,555 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:10:26,558 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 13:15:10,491 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 13:15:14,872 INFO core: Event loop thread started, running loop forever
2026-08-29 13:15:15,180 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 13:15:15,194 INFO core: _init_accounts coroutine started
2026-08-29 13:15:15,195 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 13:15:15,202 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:20:13,579 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:25:11,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:30:17,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 13:30:50,705 INFO core: Event loop thread started, running loop forever
2026-08-29 13:30:51,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 13:30:51,015 INFO core: _init_accounts coroutine started
2026-08-29 13:30:51,015 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 13:30:51,028 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:35:53,917 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 13:35:53,954 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:40:50,131 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:45:24,909 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-29 13:45:24,910 INFO core: _init_accounts coroutine started
2026-08-29 13:45:24,910 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 13:45:24,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:50:30,430 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 13:50:49,728 INFO core: Event loop thread started, running loop forever
2026-08-29 13:50:50,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 13:50:50,037 INFO core: _init_accounts coroutine started
2026-08-29 13:50:50,038 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 13:50:50,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:55:48,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 13:55:48,320 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 13:55:48,321 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 14:00:15,452 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 14:00:15,454 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 14:00:15,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:05:06,536 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:10:12,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 14:10:12,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 14:10:12,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 14:10:28,879 INFO core: Event loop thread started, running loop forever
2026-08-29 14:10:29,181 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 14:10:29,185 INFO core: _init_accounts coroutine started
2026-08-29 14:10:29,186 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 14:10:29,196 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:15:15,810 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 14:15:15,810 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 14:15:15,822 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 14:15:15,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:20:21,383 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 14:20:28,680 INFO core: Event loop thread started, running loop forever
2026-08-29 14:20:28,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 14:20:28,993 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:25:34,462 INFO core: _init_accounts coroutine started
2026-08-29 14:25:34,463 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 14:25:34,463 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-29 14:25:45,498 INFO core: Event loop thread started, running loop forever
2026-08-29 14:25:45,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 14:25:45,804 INFO core: _init_accounts coroutine started
2026-08-29 14:25:45,805 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 14:25:45,817 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 14:25:45,817 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 14:25:45,819 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 14:25:45,820 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:25:45,822 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 14:30:23,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:35:25,665 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:40:37,742 INFO core: Event loop thread started, running loop forever
2026-08-29 14:40:38,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 14:40:38,047 INFO core: _init_accounts coroutine started
2026-08-29 14:40:38,048 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 14:40:38,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:45:44,361 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 14:45:48,325 INFO core: Event loop thread started, running loop forever
2026-08-29 14:45:48,626 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 14:45:48,630 INFO core: _init_accounts coroutine started
2026-08-29 14:45:48,631 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 14:45:48,636 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:50:14,470 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 14:50:14,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 14:55:09,860 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:00:19,336 INFO core: Event loop thread started, running loop forever
2026-08-29 15:00:19,637 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 15:00:19,648 INFO core: _init_accounts coroutine started
2026-08-29 15:00:19,649 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 15:00:19,663 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:05:30,983 INFO core: Event loop thread started, running loop forever
2026-08-29 15:05:31,284 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 15:05:31,288 INFO core: _init_accounts coroutine started
2026-08-29 15:05:31,294 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 15:05:31,307 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 15:05:31,307 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 15:05:31,309 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 15:05:31,311 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 15:05:31,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:10:38,464 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 15:10:38,465 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 15:10:38,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 15:10:48,052 INFO core: Event loop thread started, running loop forever
2026-08-29 15:10:48,353 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 15:10:48,359 INFO core: _init_accounts coroutine started
2026-08-29 15:10:48,359 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 15:10:48,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:15:48,312 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:15:48,313 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 15:15:48,313 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 15:20:14,278 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 15:20:14,286 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 15:20:14,292 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:25:32,052 INFO core: Event loop thread started, running loop forever
2026-08-29 15:25:32,353 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 15:25:32,359 INFO core: _init_accounts coroutine started
2026-08-29 15:25:32,361 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 15:25:32,368 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:30:46,515 INFO core: Event loop thread started, running loop forever
2026-08-29 15:30:46,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 15:30:46,826 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:35:04,456 INFO core: _init_accounts coroutine started
2026-08-29 15:35:04,456 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 15:35:04,480 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:40:06,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:45:13,422 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 15:45:37,148 INFO core: Event loop thread started, running loop forever
2026-08-29 15:45:37,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 15:45:37,455 INFO core: _init_accounts coroutine started
2026-08-29 15:45:37,456 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 15:45:37,466 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:50:32,195 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 15:50:32,196 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 15:50:32,198 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 15:50:32,201 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 15:50:32,202 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 15:55:31,240 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:00:37,477 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 16:00:37,478 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 16:00:37,478 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 16:00:49,557 INFO core: Event loop thread started, running loop forever
2026-08-29 16:00:49,858 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 16:00:49,863 INFO core: _init_accounts coroutine started
2026-08-29 16:00:49,864 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 16:00:49,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:05:28,972 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:10:34,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 16:10:37,225 INFO core: Event loop thread started, running loop forever
2026-08-29 16:10:37,526 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 16:10:37,530 INFO core: _init_accounts coroutine started
2026-08-29 16:10:37,531 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 16:10:37,542 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:15:38,589 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 16:15:38,590 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 16:15:38,601 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 16:15:38,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:20:45,381 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 16:20:51,931 INFO core: Event loop thread started, running loop forever
2026-08-29 16:20:52,231 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 16:20:52,235 INFO core: _init_accounts coroutine started
2026-08-29 16:20:52,236 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 16:20:52,243 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:25:33,371 INFO core: Event loop thread started, running loop forever
2026-08-29 16:25:33,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 16:25:33,677 INFO core: _init_accounts coroutine started
2026-08-29 16:25:33,678 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 16:25:33,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:30:11,030 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 16:30:11,063 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:35:06,927 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:40:10,449 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-29 16:40:10,451 INFO core: _init_accounts coroutine started
2026-08-29 16:40:10,452 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 16:40:10,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:45:17,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 16:45:34,316 INFO core: Event loop thread started, running loop forever
2026-08-29 16:45:34,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 16:45:34,622 INFO core: _init_accounts coroutine started
2026-08-29 16:45:34,622 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 16:45:34,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:50:34,870 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 16:50:34,890 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 16:55:36,299 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-29 16:55:36,300 INFO core: _init_accounts coroutine started
2026-08-29 16:55:36,300 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 16:55:36,307 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:00:15,752 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 17:00:15,753 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 17:00:15,758 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:00:15,760 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 17:05:22,440 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 17:05:22,441 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 17:05:22,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 17:05:22,442 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 17:05:40,131 INFO core: Event loop thread started, running loop forever
2026-08-29 17:05:40,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 17:05:40,438 INFO core: _init_accounts coroutine started
2026-08-29 17:05:40,438 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 17:05:40,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:10:21,454 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 17:10:21,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 17:10:21,460 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:15:12,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 17:15:54,504 INFO core: Event loop thread started, running loop forever
2026-08-29 17:15:54,805 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 17:15:54,809 INFO core: _init_accounts coroutine started
2026-08-29 17:15:54,809 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 17:15:54,818 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:20:21,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 17:20:21,409 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 17:20:21,416 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 17:20:21,420 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 17:20:21,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:25:20,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:30:08,888 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:35:14,414 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 17:35:14,414 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 17:35:14,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 17:35:14,715 INFO core: Event loop thread started, running loop forever
2026-08-29 17:35:15,020 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 17:35:15,026 INFO core: _init_accounts coroutine started
2026-08-29 17:35:15,026 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 17:35:15,049 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:40:13,414 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 17:40:13,415 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 17:40:13,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 17:40:13,421 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 17:40:13,435 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:45:34,379 INFO core: Event loop thread started, running loop forever
2026-08-29 17:45:34,680 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 17:45:34,684 INFO core: _init_accounts coroutine started
2026-08-29 17:45:34,685 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 17:45:34,697 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 17:45:34,698 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 17:45:34,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:50:43,785 INFO core: Event loop thread started, running loop forever
2026-08-29 17:50:44,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 17:50:44,090 INFO core: _init_accounts coroutine started
2026-08-29 17:50:44,092 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 17:50:44,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 17:55:40,454 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:00:47,475 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 18:00:54,565 INFO core: Event loop thread started, running loop forever
2026-08-29 18:00:54,866 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 18:00:54,872 INFO core: _init_accounts coroutine started
2026-08-29 18:00:54,875 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 18:00:54,883 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:05:43,216 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:05:43,217 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 18:05:43,217 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 18:10:37,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 18:10:37,307 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 18:10:37,316 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:10:37,325 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 18:10:37,325 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 18:10:37,331 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-29 18:10:37,332 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-29 18:15:11,605 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 18:15:11,606 WARNING core: Account 2: connect timed out after 35s
2026-08-29 18:15:11,606 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-29 18:15:11,607 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-29 18:15:11,608 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 18:15:11,609 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-29 18:15:11,609 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-29 18:15:11,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:20:17,455 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-29 18:20:17,457 WARNING core: Account 2: connect timed out after 35s
2026-08-29 18:20:17,457 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-29 18:20:17,458 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-29 18:20:17,458 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-29 18:20:17,460 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-29 18:20:38,063 INFO core: Event loop thread started, running loop forever
2026-08-29 18:20:38,364 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 18:20:38,375 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:25:24,302 INFO core: _init_accounts coroutine started
2026-08-29 18:25:24,303 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 18:25:24,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:30:09,979 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 18:30:09,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 18:30:09,982 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 18:30:09,987 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 18:30:10,006 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:35:16,452 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 18:35:16,453 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 18:35:16,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 18:35:40,658 INFO core: Event loop thread started, running loop forever
2026-08-29 18:35:40,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 18:35:40,964 INFO core: _init_accounts coroutine started
2026-08-29 18:35:40,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 18:35:40,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:40:38,806 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 18:40:38,817 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:45:31,549 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:50:41,161 INFO core: Event loop thread started, running loop forever
2026-08-29 18:50:41,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 18:50:41,470 INFO core: _init_accounts coroutine started
2026-08-29 18:50:41,471 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 18:50:41,484 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:55:21,580 INFO core: Event loop thread started, running loop forever
2026-08-29 18:55:21,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 18:55:21,891 INFO core: _init_accounts coroutine started
2026-08-29 18:55:21,896 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 18:55:21,898 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:00:28,463 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 19:00:51,038 INFO core: Event loop thread started, running loop forever
2026-08-29 19:00:51,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:00:51,345 INFO core: _init_accounts coroutine started
2026-08-29 19:00:51,346 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:00:51,355 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:05:50,244 INFO core: Event loop thread started, running loop forever
2026-08-29 19:05:50,545 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:05:50,550 INFO core: _init_accounts coroutine started
2026-08-29 19:05:50,551 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:05:50,561 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:05:58,245 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 19:10:38,735 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 19:10:38,737 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 19:10:38,741 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 19:10:38,744 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:15:12,485 INFO core: Event loop thread started, running loop forever
2026-08-29 19:15:12,786 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:15:12,791 INFO core: _init_accounts coroutine started
2026-08-29 19:15:12,792 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:15:12,810 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:15:44,528 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 19:15:44,529 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 19:20:41,699 INFO core: Event loop thread started, running loop forever
2026-08-29 19:20:42,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:20:42,010 INFO core: _init_accounts coroutine started
2026-08-29 19:20:42,011 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:20:42,026 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:25:13,287 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:25:13,291 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 19:30:20,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 19:30:20,437 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-29 19:30:20,438 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 19:30:20,438 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 19:30:20,438 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 19:30:20,438 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 19:30:20,438 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 19:30:20,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 19:30:32,615 INFO core: Event loop thread started, running loop forever
2026-08-29 19:30:32,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:30:32,921 INFO core: _init_accounts coroutine started
2026-08-29 19:30:32,922 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:30:32,934 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:35:32,502 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 19:35:32,502 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 19:35:32,504 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 19:35:32,506 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 19:35:32,517 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:40:48,239 INFO core: Event loop thread started, running loop forever
2026-08-29 19:40:48,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:40:48,547 INFO core: _init_accounts coroutine started
2026-08-29 19:40:48,547 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:40:48,556 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:45:14,445 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 19:45:14,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 19:45:14,447 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 19:45:14,451 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 19:45:14,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:50:21,003 INFO core: Event loop thread started, running loop forever
2026-08-29 19:50:21,036 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 19:50:21,037 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 19:50:21,037 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 19:50:21,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:50:21,315 INFO core: _init_accounts coroutine started
2026-08-29 19:50:21,316 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:50:21,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 19:55:27,414 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 19:55:43,448 INFO core: Event loop thread started, running loop forever
2026-08-29 19:55:43,749 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 19:55:43,753 INFO core: _init_accounts coroutine started
2026-08-29 19:55:43,754 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 19:55:43,763 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:00:50,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 20:00:50,649 INFO core: Event loop thread started, running loop forever
2026-08-29 20:00:50,950 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 20:00:50,958 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:05:25,925 INFO core: _init_accounts coroutine started
2026-08-29 20:05:25,927 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 20:05:25,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:10:32,433 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 20:10:36,930 INFO core: Event loop thread started, running loop forever
2026-08-29 20:10:37,231 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 20:10:37,236 INFO core: _init_accounts coroutine started
2026-08-29 20:10:37,238 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 20:10:37,251 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:15:07,257 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:20:36,607 INFO core: Event loop thread started, running loop forever
2026-08-29 20:20:36,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 20:20:36,913 INFO core: _init_accounts coroutine started
2026-08-29 20:20:36,914 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 20:20:36,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:25:11,369 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 20:25:11,370 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 20:25:11,372 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:25:11,373 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 20:25:11,377 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 20:30:13,683 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:35:19,829 INFO core: Event loop thread started, running loop forever
2026-08-29 20:35:20,130 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 20:35:20,138 INFO core: _init_accounts coroutine started
2026-08-29 20:35:20,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 20:35:20,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:40:18,652 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:45:30,270 INFO core: Event loop thread started, running loop forever
2026-08-29 20:45:30,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 20:45:30,578 INFO core: _init_accounts coroutine started
2026-08-29 20:45:30,578 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 20:45:30,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:50:22,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 20:55:29,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 20:55:29,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 20:55:29,435 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-29 20:55:29,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 20:55:29,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 20:55:29,436 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 20:55:29,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 20:55:29,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 20:55:29,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 20:55:34,002 INFO core: Event loop thread started, running loop forever
2026-08-29 20:55:34,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 20:55:34,308 INFO core: _init_accounts coroutine started
2026-08-29 20:55:34,308 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 20:55:34,320 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:00:12,180 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 21:00:12,181 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 21:00:12,186 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:05:08,052 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 21:05:08,066 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:05:08,068 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 21:10:40,699 INFO core: Event loop thread started, running loop forever
2026-08-29 21:10:41,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 21:10:41,005 INFO core: _init_accounts coroutine started
2026-08-29 21:10:41,007 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 21:10:41,014 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:15:23,853 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 21:15:23,867 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:20:48,533 INFO core: Event loop thread started, running loop forever
2026-08-29 21:20:48,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 21:20:48,846 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:25:37,549 INFO core: _init_accounts coroutine started
2026-08-29 21:25:37,553 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 21:25:37,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:26:27,066 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 21:26:27,066 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 21:26:27,067 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-29 21:26:27,067 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 21:26:27,068 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 21:26:27,068 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 21:26:27,068 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 21:26:27,068 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 21:26:27,068 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 21:30:14,799 INFO core: Event loop thread started, running loop forever
2026-08-29 21:30:15,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 21:30:15,107 INFO core: _init_accounts coroutine started
2026-08-29 21:30:15,108 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 21:30:15,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:35:21,550 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 21:35:23,069 INFO core: Event loop thread started, running loop forever
2026-08-29 21:35:23,369 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 21:35:23,375 INFO core: _init_accounts coroutine started
2026-08-29 21:35:23,375 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 21:35:23,384 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:40:38,838 INFO core: Event loop thread started, running loop forever
2026-08-29 21:40:39,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 21:40:39,145 INFO core: _init_accounts coroutine started
2026-08-29 21:40:39,146 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 21:40:39,153 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:45:14,755 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:50:20,421 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 21:50:20,790 INFO core: Event loop thread started, running loop forever
2026-08-29 21:50:21,091 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 21:50:21,095 INFO core: _init_accounts coroutine started
2026-08-29 21:50:21,096 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 21:50:21,106 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 21:50:21,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 21:50:21,108 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 21:50:21,109 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 21:50:21,123 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 21:55:27,517 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 21:55:31,984 INFO core: Event loop thread started, running loop forever
2026-08-29 21:55:32,285 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 21:55:32,289 INFO core: _init_accounts coroutine started
2026-08-29 21:55:32,290 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 21:55:32,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:00:31,673 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 22:00:31,673 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 22:00:31,675 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 22:00:31,678 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 22:00:31,680 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:05:37,429 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 22:05:40,894 INFO core: Event loop thread started, running loop forever
2026-08-29 22:05:41,195 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 22:05:41,199 INFO core: _init_accounts coroutine started
2026-08-29 22:05:41,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 22:05:41,208 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:10:15,746 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:15:22,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 22:15:28,678 INFO core: Event loop thread started, running loop forever
2026-08-29 22:15:28,979 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 22:15:28,984 INFO core: _init_accounts coroutine started
2026-08-29 22:15:28,984 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 22:15:28,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:20:34,067 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:21:14,036 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 22:21:14,037 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 22:21:14,046 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 22:21:14,046 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 22:21:14,047 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 22:21:14,048 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 22:21:14,048 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 22:21:14,048 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 22:25:31,052 INFO core: Event loop thread started, running loop forever
2026-08-29 22:25:31,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 22:25:31,360 INFO core: _init_accounts coroutine started
2026-08-29 22:25:31,360 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 22:25:31,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:30:25,462 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 22:30:25,463 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 22:30:25,467 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 22:30:25,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:35:24,155 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-29 22:35:24,156 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 22:35:24,166 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:39:21,331 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 22:40:42,718 INFO core: Event loop thread started, running loop forever
2026-08-29 22:40:43,019 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 22:40:43,023 INFO core: _init_accounts coroutine started
2026-08-29 22:40:43,025 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 22:40:43,036 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:45:04,509 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:50:29,359 INFO core: Event loop thread started, running loop forever
2026-08-29 22:50:29,661 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 22:50:29,664 INFO core: _init_accounts coroutine started
2026-08-29 22:50:29,665 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 22:50:29,676 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 22:50:29,677 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 22:50:29,679 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 22:50:29,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 22:50:29,683 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 22:55:30,594 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:00:37,513 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 23:00:45,381 INFO core: Event loop thread started, running loop forever
2026-08-29 23:00:45,683 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 23:00:45,688 INFO core: _init_accounts coroutine started
2026-08-29 23:00:45,689 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 23:00:45,695 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:05:12,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:05:12,806 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 23:05:12,806 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 23:10:10,139 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 23:10:10,144 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 23:10:10,155 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:15:43,199 INFO core: Event loop thread started, running loop forever
2026-08-29 23:15:43,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 23:15:43,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:20:26,988 INFO core: _init_accounts coroutine started
2026-08-29 23:20:26,989 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 23:20:26,998 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:25:50,812 INFO core: Event loop thread started, running loop forever
2026-08-29 23:25:51,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 23:25:51,117 INFO core: _init_accounts coroutine started
2026-08-29 23:25:51,119 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 23:25:51,143 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 23:25:51,143 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 23:25:51,146 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 23:25:51,148 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 23:25:51,152 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:30:17,461 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:35:24,488 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-29 23:35:24,488 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 23:35:24,489 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 23:35:34,866 INFO core: Event loop thread started, running loop forever
2026-08-29 23:35:35,167 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 23:35:35,172 INFO core: _init_accounts coroutine started
2026-08-29 23:35:35,173 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 23:35:35,183 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:39:18,338 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 23:39:18,338 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 23:39:18,339 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-29 23:39:18,339 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-29 23:39:18,339 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-29 23:39:18,340 INFO core: _init_accounts_inner: reloading LLM config
2026-08-29 23:39:18,340 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-29 23:39:18,340 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-29 23:39:18,340 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-29 23:40:44,175 INFO core: Event loop thread started, running loop forever
2026-08-29 23:40:44,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-29 23:40:44,480 INFO core: _init_accounts coroutine started
2026-08-29 23:40:44,481 INFO core: _init_accounts_inner: starting DB migrations
2026-08-29 23:40:44,490 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:45:33,322 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:45:33,323 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-29 23:50:21,614 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-29 23:50:21,620 INFO core: status() clients=0 connected=False forwarding=False
2026-08-29 23:55:25,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:00:09,135 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 00:00:09,150 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 00:00:09,157 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:05:25,595 INFO core: Event loop thread started, running loop forever
2026-08-30 00:05:25,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 00:05:25,907 INFO core: _init_accounts coroutine started
2026-08-30 00:05:25,907 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 00:05:25,919 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:10:11,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:15:07,663 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 00:15:07,679 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:20:46,681 INFO core: Event loop thread started, running loop forever
2026-08-30 00:20:46,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 00:20:46,987 INFO core: _init_accounts coroutine started
2026-08-30 00:20:46,989 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 00:20:47,003 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:25:24,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:30:48,706 INFO core: Event loop thread started, running loop forever
2026-08-30 00:30:49,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 00:30:49,011 INFO core: _init_accounts coroutine started
2026-08-30 00:30:49,013 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 00:30:49,024 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:35:08,907 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 00:35:08,907 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 00:35:08,912 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 00:35:08,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:40:15,495 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 00:40:15,496 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-08-30 00:40:17,079 INFO core: Event loop thread started, running loop forever
2026-08-30 00:40:17,380 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 00:40:17,386 INFO core: _init_accounts coroutine started
2026-08-30 00:40:17,387 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 00:40:17,394 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:45:19,786 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:50:13,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 00:55:20,463 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 00:55:20,464 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 00:55:20,467 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 00:55:20,467 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 00:55:20,469 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 00:55:22,858 INFO core: Event loop thread started, running loop forever
2026-08-30 00:55:23,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 00:55:23,173 INFO core: _init_accounts coroutine started
2026-08-30 00:55:23,173 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 00:55:23,190 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:00:49,597 INFO core: Event loop thread started, running loop forever
2026-08-30 01:00:49,898 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 01:00:49,903 INFO core: _init_accounts coroutine started
2026-08-30 01:00:49,904 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 01:00:49,915 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:05:11,560 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:10:28,780 INFO core: Event loop thread started, running loop forever
2026-08-30 01:10:29,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 01:10:29,087 INFO core: _init_accounts coroutine started
2026-08-30 01:10:29,090 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 01:10:29,095 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:15:35,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 01:15:48,636 INFO core: Event loop thread started, running loop forever
2026-08-30 01:15:48,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 01:15:48,942 INFO core: _init_accounts coroutine started
2026-08-30 01:15:48,947 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 01:15:48,953 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:20:37,351 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:25:33,463 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 01:25:33,464 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 01:25:33,472 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 01:25:33,473 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 01:25:33,483 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:25:33,490 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 01:25:33,490 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 01:25:33,495 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 01:25:33,496 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 01:30:40,541 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 01:30:40,542 WARNING core: Account 2: connect timed out after 35s
2026-08-30 01:30:40,543 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 01:30:40,544 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 01:30:51,356 INFO core: Event loop thread started, running loop forever
2026-08-30 01:30:51,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 01:30:51,662 INFO core: _init_accounts coroutine started
2026-08-30 01:30:51,662 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 01:30:51,681 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:35:50,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 01:35:50,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 01:35:50,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:40:46,712 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 01:40:46,717 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:45:08,275 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:50:08,071 INFO core: Event loop thread started, running loop forever
2026-08-30 01:50:08,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 01:50:08,377 INFO core: _init_accounts coroutine started
2026-08-30 01:50:08,378 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 01:50:08,386 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 01:50:15,072 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 01:50:15,073 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 01:50:15,074 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 01:50:15,074 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 01:55:14,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 01:55:14,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 01:55:14,384 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-30 01:55:14,385 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 01:55:14,385 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 01:55:14,385 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 01:55:14,385 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 01:55:14,385 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 01:55:14,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 01:55:18,180 INFO core: Event loop thread started, running loop forever
2026-08-30 01:55:18,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 01:55:18,492 INFO core: _init_accounts coroutine started
2026-08-30 01:55:18,494 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 01:55:18,501 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:00:22,339 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:05:32,533 INFO core: Event loop thread started, running loop forever
2026-08-30 02:05:32,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 02:05:32,838 INFO core: _init_accounts coroutine started
2026-08-30 02:05:32,838 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 02:05:32,855 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:10:14,258 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:15:18,978 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:20:36,554 INFO core: Event loop thread started, running loop forever
2026-08-30 02:20:36,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 02:20:36,862 INFO core: _init_accounts coroutine started
2026-08-30 02:20:36,862 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 02:20:36,871 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:25:24,366 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:30:46,007 INFO core: Event loop thread started, running loop forever
2026-08-30 02:30:46,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 02:30:46,316 INFO core: _init_accounts coroutine started
2026-08-30 02:30:46,316 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 02:30:46,333 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:35:38,462 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 02:35:38,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:40:31,314 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:45:04,119 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-30 02:45:04,120 INFO core: _init_accounts coroutine started
2026-08-30 02:45:04,121 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 02:45:04,141 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 02:45:04,141 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 02:45:04,143 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 02:45:04,145 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 02:45:04,178 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 02:45:04,178 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 02:45:04,184 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 02:45:04,186 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 02:45:04,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:50:11,371 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 02:50:11,372 WARNING core: Account 2: connect timed out after 35s
2026-08-30 02:50:11,373 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 02:50:11,373 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 02:50:11,375 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 02:50:11,377 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 02:50:11,377 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-30 02:50:22,541 INFO core: Event loop thread started, running loop forever
2026-08-30 02:50:22,842 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 02:50:22,846 INFO core: _init_accounts coroutine started
2026-08-30 02:50:22,848 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 02:50:22,862 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 02:50:22,862 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 02:50:22,864 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 02:50:22,865 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 02:55:29,452 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 02:55:29,475 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 02:55:29,475 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 02:55:29,475 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 02:55:32,216 INFO core: Event loop thread started, running loop forever
2026-08-30 02:55:32,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 02:55:32,521 INFO core: _init_accounts coroutine started
2026-08-30 02:55:32,523 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 02:55:32,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:00:39,647 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-30 03:00:53,573 INFO core: Event loop thread started, running loop forever
2026-08-30 03:00:53,874 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 03:00:53,879 INFO core: _init_accounts coroutine started
2026-08-30 03:00:53,879 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 03:00:53,898 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:05:24,110 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 03:05:24,124 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:10:17,690 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:15:32,431 INFO core: Event loop thread started, running loop forever
2026-08-30 03:15:32,732 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 03:15:32,736 INFO core: _init_accounts coroutine started
2026-08-30 03:15:32,737 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 03:15:32,745 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:20:39,349 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 03:20:39,357 INFO core: Event loop thread started, running loop forever
2026-08-30 03:20:39,659 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 03:20:39,664 INFO core: _init_accounts coroutine started
2026-08-30 03:20:39,665 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 03:20:39,676 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:25:37,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 03:25:37,699 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 03:25:37,702 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 03:25:37,708 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 03:25:37,712 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:30:12,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:35:08,041 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:40:08,529 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:45:10,400 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 03:45:10,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 03:45:10,421 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 03:45:10,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 03:45:10,438 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:50:17,413 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 03:50:17,418 WARNING core: Account 2: connect timed out after 35s
2026-08-30 03:50:27,361 INFO core: Event loop thread started, running loop forever
2026-08-30 03:50:27,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 03:50:27,666 INFO core: _init_accounts coroutine started
2026-08-30 03:50:27,669 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 03:50:27,697 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 03:55:10,414 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 03:55:10,440 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:00:15,801 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:05:35,488 INFO core: Event loop thread started, running loop forever
2026-08-30 04:05:35,789 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 04:05:35,794 INFO core: _init_accounts coroutine started
2026-08-30 04:05:35,796 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 04:05:35,806 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:10:54,214 INFO core: Event loop thread started, running loop forever
2026-08-30 04:10:54,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 04:10:54,520 INFO core: _init_accounts coroutine started
2026-08-30 04:10:54,520 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 04:10:54,531 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:10:54,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 04:10:54,535 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 04:15:18,267 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 04:15:18,272 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:20:25,412 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 04:20:25,413 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 04:20:25,414 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 04:20:25,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 04:20:28,267 INFO core: Event loop thread started, running loop forever
2026-08-30 04:20:28,568 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 04:20:28,574 INFO core: _init_accounts coroutine started
2026-08-30 04:20:28,574 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 04:20:28,585 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:25:33,368 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 04:25:33,378 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:30:37,995 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:35:34,442 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-30 04:35:34,446 INFO core: _init_accounts coroutine started
2026-08-30 04:35:34,446 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 04:35:34,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:40:29,070 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:45:35,453 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 04:45:41,546 INFO core: Event loop thread started, running loop forever
2026-08-30 04:45:41,847 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 04:45:41,858 INFO core: _init_accounts coroutine started
2026-08-30 04:45:41,858 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 04:45:41,884 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:50:38,843 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 04:50:38,843 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 04:50:38,853 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 04:50:38,856 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 04:50:38,860 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 04:55:10,060 INFO core: Event loop thread started, running loop forever
2026-08-30 04:55:10,362 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 04:55:10,365 INFO core: _init_accounts coroutine started
2026-08-30 04:55:10,365 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 04:55:10,379 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-08-30 04:55:10,392 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-08-30 05:00:29,274 INFO core: Event loop thread started, running loop forever
2026-08-30 05:00:29,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 05:00:29,580 INFO core: _init_accounts coroutine started
2026-08-30 05:00:29,580 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 05:00:29,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:05:36,412 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 05:05:51,706 INFO core: Event loop thread started, running loop forever
2026-08-30 05:05:52,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 05:05:52,013 INFO core: _init_accounts coroutine started
2026-08-30 05:05:52,015 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 05:05:52,023 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:10:50,343 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 05:10:50,344 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 05:10:50,345 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 05:10:50,346 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 05:10:50,372 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:15:27,436 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:20:04,733 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 05:20:04,734 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 05:20:04,742 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 05:20:04,743 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 05:20:04,765 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:25:10,445 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 05:25:10,445 WARNING core: Account 2: connect timed out after 35s
2026-08-30 05:25:10,446 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 05:25:10,446 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 05:25:10,447 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 05:25:10,448 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 05:25:10,448 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-30 05:25:39,165 INFO core: Event loop thread started, running loop forever
2026-08-30 05:25:39,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 05:25:39,470 INFO core: _init_accounts coroutine started
2026-08-30 05:25:39,472 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 05:25:39,495 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:30:14,375 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 05:30:47,068 INFO core: Event loop thread started, running loop forever
2026-08-30 05:30:47,370 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 05:30:47,383 INFO core: _init_accounts coroutine started
2026-08-30 05:30:47,383 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 05:30:47,386 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:35:10,193 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 05:35:10,218 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:40:24,795 INFO core: Event loop thread started, running loop forever
2026-08-30 05:40:25,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 05:40:25,101 INFO core: _init_accounts coroutine started
2026-08-30 05:40:25,103 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 05:40:25,117 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 05:40:25,118 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 05:40:25,122 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 05:40:25,124 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 05:40:25,127 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:45:31,391 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 05:45:32,980 INFO core: Event loop thread started, running loop forever
2026-08-30 05:45:33,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 05:45:33,286 INFO core: _init_accounts coroutine started
2026-08-30 05:45:33,287 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 05:45:33,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:50:49,481 INFO core: Event loop thread started, running loop forever
2026-08-30 05:50:49,784 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 05:50:49,789 INFO core: _init_accounts coroutine started
2026-08-30 05:50:49,789 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 05:50:49,800 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:55:29,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 05:55:29,529 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 05:55:29,533 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 06:00:36,462 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 06:00:36,466 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 06:00:36,500 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 06:00:45,553 INFO core: Event loop thread started, running loop forever
2026-08-30 06:00:45,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 06:00:45,863 INFO core: _init_accounts coroutine started
2026-08-30 06:00:45,864 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 06:00:45,877 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:05:43,947 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:05:43,948 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 06:05:43,948 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 06:10:44,737 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 06:10:44,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:15:37,432 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 06:15:37,437 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:20:29,468 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:25:07,860 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:30:19,989 INFO core: Event loop thread started, running loop forever
2026-08-30 06:30:20,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 06:30:20,297 INFO core: _init_accounts coroutine started
2026-08-30 06:30:20,297 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 06:30:20,312 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:35:10,921 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 06:35:10,922 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 06:35:10,927 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 06:35:10,928 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:40:40,188 INFO core: Event loop thread started, running loop forever
2026-08-30 06:40:40,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 06:40:40,493 INFO core: _init_accounts coroutine started
2026-08-30 06:40:40,494 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 06:40:40,510 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 06:40:40,510 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 06:40:40,512 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 06:40:40,515 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 06:40:40,516 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:45:18,136 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 06:45:18,136 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:45:18,137 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 06:50:44,496 INFO core: Event loop thread started, running loop forever
2026-08-30 06:50:44,797 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 06:50:44,803 INFO core: _init_accounts coroutine started
2026-08-30 06:50:44,804 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 06:50:44,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 06:55:05,152 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 06:55:05,220 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:00:49,537 INFO core: Event loop thread started, running loop forever
2026-08-30 07:00:49,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 07:00:49,845 INFO core: _init_accounts coroutine started
2026-08-30 07:00:49,845 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 07:00:49,854 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:05:41,212 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:10:38,510 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 07:10:38,510 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 07:10:38,517 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 07:10:38,518 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 07:10:38,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:15:54,581 INFO core: Event loop thread started, running loop forever
2026-08-30 07:15:54,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 07:15:54,887 INFO core: _init_accounts coroutine started
2026-08-30 07:15:54,888 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 07:15:54,892 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:20:39,368 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 07:20:39,374 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:25:53,551 INFO core: Event loop thread started, running loop forever
2026-08-30 07:25:53,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 07:25:53,860 INFO core: _init_accounts coroutine started
2026-08-30 07:25:53,861 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 07:25:53,870 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:30:23,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 07:30:23,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 07:30:23,388 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:35:07,836 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 07:35:07,854 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 07:35:07,875 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 07:35:07,876 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 07:35:07,877 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:40:12,869 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 07:40:12,870 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 07:40:12,874 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:45:08,379 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 07:45:08,380 WARNING core: Account 2: connect timed out after 35s
2026-08-30 07:45:08,381 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 07:45:08,381 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 07:45:08,382 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 07:45:08,385 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 07:45:15,883 INFO core: Event loop thread started, running loop forever
2026-08-30 07:45:16,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 07:45:16,188 INFO core: _init_accounts coroutine started
2026-08-30 07:45:16,189 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 07:45:16,194 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:50:21,901 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 07:50:21,901 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 07:50:21,904 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 07:50:21,908 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 07:50:21,910 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 07:55:27,468 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 07:55:51,202 INFO core: Event loop thread started, running loop forever
2026-08-30 07:55:51,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 07:55:51,509 INFO core: _init_accounts coroutine started
2026-08-30 07:55:51,509 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 07:55:51,520 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:00:34,439 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 08:00:34,440 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 08:00:34,456 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 08:00:34,461 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 08:00:34,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:05:51,196 INFO core: Event loop thread started, running loop forever
2026-08-30 08:05:51,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 08:05:51,502 INFO core: _init_accounts coroutine started
2026-08-30 08:05:51,503 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 08:05:51,512 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:10:11,127 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:15:18,493 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 08:15:28,260 INFO core: Event loop thread started, running loop forever
2026-08-30 08:15:28,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 08:15:28,568 INFO core: _init_accounts coroutine started
2026-08-30 08:15:28,569 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 08:15:28,583 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:20:35,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 08:20:50,784 INFO core: Event loop thread started, running loop forever
2026-08-30 08:20:51,085 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 08:20:51,088 INFO core: _init_accounts coroutine started
2026-08-30 08:20:51,088 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 08:20:51,099 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:25:46,807 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 08:25:46,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:25:46,809 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 08:25:46,811 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 08:30:19,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:35:25,423 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 08:35:25,455 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 08:35:36,870 INFO core: Event loop thread started, running loop forever
2026-08-30 08:35:37,171 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 08:35:37,176 INFO core: _init_accounts coroutine started
2026-08-30 08:35:37,177 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 08:35:37,188 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:35:37,195 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 08:35:37,195 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 08:40:11,954 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 08:40:11,961 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:45:18,447 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 08:45:45,254 INFO core: Event loop thread started, running loop forever
2026-08-30 08:45:45,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 08:45:45,561 INFO core: _init_accounts coroutine started
2026-08-30 08:45:45,561 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 08:45:45,568 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:50:06,159 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 08:50:06,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 08:55:10,287 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:00:32,778 INFO core: Event loop thread started, running loop forever
2026-08-30 09:00:33,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 09:00:33,085 INFO core: _init_accounts coroutine started
2026-08-30 09:00:33,085 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 09:00:33,106 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 09:00:33,107 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 09:00:33,108 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:05:39,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 09:05:39,387 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 09:05:39,388 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 09:05:39,388 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 09:05:39,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 09:05:39,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 09:05:49,260 INFO core: Event loop thread started, running loop forever
2026-08-30 09:05:49,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 09:05:49,568 INFO core: _init_accounts coroutine started
2026-08-30 09:05:49,568 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 09:05:49,575 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:10:37,148 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:15:44,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 09:15:44,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 09:15:44,393 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-30 09:15:44,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 09:15:44,394 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 09:15:44,394 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 09:15:44,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 09:15:44,394 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 09:15:44,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 09:15:45,714 INFO core: Event loop thread started, running loop forever
2026-08-30 09:15:46,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 09:15:46,020 INFO core: _init_accounts coroutine started
2026-08-30 09:15:46,020 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 09:15:46,032 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:20:29,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:25:52,203 INFO core: Event loop thread started, running loop forever
2026-08-30 09:25:52,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 09:25:52,511 INFO core: _init_accounts coroutine started
2026-08-30 09:25:52,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:25:52,516 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 09:30:31,463 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:35:24,900 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 09:35:24,913 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:40:12,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:45:37,981 INFO core: Event loop thread started, running loop forever
2026-08-30 09:45:38,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 09:45:38,289 INFO core: _init_accounts coroutine started
2026-08-30 09:45:38,289 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 09:45:38,297 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:50:45,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 09:50:46,641 INFO core: Event loop thread started, running loop forever
2026-08-30 09:50:46,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 09:50:46,947 INFO core: _init_accounts coroutine started
2026-08-30 09:50:46,948 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 09:50:46,961 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 09:55:17,791 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 09:55:17,811 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:00:51,527 INFO core: Event loop thread started, running loop forever
2026-08-30 10:00:51,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 10:00:51,833 INFO core: _init_accounts coroutine started
2026-08-30 10:00:51,833 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 10:00:51,838 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:05:53,058 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:05:53,063 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 10:10:26,725 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 10:10:26,730 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 10:10:26,734 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 10:10:26,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:15:05,264 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:20:11,236 INFO core: Event loop thread started, running loop forever
2026-08-30 10:20:11,379 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 10:20:11,380 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 10:20:11,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 10:20:11,545 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 10:20:11,551 INFO core: _init_accounts coroutine started
2026-08-30 10:20:11,552 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 10:20:11,559 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:25:17,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 10:25:47,326 INFO core: Event loop thread started, running loop forever
2026-08-30 10:25:47,627 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 10:25:47,631 INFO core: _init_accounts coroutine started
2026-08-30 10:25:47,631 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 10:25:47,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:30:57,674 INFO core: Event loop thread started, running loop forever
2026-08-30 10:30:57,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 10:30:57,979 INFO core: _init_accounts coroutine started
2026-08-30 10:30:57,980 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 10:30:57,990 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:35:45,853 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 10:35:45,854 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 10:35:45,873 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 10:35:45,886 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 10:35:45,904 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 10:35:45,905 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 10:35:45,910 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 10:35:45,911 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 10:35:45,917 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:40:17,178 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 10:40:17,179 WARNING core: Account 2: connect timed out after 35s
2026-08-30 10:40:17,180 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 10:40:17,180 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 10:40:17,181 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 10:40:17,182 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 10:40:17,182 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-30 10:40:17,185 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:45:08,595 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 10:45:08,596 WARNING core: Account 2: connect timed out after 35s
2026-08-30 10:45:08,596 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-30 10:45:08,597 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-30 10:45:08,597 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 10:45:08,598 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-30 10:45:08,600 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-30 10:45:08,628 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:50:15,403 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 10:50:15,404 WARNING core: Account 2: connect timed out after 35s
2026-08-30 10:50:15,405 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-08-30 10:50:15,405 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-08-30 10:50:15,406 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 10:50:15,406 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-08-30 10:50:15,407 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-08-30 10:50:34,630 INFO core: Event loop thread started, running loop forever
2026-08-30 10:50:34,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 10:50:34,936 INFO core: _init_accounts coroutine started
2026-08-30 10:50:34,937 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 10:50:34,942 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 10:55:20,903 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:00:26,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 11:00:33,843 INFO core: Event loop thread started, running loop forever
2026-08-30 11:00:34,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 11:00:34,150 INFO core: _init_accounts coroutine started
2026-08-30 11:00:34,152 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 11:00:34,162 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:05:37,294 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:10:44,280 INFO core: Event loop thread started, running loop forever
2026-08-30 11:10:44,273 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 11:10:44,582 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 11:10:44,586 INFO core: _init_accounts coroutine started
2026-08-30 11:10:44,588 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 11:10:44,602 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:15:47,633 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:20:07,200 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 11:20:07,236 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:25:12,067 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:30:44,962 INFO core: Event loop thread started, running loop forever
2026-08-30 11:30:45,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 11:30:45,270 INFO core: _init_accounts coroutine started
2026-08-30 11:30:45,271 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 11:30:45,289 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:35:21,949 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 11:35:21,950 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 11:35:21,952 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 11:35:21,956 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 11:35:21,959 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:40:27,481 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 11:40:27,482 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 11:40:27,482 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 11:40:47,608 INFO core: Event loop thread started, running loop forever
2026-08-30 11:40:47,910 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 11:40:47,914 INFO core: _init_accounts coroutine started
2026-08-30 11:40:47,915 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 11:40:47,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:45:42,368 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 11:45:42,386 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:50:47,971 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 11:55:39,383 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-30 11:55:39,385 INFO core: _init_accounts coroutine started
2026-08-30 11:55:39,385 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 11:55:39,388 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:00:45,727 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 12:00:45,736 INFO core: Event loop thread started, running loop forever
2026-08-30 12:00:46,041 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 12:00:46,049 INFO core: _init_accounts coroutine started
2026-08-30 12:00:46,049 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 12:00:46,064 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:00:46,065 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 12:00:46,066 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 12:05:13,980 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 12:05:13,986 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 12:05:13,999 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:10:26,626 INFO core: Event loop thread started, running loop forever
2026-08-30 12:10:26,927 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 12:10:26,931 INFO core: _init_accounts coroutine started
2026-08-30 12:10:26,933 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 12:10:26,944 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:15:06,303 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 12:15:06,303 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 12:15:06,307 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 12:15:06,311 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 12:15:06,323 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:20:07,656 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 12:20:07,657 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:20:07,658 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 12:25:11,716 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 12:25:11,726 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 12:25:11,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:30:18,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 12:30:18,418 WARNING core: Account 2: connect timed out after 35s
2026-08-30 12:30:18,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 12:30:18,419 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 12:30:18,420 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 12:30:18,422 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 12:30:18,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-30 12:30:41,449 INFO core: Event loop thread started, running loop forever
2026-08-30 12:30:41,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 12:30:41,755 INFO core: _init_accounts coroutine started
2026-08-30 12:30:41,756 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 12:30:41,764 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:35:52,780 INFO core: Event loop thread started, running loop forever
2026-08-30 12:35:53,083 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 12:35:53,087 INFO core: _init_accounts coroutine started
2026-08-30 12:35:53,088 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 12:35:53,099 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:40:15,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:45:36,481 INFO core: Event loop thread started, running loop forever
2026-08-30 12:45:36,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 12:45:36,787 INFO core: _init_accounts coroutine started
2026-08-30 12:45:36,789 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 12:45:36,803 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 12:45:36,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:45:36,804 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 12:50:09,162 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 12:50:09,193 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 12:55:47,697 INFO core: Event loop thread started, running loop forever
2026-08-30 12:55:47,999 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 12:55:48,003 INFO core: _init_accounts coroutine started
2026-08-30 12:55:48,005 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 12:55:48,036 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 12:55:48,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 12:55:48,037 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:00:24,319 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 13:00:24,331 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 13:00:24,335 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:05:30,362 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:10:18,895 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 13:10:18,896 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 13:10:18,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:15:24,453 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 13:15:54,148 INFO core: Event loop thread started, running loop forever
2026-08-30 13:15:54,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 13:15:54,454 INFO core: _init_accounts coroutine started
2026-08-30 13:15:54,454 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 13:15:54,468 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:15:54,470 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 13:15:54,470 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 13:20:25,364 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 13:20:25,367 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:25:31,491 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 13:25:31,493 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 13:25:42,200 INFO core: Event loop thread started, running loop forever
2026-08-30 13:25:42,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 13:25:42,507 INFO core: _init_accounts coroutine started
2026-08-30 13:25:42,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 13:25:42,515 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:30:34,692 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:35:49,579 INFO core: Event loop thread started, running loop forever
2026-08-30 13:35:49,880 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 13:35:49,886 INFO core: _init_accounts coroutine started
2026-08-30 13:35:49,886 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 13:35:49,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:40:22,865 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 13:40:22,866 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 13:40:22,867 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 13:40:22,870 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 13:40:22,876 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:45:26,992 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:50:44,817 INFO core: Event loop thread started, running loop forever
2026-08-30 13:50:45,118 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 13:50:45,122 INFO core: _init_accounts coroutine started
2026-08-30 13:50:45,123 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 13:50:45,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 13:55:33,790 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:00:54,172 INFO core: Event loop thread started, running loop forever
2026-08-30 14:00:54,472 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 14:00:54,478 INFO core: _init_accounts coroutine started
2026-08-30 14:00:54,479 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 14:00:54,489 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:05:17,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 14:05:17,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 14:05:17,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 14:05:17,409 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:10:14,428 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 14:10:14,443 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 14:10:14,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 14:10:14,448 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 14:10:14,449 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 14:10:14,452 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:15:07,736 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 14:15:07,738 WARNING core: Account 2: connect timed out after 35s
2026-08-30 14:15:07,739 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 14:15:07,739 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 14:15:07,740 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 14:15:07,742 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 14:15:07,742 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-30 14:15:07,751 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:20:14,396 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 14:20:14,397 WARNING core: Account 2: connect timed out after 35s
2026-08-30 14:20:14,398 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-30 14:20:14,399 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-30 14:20:14,399 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 14:20:14,401 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-30 14:20:14,401 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-30 14:20:19,771 INFO core: Event loop thread started, running loop forever
2026-08-30 14:20:20,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 14:20:20,081 INFO core: _init_accounts coroutine started
2026-08-30 14:20:20,081 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 14:20:20,095 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:25:09,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:30:15,434 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 14:30:15,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 14:30:15,435 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-30 14:30:15,437 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 14:30:15,437 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 14:30:15,437 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 14:30:15,437 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 14:30:15,438 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 14:30:15,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 14:30:44,803 INFO core: Event loop thread started, running loop forever
2026-08-30 14:30:45,104 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 14:30:45,108 INFO core: _init_accounts coroutine started
2026-08-30 14:30:45,110 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 14:30:45,120 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:35:06,025 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 14:35:06,026 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 14:35:06,029 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:40:13,457 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 14:40:13,457 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-30 14:40:13,458 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 14:40:13,459 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-08-30 14:40:13,459 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 14:40:13,459 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-30 14:40:38,957 INFO core: Event loop thread started, running loop forever
2026-08-30 14:40:39,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 14:40:39,262 INFO core: _init_accounts coroutine started
2026-08-30 14:40:39,264 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 14:40:39,285 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:45:07,106 INFO core: Event loop thread started, running loop forever
2026-08-30 14:45:07,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 14:45:07,411 INFO core: _init_accounts coroutine started
2026-08-30 14:45:07,413 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 14:45:07,424 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:50:08,491 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 14:50:08,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 14:55:15,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 14:55:15,448 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-30 14:55:15,451 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 14:55:30,473 INFO core: Event loop thread started, running loop forever
2026-08-30 14:55:30,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 14:55:30,779 INFO core: _init_accounts coroutine started
2026-08-30 14:55:30,780 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 14:55:30,792 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:00:48,662 INFO core: Event loop thread started, running loop forever
2026-08-30 15:00:48,963 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 15:00:48,968 INFO core: _init_accounts coroutine started
2026-08-30 15:00:48,968 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 15:00:48,982 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:05:49,958 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 15:05:49,958 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 15:05:49,965 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 15:05:49,966 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 15:05:49,984 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:10:46,938 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 15:10:46,943 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 15:10:46,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:15:04,490 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 15:15:04,492 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 15:15:04,514 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:20:11,434 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 15:20:22,848 INFO core: Event loop thread started, running loop forever
2026-08-30 15:20:23,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 15:20:23,156 INFO core: _init_accounts coroutine started
2026-08-30 15:20:23,157 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 15:20:23,165 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:25:43,322 INFO core: Event loop thread started, running loop forever
2026-08-30 15:25:43,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 15:25:43,630 INFO core: _init_accounts coroutine started
2026-08-30 15:25:43,630 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 15:25:43,645 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:30:29,434 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 15:30:29,451 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:35:05,400 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:40:38,722 INFO core: Event loop thread started, running loop forever
2026-08-30 15:40:39,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 15:40:39,029 INFO core: _init_accounts coroutine started
2026-08-30 15:40:39,030 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 15:40:39,038 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:45:07,815 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:50:45,850 INFO core: Event loop thread started, running loop forever
2026-08-30 15:50:46,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 15:50:46,158 INFO core: _init_accounts coroutine started
2026-08-30 15:50:46,159 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 15:50:46,168 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:55:42,557 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 15:55:42,558 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 15:55:42,561 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 15:55:42,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 15:55:42,564 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 16:00:27,091 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:05:40,519 INFO core: Event loop thread started, running loop forever
2026-08-30 16:05:40,822 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 16:05:40,829 INFO core: _init_accounts coroutine started
2026-08-30 16:05:40,830 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 16:05:40,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:10:28,230 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 16:10:28,231 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 16:10:28,235 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 16:10:28,237 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:15:30,143 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 16:15:30,150 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:20:18,414 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:25:08,775 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 16:25:08,776 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 16:25:08,788 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 16:25:08,789 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 16:25:08,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:30:10,554 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 16:30:10,555 WARNING core: Account 2: connect timed out after 35s
2026-08-30 16:30:10,556 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 16:30:10,558 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 16:30:10,559 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 16:30:10,562 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 16:30:10,562 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-30 16:30:10,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:30:13,605 INFO telethon.network.mtprotosender: Connection to 91.108.56.181:443/TcpAbridged complete!
2026-08-30 16:35:43,175 INFO core: Event loop thread started, running loop forever
2026-08-30 16:35:43,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 16:35:43,481 INFO core: _init_accounts coroutine started
2026-08-30 16:35:43,483 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 16:35:43,490 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:40:36,590 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:45:25,432 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 16:45:25,432 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 16:45:25,435 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 16:45:25,438 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 16:45:25,441 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:50:27,431 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 16:55:32,905 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:00:38,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 17:00:54,281 INFO core: Event loop thread started, running loop forever
2026-08-30 17:00:54,582 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 17:00:54,587 INFO core: _init_accounts coroutine started
2026-08-30 17:00:54,588 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 17:00:54,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:05:28,987 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 17:05:29,007 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:10:23,524 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-30 17:10:23,525 INFO core: _init_accounts coroutine started
2026-08-30 17:10:23,526 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 17:10:23,535 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:15:17,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 17:15:17,404 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 17:15:17,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 17:15:17,406 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:20:24,475 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 17:20:24,477 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 17:20:24,478 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 17:20:24,478 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 17:20:33,956 INFO core: Event loop thread started, running loop forever
2026-08-30 17:20:34,257 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 17:20:34,263 INFO core: _init_accounts coroutine started
2026-08-30 17:20:34,264 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 17:20:34,273 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:25:11,143 INFO core: Event loop thread started, running loop forever
2026-08-30 17:25:11,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 17:25:11,454 INFO core: _init_accounts coroutine started
2026-08-30 17:25:11,455 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 17:25:11,462 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:25:41,178 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 17:30:13,432 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 17:30:13,463 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:35:37,101 INFO core: Event loop thread started, running loop forever
2026-08-30 17:35:37,402 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 17:35:37,406 INFO core: _init_accounts coroutine started
2026-08-30 17:35:37,407 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 17:35:37,419 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:40:07,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:45:13,498 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 17:45:13,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 17:45:13,499 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-30 17:45:13,500 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 17:45:13,500 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 17:45:13,500 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 17:45:13,500 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 17:45:13,501 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 17:45:13,501 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 17:45:44,115 INFO core: Event loop thread started, running loop forever
2026-08-30 17:45:44,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 17:45:44,421 INFO core: _init_accounts coroutine started
2026-08-30 17:45:44,421 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 17:45:44,434 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:50:47,842 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 17:55:39,309 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 17:55:39,309 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 17:55:39,330 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:00:52,161 INFO core: Event loop thread started, running loop forever
2026-08-30 18:00:52,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 18:00:52,468 INFO core: _init_accounts coroutine started
2026-08-30 18:00:52,469 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 18:00:52,473 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:05:20,242 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:10:27,382 INFO core: Event loop thread started, running loop forever
2026-08-30 18:10:27,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 18:10:27,688 INFO core: _init_accounts coroutine started
2026-08-30 18:10:27,690 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 18:10:27,699 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:15:40,201 INFO core: Event loop thread started, running loop forever
2026-08-30 18:15:40,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 18:15:40,507 INFO core: _init_accounts coroutine started
2026-08-30 18:15:40,508 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 18:15:40,518 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:20:30,577 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 18:20:30,601 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:25:26,294 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:30:44,745 INFO core: Event loop thread started, running loop forever
2026-08-30 18:30:45,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 18:30:45,053 INFO core: _init_accounts coroutine started
2026-08-30 18:30:45,053 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 18:30:45,062 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:35:50,668 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 18:35:50,684 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:40:21,716 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:45:25,050 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-30 18:45:25,051 INFO core: _init_accounts coroutine started
2026-08-30 18:45:25,051 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 18:45:25,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:50:21,057 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 18:50:21,058 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 18:50:21,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 18:55:28,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 18:55:28,444 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 18:55:28,445 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 18:55:28,445 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 18:55:28,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 18:55:28,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 18:55:49,883 INFO core: Event loop thread started, running loop forever
2026-08-30 18:55:50,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 18:55:50,188 INFO core: _init_accounts coroutine started
2026-08-30 18:55:50,189 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 18:55:50,205 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:00:30,986 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 19:00:30,987 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 19:00:30,989 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 19:00:30,993 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 19:00:30,995 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:05:37,832 INFO core: Event loop thread started, running loop forever
2026-08-30 19:05:38,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 19:05:38,139 INFO core: _init_accounts coroutine started
2026-08-30 19:05:38,139 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 19:05:38,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:10:14,856 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 19:10:14,866 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:15:26,141 INFO core: Event loop thread started, running loop forever
2026-08-30 19:15:26,442 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 19:15:26,450 INFO core: _init_accounts coroutine started
2026-08-30 19:15:26,450 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 19:15:26,456 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:20:49,910 INFO core: Event loop thread started, running loop forever
2026-08-30 19:20:50,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 19:20:50,215 INFO core: _init_accounts coroutine started
2026-08-30 19:20:50,217 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 19:20:50,230 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:25:47,373 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 19:25:47,395 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:30:54,449 INFO core: Event loop thread started, running loop forever
2026-08-30 19:30:54,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 19:30:54,759 INFO core: _init_accounts coroutine started
2026-08-30 19:30:54,760 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 19:30:54,776 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 19:30:54,776 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 19:30:54,779 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 19:30:54,780 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 19:30:54,785 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:35:22,834 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:40:26,154 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 19:40:26,155 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 19:40:26,166 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-30 19:40:26,168 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-30 19:40:26,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:45:11,821 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 19:45:11,822 WARNING core: Account 2: connect timed out after 35s
2026-08-30 19:45:11,822 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-30 19:45:11,823 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-30 19:45:11,824 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 19:45:11,825 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-30 19:45:11,825 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-30 19:45:11,833 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:50:18,379 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-30 19:50:18,381 WARNING core: Account 2: connect timed out after 35s
2026-08-30 19:50:18,381 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-08-30 19:50:18,381 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-08-30 19:50:18,382 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-30 19:50:18,383 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-08-30 19:50:18,383 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-08-30 19:50:51,773 INFO core: Event loop thread started, running loop forever
2026-08-30 19:50:52,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 19:50:52,078 INFO core: _init_accounts coroutine started
2026-08-30 19:50:52,079 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 19:50:52,106 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 19:55:33,616 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 19:55:33,618 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 19:55:33,618 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:00:14,444 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 20:00:14,458 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:05:08,099 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 20:05:08,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:10:14,482 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-30 20:10:14,483 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 20:10:14,483 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 20:10:38,258 INFO core: Event loop thread started, running loop forever
2026-08-30 20:10:38,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 20:10:38,565 INFO core: _init_accounts coroutine started
2026-08-30 20:10:38,573 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 20:10:38,577 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:15:07,363 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 20:15:07,380 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:20:28,789 INFO core: Event loop thread started, running loop forever
2026-08-30 20:20:29,090 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 20:20:29,094 INFO core: _init_accounts coroutine started
2026-08-30 20:20:29,096 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 20:20:29,108 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:25:35,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 20:25:35,852 INFO core: Event loop thread started, running loop forever
2026-08-30 20:25:36,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 20:25:36,159 INFO core: _init_accounts coroutine started
2026-08-30 20:25:36,159 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 20:25:36,170 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:30:43,423 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 20:30:43,599 INFO core: Event loop thread started, running loop forever
2026-08-30 20:30:43,901 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 20:30:43,908 INFO core: _init_accounts coroutine started
2026-08-30 20:30:43,908 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 20:30:43,914 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:35:18,793 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 20:35:18,808 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:40:50,006 INFO core: Event loop thread started, running loop forever
2026-08-30 20:40:50,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 20:40:50,312 INFO core: _init_accounts coroutine started
2026-08-30 20:40:50,313 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 20:40:50,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:45:09,649 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 20:45:09,650 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 20:45:09,655 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 20:45:09,665 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:50:15,484 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 20:50:15,485 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 20:50:23,505 INFO core: Event loop thread started, running loop forever
2026-08-30 20:50:23,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 20:50:23,810 INFO core: _init_accounts coroutine started
2026-08-30 20:50:23,811 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 20:50:23,826 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 20:55:43,863 INFO core: Event loop thread started, running loop forever
2026-08-30 20:55:44,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 20:55:44,168 INFO core: _init_accounts coroutine started
2026-08-30 20:55:44,169 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 20:55:44,179 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:00:11,727 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 21:00:11,728 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 21:00:11,730 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:05:38,543 INFO core: Event loop thread started, running loop forever
2026-08-30 21:05:38,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 21:05:38,848 INFO core: _init_accounts coroutine started
2026-08-30 21:05:38,850 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 21:05:38,858 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:10:38,850 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 21:10:38,850 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 21:10:38,852 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 21:10:38,854 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 21:10:38,862 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:15:25,367 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:20:44,799 INFO core: Event loop thread started, running loop forever
2026-08-30 21:20:45,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 21:20:45,107 INFO core: _init_accounts coroutine started
2026-08-30 21:20:45,107 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 21:20:45,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:25:14,053 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:25:14,056 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 21:30:21,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 21:30:21,397 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-30 21:30:26,056 INFO core: Event loop thread started, running loop forever
2026-08-30 21:30:26,358 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 21:30:26,363 INFO core: _init_accounts coroutine started
2026-08-30 21:30:26,364 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 21:30:26,373 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:35:15,164 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 21:35:15,165 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 21:35:15,166 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:40:22,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 21:40:22,387 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-30 21:40:22,387 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 21:40:22,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-30 21:40:22,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-30 21:40:22,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 21:40:37,706 INFO core: Event loop thread started, running loop forever
2026-08-30 21:40:38,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 21:40:38,011 INFO core: _init_accounts coroutine started
2026-08-30 21:40:38,011 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 21:40:38,026 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:45:26,374 INFO core: Event loop thread started, running loop forever
2026-08-30 21:45:26,675 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 21:45:26,679 INFO core: _init_accounts coroutine started
2026-08-30 21:45:26,679 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 21:45:26,700 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:45:45,395 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 21:50:32,495 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 21:50:37,989 INFO core: Event loop thread started, running loop forever
2026-08-30 21:50:38,294 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 21:50:38,299 INFO core: _init_accounts coroutine started
2026-08-30 21:50:38,299 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 21:50:38,307 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 21:55:37,630 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:00:44,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 22:00:48,369 INFO core: Event loop thread started, running loop forever
2026-08-30 22:00:48,670 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 22:00:48,674 INFO core: _init_accounts coroutine started
2026-08-30 22:00:48,675 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 22:00:48,686 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:05:49,306 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 22:05:49,321 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:10:38,739 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:15:14,904 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-30 22:15:14,905 INFO core: _init_accounts coroutine started
2026-08-30 22:15:14,906 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 22:15:14,914 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 22:15:14,915 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 22:15:14,916 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 22:15:14,917 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 22:15:14,936 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:20:36,764 INFO core: Event loop thread started, running loop forever
2026-08-30 22:20:37,065 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 22:20:37,071 INFO core: _init_accounts coroutine started
2026-08-30 22:20:37,072 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 22:20:37,084 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:25:43,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 22:25:51,415 INFO core: Event loop thread started, running loop forever
2026-08-30 22:25:51,716 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 22:25:51,720 INFO core: _init_accounts coroutine started
2026-08-30 22:25:51,721 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 22:25:51,728 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:30:20,675 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:35:26,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 22:35:26,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 22:35:26,437 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-30 22:35:47,039 INFO core: Event loop thread started, running loop forever
2026-08-30 22:35:47,340 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 22:35:47,344 INFO core: _init_accounts coroutine started
2026-08-30 22:35:47,344 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 22:35:47,357 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:40:41,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 22:40:41,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 22:40:41,439 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:40:41,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 22:45:23,682 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 22:45:23,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:50:32,213 INFO core: Event loop thread started, running loop forever
2026-08-30 22:50:32,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 22:50:32,519 INFO core: _init_accounts coroutine started
2026-08-30 22:50:32,520 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 22:50:32,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 22:55:39,413 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 22:55:51,745 INFO core: Event loop thread started, running loop forever
2026-08-30 22:55:52,046 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 22:55:52,051 INFO core: _init_accounts coroutine started
2026-08-30 22:55:52,053 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 22:55:52,060 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:00:36,104 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:00:36,115 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 23:00:36,115 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 23:00:36,116 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 23:05:05,813 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 23:05:05,814 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:10:13,189 INFO core: Event loop thread started, running loop forever
2026-08-30 23:10:13,490 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 23:10:13,494 INFO core: _init_accounts coroutine started
2026-08-30 23:10:13,496 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 23:10:13,502 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:15:20,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-30 23:15:32,606 INFO core: Event loop thread started, running loop forever
2026-08-30 23:15:32,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 23:15:32,912 INFO core: _init_accounts coroutine started
2026-08-30 23:15:32,913 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 23:15:32,925 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:20:26,580 INFO core: Event loop thread started, running loop forever
2026-08-30 23:20:26,883 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 23:20:26,887 INFO core: _init_accounts coroutine started
2026-08-30 23:20:26,888 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 23:20:26,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:25:30,605 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:30:12,263 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-30 23:30:12,264 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-30 23:30:12,277 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-30 23:30:12,281 INFO core: _init_accounts_inner: reloading LLM config
2026-08-30 23:30:12,283 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:35:37,042 INFO core: Event loop thread started, running loop forever
2026-08-30 23:35:37,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 23:35:37,362 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:40:44,448 INFO core: _init_accounts coroutine started
2026-08-30 23:40:44,448 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 23:40:44,449 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-30 23:40:47,892 INFO core: Event loop thread started, running loop forever
2026-08-30 23:40:48,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 23:40:48,198 INFO core: _init_accounts coroutine started
2026-08-30 23:40:48,199 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 23:40:48,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:45:55,809 INFO core: Event loop thread started, running loop forever
2026-08-30 23:45:56,110 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-30 23:45:56,114 INFO core: _init_accounts coroutine started
2026-08-30 23:45:56,115 INFO core: _init_accounts_inner: starting DB migrations
2026-08-30 23:45:56,122 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:50:17,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-30 23:55:10,519 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-30 23:55:10,532 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:00:30,878 INFO core: Event loop thread started, running loop forever
2026-08-31 00:00:31,179 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 00:00:31,183 INFO core: _init_accounts coroutine started
2026-08-31 00:00:31,184 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 00:00:31,197 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:05:21,305 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 00:05:21,306 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 00:05:21,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:10:10,378 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 00:10:10,383 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 00:10:10,391 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:15:17,440 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 00:15:17,441 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 00:15:17,441 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 00:15:23,615 INFO core: Event loop thread started, running loop forever
2026-08-31 00:15:23,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 00:15:23,922 INFO core: _init_accounts coroutine started
2026-08-31 00:15:23,924 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 00:15:23,933 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:20:28,102 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:25:35,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 00:25:35,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 00:25:35,384 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-31 00:25:35,384 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 00:25:35,384 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 00:25:35,385 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 00:25:35,385 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 00:25:35,385 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 00:25:35,385 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 00:25:41,739 INFO core: Event loop thread started, running loop forever
2026-08-31 00:25:42,040 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 00:25:42,056 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:30:32,087 INFO core: _init_accounts coroutine started
2026-08-31 00:30:32,088 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 00:30:32,100 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:35:12,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:40:18,464 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 00:40:18,465 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 00:40:18,466 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-31 00:40:18,467 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 00:40:18,467 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 00:40:18,467 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 00:40:18,468 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 00:40:34,520 INFO core: Event loop thread started, running loop forever
2026-08-31 00:40:34,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 00:40:34,835 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:45:17,562 INFO core: _init_accounts coroutine started
2026-08-31 00:45:17,565 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 00:45:17,581 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 00:45:17,581 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 00:45:17,581 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:50:10,698 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 00:50:10,704 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 00:50:10,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 00:55:16,517 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 00:55:16,519 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 00:55:16,520 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 00:55:45,207 INFO core: Event loop thread started, running loop forever
2026-08-31 00:55:45,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 00:55:45,518 INFO core: _init_accounts coroutine started
2026-08-31 00:55:45,518 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 00:55:45,537 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:00:31,616 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:00:31,621 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 01:00:31,622 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 01:05:09,896 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 01:05:09,926 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:10:47,933 INFO core: Event loop thread started, running loop forever
2026-08-31 01:10:48,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 01:10:48,238 INFO core: _init_accounts coroutine started
2026-08-31 01:10:48,239 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 01:10:48,254 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:10:48,258 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 01:10:48,258 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 01:15:34,128 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 01:15:34,134 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:15:34,135 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 01:20:41,494 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 01:20:41,495 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 01:20:41,495 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 01:20:47,409 INFO core: Event loop thread started, running loop forever
2026-08-31 01:20:47,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 01:20:47,721 INFO core: _init_accounts coroutine started
2026-08-31 01:20:47,724 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:20:47,724 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 01:25:36,104 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:30:43,559 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 01:30:53,287 INFO core: Event loop thread started, running loop forever
2026-08-31 01:30:53,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 01:30:53,598 INFO core: _init_accounts coroutine started
2026-08-31 01:30:53,598 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 01:30:53,606 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:35:54,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:40:29,423 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 01:40:29,424 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 01:40:29,428 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 01:40:29,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:45:22,642 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 01:45:22,654 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:50:08,081 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 01:55:15,580 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 01:55:15,580 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 01:55:15,581 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 01:55:52,003 INFO core: Event loop thread started, running loop forever
2026-08-31 01:55:52,306 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 01:55:52,313 INFO core: _init_accounts coroutine started
2026-08-31 01:55:52,314 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 01:55:52,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:00:27,915 INFO core: Event loop thread started, running loop forever
2026-08-31 02:00:28,224 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 02:00:28,235 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:05:34,444 INFO core: _init_accounts coroutine started
2026-08-31 02:05:34,445 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 02:05:40,959 INFO core: Event loop thread started, running loop forever
2026-08-31 02:05:41,261 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 02:05:41,269 INFO core: _init_accounts coroutine started
2026-08-31 02:05:41,270 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 02:05:41,276 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:10:55,394 INFO core: Event loop thread started, running loop forever
2026-08-31 02:10:55,695 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 02:10:55,698 INFO core: _init_accounts coroutine started
2026-08-31 02:10:55,699 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 02:10:55,709 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:15:29,155 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 02:15:29,156 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:15:29,157 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 02:20:41,621 INFO core: Event loop thread started, running loop forever
2026-08-31 02:20:41,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 02:20:41,928 INFO core: _init_accounts coroutine started
2026-08-31 02:20:41,929 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 02:20:41,941 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:25:22,912 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:30:28,509 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 02:30:47,456 INFO core: Event loop thread started, running loop forever
2026-08-31 02:30:47,757 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 02:30:47,761 INFO core: _init_accounts coroutine started
2026-08-31 02:30:47,763 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 02:30:47,776 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:35:19,557 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:35:19,560 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 02:40:13,754 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 02:40:13,788 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:45:19,544 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 02:45:19,548 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 02:45:19,549 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 02:45:19,549 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 02:45:19,549 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 02:45:19,550 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 02:45:46,621 INFO core: Event loop thread started, running loop forever
2026-08-31 02:45:46,923 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 02:45:46,927 INFO core: _init_accounts coroutine started
2026-08-31 02:45:46,929 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 02:45:46,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:50:29,903 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 02:50:29,929 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 02:55:08,288 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:00:24,296 INFO core: Event loop thread started, running loop forever
2026-08-31 03:00:24,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 03:00:24,602 INFO core: _init_accounts coroutine started
2026-08-31 03:00:24,602 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 03:00:24,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:05:31,460 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 03:05:34,989 INFO core: Event loop thread started, running loop forever
2026-08-31 03:05:35,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 03:05:35,294 INFO core: _init_accounts coroutine started
2026-08-31 03:05:35,295 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 03:05:35,318 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:10:23,545 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:15:27,806 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 03:15:27,809 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 03:15:27,815 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:20:07,595 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 03:20:07,601 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:25:11,916 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 03:25:11,919 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 03:25:11,940 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:30:48,974 INFO core: Event loop thread started, running loop forever
2026-08-31 03:30:49,275 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 03:30:49,279 INFO core: _init_accounts coroutine started
2026-08-31 03:30:49,281 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 03:30:49,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:35:17,616 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 03:35:17,618 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 03:35:17,624 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 03:35:17,629 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 03:35:17,645 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 03:35:17,645 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 03:35:17,651 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-31 03:35:17,652 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-31 03:35:17,669 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:40:24,405 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-31 03:40:24,407 WARNING core: Account 2: connect timed out after 35s
2026-08-31 03:40:24,408 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-31 03:40:24,408 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-31 03:40:24,409 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-31 03:40:24,411 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-31 03:40:24,411 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-31 03:40:47,502 INFO core: Event loop thread started, running loop forever
2026-08-31 03:40:47,810 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 03:40:47,816 INFO core: _init_accounts coroutine started
2026-08-31 03:40:47,817 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 03:40:47,835 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:45:45,794 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 03:45:45,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 03:45:45,800 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:50:11,249 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 03:50:11,253 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 03:50:11,260 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 03:55:13,493 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:00:20,468 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 04:00:20,471 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 04:00:20,472 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 04:00:38,321 INFO core: Event loop thread started, running loop forever
2026-08-31 04:00:38,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 04:00:38,626 INFO core: _init_accounts coroutine started
2026-08-31 04:00:38,631 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 04:00:38,635 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:05:45,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 04:05:50,903 INFO core: Event loop thread started, running loop forever
2026-08-31 04:05:51,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 04:05:51,208 INFO core: _init_accounts coroutine started
2026-08-31 04:05:51,209 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 04:05:51,220 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:10:22,967 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:15:10,413 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 04:15:10,414 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 04:15:10,415 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-31 04:15:10,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 04:15:10,416 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 04:15:10,416 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 04:15:10,416 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 04:15:10,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 04:15:10,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 04:15:40,957 INFO core: Event loop thread started, running loop forever
2026-08-31 04:15:41,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 04:15:41,264 INFO core: _init_accounts coroutine started
2026-08-31 04:15:41,265 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 04:15:41,274 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:20:30,815 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:20:30,817 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 04:20:30,819 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 04:23:53,714 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 04:23:53,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:23:53,746 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 04:25:43,694 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:29:16,291 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 04:29:16,293 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 04:29:16,308 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-31 04:29:16,313 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-31 04:29:24,541 INFO telethon.network.mtprotosender: Connection to 91.108.56.178:443/TcpAbridged complete!
2026-08-31 04:30:36,302 WARNING core: Account 2: connect timed out after 35s
2026-08-31 04:30:36,307 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:35:42,424 WARNING core: Account 2: is_user_authorized timed out after 15s
2026-08-31 04:35:42,426 WARNING telethon.network.mtprotostate: Server sent a very old message with ID 7680110351213358081, ignoring (see FAQ for details)
2026-08-31 04:35:42,427 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-31 04:35:42,429 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-31 04:35:42,430 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-31 04:35:42,432 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-31 04:35:42,432 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-31 04:35:49,211 INFO core: Event loop thread started, running loop forever
2026-08-31 04:35:49,512 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 04:35:49,517 INFO core: _init_accounts coroutine started
2026-08-31 04:35:49,517 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 04:35:49,534 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:40:34,467 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:45:40,195 INFO core: Event loop thread started, running loop forever
2026-08-31 04:45:40,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 04:45:40,502 INFO core: _init_accounts coroutine started
2026-08-31 04:45:40,502 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 04:45:40,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:50:08,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 04:55:31,408 INFO core: Event loop thread started, running loop forever
2026-08-31 04:55:31,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 04:55:31,717 INFO core: _init_accounts coroutine started
2026-08-31 04:55:31,719 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 04:55:31,743 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:00:38,486 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 05:00:38,486 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 05:00:38,493 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 05:00:38,494 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 05:00:38,494 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 05:00:38,496 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 05:00:47,645 INFO core: Event loop thread started, running loop forever
2026-08-31 05:00:47,946 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 05:00:47,952 INFO core: _init_accounts coroutine started
2026-08-31 05:00:47,953 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 05:00:47,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:05:09,129 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 05:05:09,137 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 05:05:09,133 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:05:09,141 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 05:10:23,494 INFO core: Event loop thread started, running loop forever
2026-08-31 05:10:23,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 05:10:23,801 INFO core: _init_accounts coroutine started
2026-08-31 05:10:23,801 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 05:10:23,813 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:15:26,268 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:20:36,727 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:20:36,730 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 05:20:36,733 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 05:25:25,466 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 05:25:25,473 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 05:25:25,477 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:30:38,088 INFO core: Event loop thread started, running loop forever
2026-08-31 05:30:38,397 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 05:30:38,404 INFO core: _init_accounts coroutine started
2026-08-31 05:30:38,404 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 05:30:38,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:35:45,432 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 05:35:53,542 INFO core: Event loop thread started, running loop forever
2026-08-31 05:35:53,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 05:35:53,852 INFO core: _init_accounts coroutine started
2026-08-31 05:35:53,853 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 05:35:53,868 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:40:10,313 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 05:40:10,314 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 05:40:10,317 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 05:40:10,322 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 05:40:10,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:45:16,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 05:45:51,598 INFO core: Event loop thread started, running loop forever
2026-08-31 05:45:51,899 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 05:45:51,905 INFO core: _init_accounts coroutine started
2026-08-31 05:45:51,906 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 05:45:51,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:45:51,924 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 05:50:33,549 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 05:50:33,563 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 05:50:33,563 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 05:55:50,716 INFO core: Event loop thread started, running loop forever
2026-08-31 05:55:51,017 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 05:55:51,021 INFO core: _init_accounts coroutine started
2026-08-31 05:55:51,023 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 05:55:51,040 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:00:32,286 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:05:39,571 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 06:05:39,572 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 06:05:39,622 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 06:05:39,623 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 06:05:39,623 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 06:05:39,624 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 06:05:39,624 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 06:05:39,630 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 06:05:55,432 INFO core: Event loop thread started, running loop forever
2026-08-31 06:05:55,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 06:05:55,741 INFO core: _init_accounts coroutine started
2026-08-31 06:05:55,741 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 06:05:55,755 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:10:44,786 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 06:10:44,790 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 06:10:44,792 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:15:43,148 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 06:15:43,154 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 06:15:43,157 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:20:09,570 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 06:20:09,571 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 06:20:09,571 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:25:35,800 INFO core: Event loop thread started, running loop forever
2026-08-31 06:25:36,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 06:25:36,109 INFO core: _init_accounts coroutine started
2026-08-31 06:25:36,110 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 06:25:36,138 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:30:46,011 INFO core: Event loop thread started, running loop forever
2026-08-31 06:30:46,312 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 06:30:46,318 INFO core: _init_accounts coroutine started
2026-08-31 06:30:46,318 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 06:30:46,323 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:35:30,986 INFO core: Event loop thread started, running loop forever
2026-08-31 06:35:31,287 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 06:35:31,293 INFO core: _init_accounts coroutine started
2026-08-31 06:35:31,294 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 06:35:31,303 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:35:53,006 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 06:40:36,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:45:46,714 INFO core: Event loop thread started, running loop forever
2026-08-31 06:45:47,017 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 06:45:47,024 INFO core: _init_accounts coroutine started
2026-08-31 06:45:47,024 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 06:45:47,059 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:50:22,397 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 06:55:39,270 INFO core: Event loop thread started, running loop forever
2026-08-31 06:55:39,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 06:55:39,578 INFO core: _init_accounts coroutine started
2026-08-31 06:55:39,579 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 06:55:39,591 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:00:34,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 07:00:34,388 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 07:00:34,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 07:00:34,392 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 07:00:34,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:05:26,153 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 07:05:26,154 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 07:05:26,172 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-31 07:05:26,173 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-31 07:05:26,199 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:10:33,438 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-31 07:10:33,439 WARNING core: Account 2: connect timed out after 35s
2026-08-31 07:10:33,439 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-31 07:10:33,440 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-31 07:10:33,440 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-31 07:10:33,442 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-31 07:10:33,442 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-31 07:10:46,675 INFO core: Event loop thread started, running loop forever
2026-08-31 07:10:46,976 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 07:10:46,980 INFO core: _init_accounts coroutine started
2026-08-31 07:10:46,981 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 07:10:46,994 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:15:09,458 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 07:15:09,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:20:15,327 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:25:28,263 INFO core: Event loop thread started, running loop forever
2026-08-31 07:25:28,567 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 07:25:28,576 INFO core: _init_accounts coroutine started
2026-08-31 07:25:28,578 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 07:25:28,580 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:30:23,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:35:42,182 INFO core: Event loop thread started, running loop forever
2026-08-31 07:35:42,484 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 07:35:42,489 INFO core: _init_accounts coroutine started
2026-08-31 07:35:42,490 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 07:35:42,499 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:40:45,459 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:45:15,572 INFO core: Event loop thread started, running loop forever
2026-08-31 07:45:15,873 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 07:45:15,877 INFO core: _init_accounts coroutine started
2026-08-31 07:45:15,878 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 07:45:15,890 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:50:22,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 07:50:47,989 INFO core: Event loop thread started, running loop forever
2026-08-31 07:50:48,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 07:50:48,296 INFO core: _init_accounts coroutine started
2026-08-31 07:50:48,297 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 07:50:48,305 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 07:55:39,231 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:00:25,561 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 08:00:25,562 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 08:00:25,617 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 08:00:25,617 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:05:17,526 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 08:05:17,527 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:10:34,680 INFO core: Event loop thread started, running loop forever
2026-08-31 08:10:34,984 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 08:10:34,991 INFO core: _init_accounts coroutine started
2026-08-31 08:10:34,993 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 08:10:35,001 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:15:41,521 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 08:15:51,785 INFO core: Event loop thread started, running loop forever
2026-08-31 08:15:52,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 08:15:52,091 INFO core: _init_accounts coroutine started
2026-08-31 08:15:52,093 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 08:15:52,103 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:20:10,540 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:25:17,411 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 08:25:35,238 INFO core: Event loop thread started, running loop forever
2026-08-31 08:25:35,539 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 08:25:35,543 INFO core: _init_accounts coroutine started
2026-08-31 08:25:35,545 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 08:25:35,562 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:30:36,593 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:35:11,428 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:40:05,729 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 08:40:05,729 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 08:40:05,735 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:40:05,736 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 08:45:16,949 INFO core: Event loop thread started, running loop forever
2026-08-31 08:45:17,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 08:45:17,255 INFO core: _init_accounts coroutine started
2026-08-31 08:45:17,255 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 08:45:17,269 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:50:47,658 INFO core: Event loop thread started, running loop forever
2026-08-31 08:50:47,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 08:50:47,963 INFO core: _init_accounts coroutine started
2026-08-31 08:50:47,964 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 08:50:47,974 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:55:42,777 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 08:55:42,778 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 08:55:42,783 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 08:55:42,783 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 08:55:42,788 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 09:00:32,270 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:05:39,492 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 09:05:39,645 INFO core: Event loop thread started, running loop forever
2026-08-31 09:05:39,949 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 09:05:39,960 INFO core: _init_accounts coroutine started
2026-08-31 09:05:39,961 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 09:05:39,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:10:20,610 INFO core: Event loop thread started, running loop forever
2026-08-31 09:10:20,911 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 09:10:20,918 INFO core: _init_accounts coroutine started
2026-08-31 09:10:20,918 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 09:10:20,930 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 09:10:20,930 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 09:10:20,932 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 09:10:20,939 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 09:10:20,948 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:10:46,635 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 09:15:10,966 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 09:15:10,966 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 09:15:10,972 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-31 09:15:10,974 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-31 09:15:10,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:20:04,200 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-31 09:20:04,201 WARNING core: Account 2: connect timed out after 35s
2026-08-31 09:20:04,202 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-31 09:20:04,203 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-31 09:20:04,204 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-31 09:20:04,206 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-08-31 09:20:04,206 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-08-31 09:20:04,229 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:25:11,497 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-31 09:25:47,292 INFO core: Event loop thread started, running loop forever
2026-08-31 09:25:47,595 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 09:25:47,602 INFO core: _init_accounts coroutine started
2026-08-31 09:25:47,602 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 09:25:47,617 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:30:49,716 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 09:30:49,717 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 09:30:49,721 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 09:30:49,724 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 09:30:49,725 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:35:51,884 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:40:14,479 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:45:21,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 09:45:31,132 INFO core: Event loop thread started, running loop forever
2026-08-31 09:45:31,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 09:45:31,437 INFO core: _init_accounts coroutine started
2026-08-31 09:45:31,438 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 09:45:31,443 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:50:27,792 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 09:50:27,803 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 09:55:23,382 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:00:17,642 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-31 10:00:17,643 INFO core: _init_accounts coroutine started
2026-08-31 10:00:17,643 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 10:00:17,647 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:05:07,920 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:10:08,415 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:15:11,817 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 10:15:11,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 10:15:11,821 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:20:12,348 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 10:20:12,352 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 10:20:12,356 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:25:18,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:30:25,467 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 10:30:25,469 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 10:30:41,447 INFO core: Event loop thread started, running loop forever
2026-08-31 10:30:41,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 10:30:41,762 INFO core: _init_accounts coroutine started
2026-08-31 10:30:41,762 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 10:30:41,767 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:35:15,000 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:40:27,020 INFO core: Event loop thread started, running loop forever
2026-08-31 10:40:27,322 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 10:40:27,327 INFO core: _init_accounts coroutine started
2026-08-31 10:40:27,329 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 10:40:27,336 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:45:48,455 INFO core: Event loop thread started, running loop forever
2026-08-31 10:45:48,757 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 10:45:48,762 INFO core: _init_accounts coroutine started
2026-08-31 10:45:48,763 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 10:45:48,777 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:50:13,977 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 10:50:13,978 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 10:50:13,985 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 10:55:30,579 INFO core: Event loop thread started, running loop forever
2026-08-31 10:55:30,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 10:55:30,892 INFO core: _init_accounts coroutine started
2026-08-31 10:55:30,893 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 10:55:30,904 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:00:10,187 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 11:00:41,760 INFO core: Event loop thread started, running loop forever
2026-08-31 11:00:42,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 11:00:42,066 INFO core: _init_accounts coroutine started
2026-08-31 11:00:42,066 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 11:00:42,079 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:05:04,400 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 11:05:04,430 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:10:45,291 INFO core: Event loop thread started, running loop forever
2026-08-31 11:10:45,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 11:10:45,597 INFO core: _init_accounts coroutine started
2026-08-31 11:10:45,597 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 11:10:45,609 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:15:35,391 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:20:42,445 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 11:20:53,683 INFO core: Event loop thread started, running loop forever
2026-08-31 11:20:53,985 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 11:20:53,992 INFO core: _init_accounts coroutine started
2026-08-31 11:20:53,992 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 11:20:53,996 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:25:22,190 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:30:38,497 INFO core: Event loop thread started, running loop forever
2026-08-31 11:30:38,808 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 11:30:38,817 INFO core: _init_accounts coroutine started
2026-08-31 11:30:38,817 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 11:30:38,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:35:45,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 11:35:46,436 INFO core: Event loop thread started, running loop forever
2026-08-31 11:35:46,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 11:35:46,743 INFO core: _init_accounts coroutine started
2026-08-31 11:35:46,743 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 11:35:46,759 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:40:30,862 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 11:40:30,880 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:45:46,581 INFO core: Event loop thread started, running loop forever
2026-08-31 11:45:46,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 11:45:46,891 INFO core: _init_accounts coroutine started
2026-08-31 11:45:46,891 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 11:45:46,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:50:13,366 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 11:55:16,498 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 11:55:16,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:00:22,453 INFO core: Event loop thread started, running loop forever
2026-08-31 12:00:22,754 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 12:00:22,762 INFO core: _init_accounts coroutine started
2026-08-31 12:00:22,762 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 12:00:22,799 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 12:00:22,799 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 12:00:22,806 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:05:18,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:10:48,825 INFO core: Event loop thread started, running loop forever
2026-08-31 12:10:49,126 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 12:10:49,132 INFO core: _init_accounts coroutine started
2026-08-31 12:10:49,133 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 12:10:49,144 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:15:06,158 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:20:13,258 INFO core: Event loop thread started, running loop forever
2026-08-31 12:20:13,563 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 12:20:13,568 INFO core: _init_accounts coroutine started
2026-08-31 12:20:13,569 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 12:20:13,580 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:25:20,514 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 12:25:20,515 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 12:25:20,515 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-31 12:25:20,516 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 12:25:20,516 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 12:25:20,516 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 12:25:20,516 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 12:25:20,517 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 12:25:20,517 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 12:25:28,730 INFO core: Event loop thread started, running loop forever
2026-08-31 12:25:29,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 12:25:29,036 INFO core: _init_accounts coroutine started
2026-08-31 12:25:29,038 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 12:25:29,075 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:30:29,279 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 12:30:29,301 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:35:55,055 INFO core: Event loop thread started, running loop forever
2026-08-31 12:35:55,356 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 12:35:55,361 INFO core: _init_accounts coroutine started
2026-08-31 12:35:55,361 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 12:35:55,370 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:40:58,085 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:45:31,509 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 12:45:31,510 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 12:45:31,511 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 12:45:31,514 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 12:45:31,519 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:50:52,532 INFO core: Event loop thread started, running loop forever
2026-08-31 12:50:52,833 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 12:50:52,839 INFO core: _init_accounts coroutine started
2026-08-31 12:50:52,841 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 12:50:52,850 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 12:55:12,210 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:00:16,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 13:00:16,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 13:00:16,136 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:05:20,851 INFO core: Event loop thread started, running loop forever
2026-08-31 13:05:21,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 13:05:21,161 INFO core: _init_accounts coroutine started
2026-08-31 13:05:21,162 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 13:05:21,169 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:10:45,350 INFO core: Event loop thread started, running loop forever
2026-08-31 13:10:45,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 13:10:45,662 INFO core: _init_accounts coroutine started
2026-08-31 13:10:45,662 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 13:10:45,673 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 13:10:45,673 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 13:10:45,674 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 13:10:45,676 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 13:10:45,680 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:15:08,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 13:15:08,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 13:15:08,447 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-31 13:15:38,118 INFO core: Event loop thread started, running loop forever
2026-08-31 13:15:38,419 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 13:15:38,425 INFO core: _init_accounts coroutine started
2026-08-31 13:15:38,426 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 13:15:38,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:20:38,738 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:25:17,300 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 13:25:17,303 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 13:25:17,304 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:30:10,807 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:35:32,751 INFO core: Event loop thread started, running loop forever
2026-08-31 13:35:33,053 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 13:35:33,062 INFO core: _init_accounts coroutine started
2026-08-31 13:35:33,062 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 13:35:33,080 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:40:18,808 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 13:40:18,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:45:28,941 INFO core: Event loop thread started, running loop forever
2026-08-31 13:45:29,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 13:45:29,255 INFO core: _init_accounts coroutine started
2026-08-31 13:45:29,255 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 13:45:29,264 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:50:10,581 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 13:50:10,581 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 13:50:10,587 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 13:55:17,483 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 13:55:17,484 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 13:55:17,484 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 13:55:17,485 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 13:55:17,485 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 13:55:17,485 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 13:55:31,784 INFO core: Event loop thread started, running loop forever
2026-08-31 13:55:32,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 13:55:32,090 INFO core: _init_accounts coroutine started
2026-08-31 13:55:32,091 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 13:55:32,113 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:00:28,201 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:05:23,171 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:10:08,518 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 14:10:08,518 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 14:10:08,530 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 14:10:08,533 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 14:10:08,541 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:15:14,607 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 14:15:14,607 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 14:15:14,608 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 14:15:47,286 INFO core: Event loop thread started, running loop forever
2026-08-31 14:15:47,593 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 14:15:47,607 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:15:47,609 INFO core: _init_accounts coroutine started
2026-08-31 14:20:26,143 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 14:20:26,156 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 14:20:26,157 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 14:20:26,164 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 14:20:26,182 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 14:20:26,185 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:25:10,324 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:30:05,867 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 14:30:05,868 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 14:30:05,880 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-31 14:30:05,881 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-31 14:30:05,923 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:35:11,426 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-31 14:35:30,154 INFO core: Event loop thread started, running loop forever
2026-08-31 14:35:30,456 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 14:35:30,462 INFO core: _init_accounts coroutine started
2026-08-31 14:35:30,463 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 14:35:30,481 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:40:37,454 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 14:40:37,454 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 14:40:37,455 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-31 14:40:37,455 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 14:40:37,456 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 14:40:37,456 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 14:40:37,456 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 14:40:37,456 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 14:40:37,457 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 14:40:49,566 INFO core: Event loop thread started, running loop forever
2026-08-31 14:40:49,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 14:40:49,870 INFO core: _init_accounts coroutine started
2026-08-31 14:40:49,872 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 14:40:49,881 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:45:52,875 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 14:45:52,875 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 14:45:52,878 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:45:52,879 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 14:50:25,971 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 14:50:25,974 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 14:55:20,822 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:00:34,830 INFO core: Event loop thread started, running loop forever
2026-08-31 15:00:35,131 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 15:00:35,138 INFO core: _init_accounts coroutine started
2026-08-31 15:00:35,138 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 15:00:35,149 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:05:14,694 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:05:14,695 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 15:05:14,696 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 15:10:33,178 INFO core: Event loop thread started, running loop forever
2026-08-31 15:10:33,479 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 15:10:33,486 INFO core: _init_accounts coroutine started
2026-08-31 15:10:33,486 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 15:10:33,492 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:15:15,280 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:20:22,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 15:20:35,654 INFO core: Event loop thread started, running loop forever
2026-08-31 15:20:35,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 15:20:35,960 INFO core: _init_accounts coroutine started
2026-08-31 15:20:35,962 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 15:20:35,972 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:25:53,052 INFO core: Event loop thread started, running loop forever
2026-08-31 15:25:53,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 15:25:53,360 INFO core: _init_accounts coroutine started
2026-08-31 15:25:53,362 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 15:25:53,371 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:30:12,487 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 15:30:51,971 INFO core: Event loop thread started, running loop forever
2026-08-31 15:30:52,272 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 15:30:52,278 INFO core: _init_accounts coroutine started
2026-08-31 15:30:52,279 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 15:30:52,315 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:35:42,185 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:40:36,550 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 15:40:36,584 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:45:27,756 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:50:43,195 INFO core: Event loop thread started, running loop forever
2026-08-31 15:50:43,496 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 15:50:43,500 INFO core: _init_accounts coroutine started
2026-08-31 15:50:43,501 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 15:50:43,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 15:55:07,302 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:00:14,554 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 16:00:14,555 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 16:00:14,555 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-31 16:00:14,556 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 16:00:14,556 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-08-31 16:00:14,556 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 16:00:14,557 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-08-31 16:00:14,557 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 16:00:14,557 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-31 16:00:36,284 INFO core: Event loop thread started, running loop forever
2026-08-31 16:00:36,585 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 16:00:36,589 INFO core: _init_accounts coroutine started
2026-08-31 16:00:36,590 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 16:00:36,600 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:05:36,803 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 16:05:36,804 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 16:05:36,807 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 16:05:36,808 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 16:05:36,823 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:05:36,824 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 16:05:36,830 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 16:10:07,323 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-08-31 16:10:07,325 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-08-31 16:10:07,334 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:15:14,449 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-08-31 16:15:14,450 WARNING core: Account 2: connect timed out after 35s
2026-08-31 16:15:14,450 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-08-31 16:15:14,456 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-08-31 16:15:14,457 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-08-31 16:15:51,871 INFO core: Event loop thread started, running loop forever
2026-08-31 16:15:52,173 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 16:15:52,179 INFO core: _init_accounts coroutine started
2026-08-31 16:15:52,180 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 16:15:52,191 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:20:13,335 INFO core: Event loop thread started, running loop forever
2026-08-31 16:20:13,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 16:20:13,644 INFO core: _init_accounts coroutine started
2026-08-31 16:20:13,645 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 16:20:13,659 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:20:58,423 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 16:20:58,425 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 16:25:23,131 INFO core: Event loop thread started, running loop forever
2026-08-31 16:25:23,433 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 16:25:23,437 INFO core: _init_accounts coroutine started
2026-08-31 16:25:23,438 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 16:25:23,453 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:30:37,473 INFO core: Event loop thread started, running loop forever
2026-08-31 16:30:37,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 16:30:37,782 INFO core: _init_accounts coroutine started
2026-08-31 16:30:37,782 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 16:30:37,789 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:35:07,715 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 16:35:07,716 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 16:35:07,718 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:40:45,213 INFO core: Event loop thread started, running loop forever
2026-08-31 16:40:45,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 16:40:45,520 INFO core: _init_accounts coroutine started
2026-08-31 16:40:45,521 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 16:40:45,525 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:45:44,513 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:50:08,153 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:55:13,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 16:55:13,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 16:55:13,621 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 17:00:18,929 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 17:00:18,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:05:06,888 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 17:05:06,921 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:10:30,489 INFO core: Event loop thread started, running loop forever
2026-08-31 17:10:30,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 17:10:30,804 INFO core: _init_accounts coroutine started
2026-08-31 17:10:30,806 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 17:10:30,811 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:15:33,976 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:20:39,468 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 17:20:47,707 INFO core: Event loop thread started, running loop forever
2026-08-31 17:20:48,008 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 17:20:48,015 INFO core: _init_accounts coroutine started
2026-08-31 17:20:48,015 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 17:20:48,026 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 17:20:48,027 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 17:20:48,028 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 17:20:48,030 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 17:20:48,046 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:25:35,826 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 17:25:35,826 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 17:25:35,830 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:30:36,774 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 17:30:36,793 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:35:51,547 INFO core: Event loop thread started, running loop forever
2026-08-31 17:35:51,848 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 17:35:51,858 INFO core: _init_accounts coroutine started
2026-08-31 17:35:51,860 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 17:35:51,886 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 17:35:51,887 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 17:35:51,889 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 17:35:51,896 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 17:35:51,918 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:40:36,466 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:45:22,860 INFO core: Event loop thread started, running loop forever
2026-08-31 17:45:23,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 17:45:23,168 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:45:23,172 INFO core: _init_accounts coroutine started
2026-08-31 17:50:29,440 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 17:50:31,260 INFO core: Event loop thread started, running loop forever
2026-08-31 17:50:31,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 17:50:31,567 INFO core: _init_accounts coroutine started
2026-08-31 17:50:31,568 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 17:50:31,581 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 17:55:25,649 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:00:43,086 INFO core: Event loop thread started, running loop forever
2026-08-31 18:00:43,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 18:00:43,390 INFO core: _init_accounts coroutine started
2026-08-31 18:00:43,390 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 18:00:43,401 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:05:28,166 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 18:05:28,166 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 18:05:28,167 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 18:05:28,170 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 18:05:28,174 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:10:40,483 INFO core: Event loop thread started, running loop forever
2026-08-31 18:10:40,784 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 18:10:40,788 INFO core: _init_accounts coroutine started
2026-08-31 18:10:40,789 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 18:10:40,804 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:15:11,960 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 18:15:11,961 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 18:15:11,974 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 18:15:11,980 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:20:43,424 INFO core: Event loop thread started, running loop forever
2026-08-31 18:20:43,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 18:20:43,728 INFO core: _init_accounts coroutine started
2026-08-31 18:20:43,729 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 18:20:43,740 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:25:13,521 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 18:25:13,522 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 18:25:13,525 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 18:25:13,528 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 18:25:13,540 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:30:20,810 INFO core: Event loop thread started, running loop forever
2026-08-31 18:30:21,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 18:30:21,127 INFO core: _init_accounts coroutine started
2026-08-31 18:30:21,130 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 18:30:21,139 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:35:28,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 18:35:36,267 INFO core: Event loop thread started, running loop forever
2026-08-31 18:35:36,568 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 18:35:36,574 INFO core: _init_accounts coroutine started
2026-08-31 18:35:36,575 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 18:35:36,588 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:40:30,293 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:45:10,037 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 18:45:10,072 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:50:17,614 INFO core: Event loop thread started, running loop forever
2026-08-31 18:50:17,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 18:50:17,920 INFO core: _init_accounts coroutine started
2026-08-31 18:50:17,920 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 18:50:17,931 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 18:55:25,443 INFO core: Event loop thread started, running loop forever
2026-08-31 18:55:25,744 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 18:55:25,748 INFO core: _init_accounts coroutine started
2026-08-31 18:55:25,749 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 18:55:25,762 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:00:40,325 INFO core: Event loop thread started, running loop forever
2026-08-31 19:00:40,626 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 19:00:40,631 INFO core: _init_accounts coroutine started
2026-08-31 19:00:40,632 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 19:00:40,641 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:05:15,578 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 19:05:15,579 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 19:05:15,589 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:05:15,590 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 19:10:38,995 INFO core: Event loop thread started, running loop forever
2026-08-31 19:10:39,296 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 19:10:39,305 INFO core: _init_accounts coroutine started
2026-08-31 19:10:39,306 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 19:10:39,426 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 19:10:39,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 19:10:39,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 19:10:39,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:15:16,462 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 19:15:16,464 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:20:37,279 INFO core: Event loop thread started, running loop forever
2026-08-31 19:20:37,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 19:20:37,591 INFO core: _init_accounts coroutine started
2026-08-31 19:20:37,591 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 19:20:37,615 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:25:07,714 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:30:45,619 INFO core: Event loop thread started, running loop forever
2026-08-31 19:30:45,920 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 19:30:45,935 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:35:51,482 INFO core: _init_accounts coroutine started
2026-08-31 19:35:51,482 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 19:35:51,491 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 19:35:54,456 INFO core: Event loop thread started, running loop forever
2026-08-31 19:35:54,768 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 19:35:54,775 INFO core: _init_accounts coroutine started
2026-08-31 19:35:54,776 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 19:35:54,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:40:14,472 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 19:40:14,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 19:40:14,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 19:40:14,475 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:45:43,328 INFO core: Event loop thread started, running loop forever
2026-08-31 19:45:43,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 19:45:43,647 INFO core: _init_accounts coroutine started
2026-08-31 19:45:43,649 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 19:45:43,655 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:50:20,639 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 19:55:26,487 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 19:55:40,645 INFO core: Event loop thread started, running loop forever
2026-08-31 19:55:40,946 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 19:55:40,953 INFO core: _init_accounts coroutine started
2026-08-31 19:55:40,954 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 19:55:40,962 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:00:29,221 INFO core: Event loop thread started, running loop forever
2026-08-31 20:00:29,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 20:00:29,529 INFO core: _init_accounts coroutine started
2026-08-31 20:00:29,530 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 20:00:29,542 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:05:07,408 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:10:06,817 INFO core: Event loop thread started, running loop forever
2026-08-31 20:10:07,118 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 20:10:07,123 INFO core: _init_accounts coroutine started
2026-08-31 20:10:07,123 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 20:10:07,132 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:10:14,822 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 20:15:33,675 INFO core: Event loop thread started, running loop forever
2026-08-31 20:15:33,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 20:15:33,986 INFO core: _init_accounts coroutine started
2026-08-31 20:15:33,987 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 20:15:34,055 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:20:37,686 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 20:20:37,686 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 20:20:37,690 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 20:20:37,691 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:20:37,695 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 20:25:07,821 INFO core: Event loop thread started, running loop forever
2026-08-31 20:25:08,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 20:25:08,129 INFO core: _init_accounts coroutine started
2026-08-31 20:25:08,130 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 20:25:08,160 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:25:44,868 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 20:25:44,869 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 20:25:44,869 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 20:30:15,441 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 20:30:25,033 INFO core: Event loop thread started, running loop forever
2026-08-31 20:30:25,335 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 20:30:25,341 INFO core: _init_accounts coroutine started
2026-08-31 20:30:25,344 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 20:30:25,366 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:35:04,905 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:40:10,532 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 20:40:10,532 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 20:40:10,537 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 20:40:21,727 INFO core: Event loop thread started, running loop forever
2026-08-31 20:40:22,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 20:40:22,043 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:45:08,727 INFO core: _init_accounts coroutine started
2026-08-31 20:45:08,728 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 20:45:08,783 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 20:45:08,783 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 20:45:08,787 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:50:15,457 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 20:50:50,205 INFO core: Event loop thread started, running loop forever
2026-08-31 20:50:50,506 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 20:50:50,510 INFO core: _init_accounts coroutine started
2026-08-31 20:50:50,511 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 20:50:50,539 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 20:55:33,523 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 20:55:33,524 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 20:55:33,524 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:00:34,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 21:00:34,884 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 21:00:34,898 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:05:30,277 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:10:37,465 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 21:10:37,466 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 21:10:37,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 21:10:37,581 INFO core: Event loop thread started, running loop forever
2026-08-31 21:10:37,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 21:10:37,888 INFO core: _init_accounts coroutine started
2026-08-31 21:10:37,889 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 21:10:37,897 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:15:30,117 INFO core: Event loop thread started, running loop forever
2026-08-31 21:15:30,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 21:15:30,424 INFO core: _init_accounts coroutine started
2026-08-31 21:15:30,424 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 21:15:30,432 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:15:43,131 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 21:20:51,972 INFO core: Event loop thread started, running loop forever
2026-08-31 21:20:52,272 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 21:20:52,278 INFO core: _init_accounts coroutine started
2026-08-31 21:20:52,278 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 21:20:52,294 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 21:20:52,294 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 21:20:52,299 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 21:20:52,299 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:25:50,806 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 21:25:50,824 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:30:55,549 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:35:12,067 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:40:19,531 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 21:40:32,504 INFO core: Event loop thread started, running loop forever
2026-08-31 21:40:32,805 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 21:40:32,813 INFO core: _init_accounts coroutine started
2026-08-31 21:40:32,813 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 21:40:32,829 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:45:17,942 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 21:45:17,942 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 21:45:17,963 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 21:45:17,972 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 21:45:17,985 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:50:44,586 INFO core: Event loop thread started, running loop forever
2026-08-31 21:50:44,887 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 21:50:44,893 INFO core: _init_accounts coroutine started
2026-08-31 21:50:44,895 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 21:50:44,912 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 21:55:23,597 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 21:55:23,619 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:00:28,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:05:05,948 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-08-31 22:05:05,965 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:10:11,488 INFO core: _init_accounts coroutine started
2026-08-31 22:10:11,489 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:10:11,497 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 22:10:22,629 INFO core: Event loop thread started, running loop forever
2026-08-31 22:10:22,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 22:10:22,935 INFO core: _init_accounts coroutine started
2026-08-31 22:10:22,936 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:10:22,950 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:15:04,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 22:15:04,467 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 22:15:04,467 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-08-31 22:15:04,468 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 22:15:04,469 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 22:15:04,469 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 22:15:04,469 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 22:15:04,469 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 22:15:04,469 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 22:15:21,582 INFO core: Event loop thread started, running loop forever
2026-08-31 22:15:21,883 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 22:15:21,890 INFO core: _init_accounts coroutine started
2026-08-31 22:15:21,890 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:15:21,904 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:20:27,506 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 22:20:38,094 INFO core: Event loop thread started, running loop forever
2026-08-31 22:20:38,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 22:20:38,399 INFO core: _init_accounts coroutine started
2026-08-31 22:20:38,401 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:20:38,412 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:25:13,689 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:30:37,729 INFO core: Event loop thread started, running loop forever
2026-08-31 22:30:38,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 22:30:38,033 INFO core: _init_accounts coroutine started
2026-08-31 22:30:38,034 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:30:38,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:35:22,424 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 22:35:22,448 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:40:38,757 INFO core: Event loop thread started, running loop forever
2026-08-31 22:40:39,059 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 22:40:39,065 INFO core: _init_accounts coroutine started
2026-08-31 22:40:39,067 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:40:39,096 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:45:24,042 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:45:24,044 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 22:45:24,044 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 22:50:31,554 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 22:50:31,554 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-08-31 22:50:31,555 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 22:50:31,555 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-08-31 22:50:31,556 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 22:50:31,556 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-08-31 22:50:51,447 INFO core: Event loop thread started, running loop forever
2026-08-31 22:50:51,767 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 22:50:51,778 INFO core: _init_accounts coroutine started
2026-08-31 22:50:51,779 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:50:51,780 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:55:49,941 INFO core: Event loop thread started, running loop forever
2026-08-31 22:55:50,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 22:55:50,247 INFO core: _init_accounts coroutine started
2026-08-31 22:55:50,248 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 22:55:50,263 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 22:55:58,958 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-08-31 23:00:40,832 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:05:43,796 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:10:14,634 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:15:21,486 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 23:15:52,731 INFO core: Event loop thread started, running loop forever
2026-08-31 23:15:53,032 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 23:15:53,036 INFO core: _init_accounts coroutine started
2026-08-31 23:15:53,037 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 23:15:53,045 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:20:51,969 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-08-31 23:20:51,977 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:25:10,252 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:30:40,518 INFO core: Event loop thread started, running loop forever
2026-08-31 23:30:40,822 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 23:30:40,826 INFO core: _init_accounts coroutine started
2026-08-31 23:30:40,827 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 23:30:40,839 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:35:40,479 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 23:35:40,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 23:35:40,483 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 23:35:40,486 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:40:20,863 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 23:40:20,873 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:45:27,504 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-08-31 23:45:27,505 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-08-31 23:45:51,507 INFO core: Event loop thread started, running loop forever
2026-08-31 23:45:51,808 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-08-31 23:45:51,814 INFO core: _init_accounts coroutine started
2026-08-31 23:45:51,814 INFO core: _init_accounts_inner: starting DB migrations
2026-08-31 23:45:51,828 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:50:14,273 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-08-31 23:50:14,274 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-08-31 23:50:14,276 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-08-31 23:50:14,285 INFO core: status() clients=0 connected=False forwarding=False
2026-08-31 23:55:06,117 INFO core: _init_accounts_inner: reloading LLM config
2026-08-31 23:55:06,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:00:13,474 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 00:00:13,480 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 00:00:22,455 INFO core: Event loop thread started, running loop forever
2026-09-01 00:00:22,756 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 00:00:22,761 INFO core: _init_accounts coroutine started
2026-09-01 00:00:22,764 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 00:00:22,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:05:14,047 INFO core: Event loop thread started, running loop forever
2026-09-01 00:05:14,349 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 00:05:14,356 INFO core: _init_accounts coroutine started
2026-09-01 00:05:14,356 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 00:05:14,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:05:28,075 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 00:10:12,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:15:19,419 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 00:15:45,303 INFO core: Event loop thread started, running loop forever
2026-09-01 00:15:45,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 00:15:45,613 INFO core: _init_accounts coroutine started
2026-09-01 00:15:45,615 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 00:15:45,623 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:20:32,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:25:05,785 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 00:25:05,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:30:22,199 INFO core: Event loop thread started, running loop forever
2026-09-01 00:30:22,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 00:30:22,516 INFO core: _init_accounts coroutine started
2026-09-01 00:30:22,517 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 00:30:22,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:35:09,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:40:50,973 INFO core: Event loop thread started, running loop forever
2026-09-01 00:40:51,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 00:40:51,288 INFO core: _init_accounts coroutine started
2026-09-01 00:40:51,288 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 00:40:51,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:45:12,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:50:19,493 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 00:50:30,176 INFO core: Event loop thread started, running loop forever
2026-09-01 00:50:30,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 00:50:30,481 INFO core: _init_accounts coroutine started
2026-09-01 00:50:30,481 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 00:50:30,496 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 00:55:49,517 INFO core: Event loop thread started, running loop forever
2026-09-01 00:55:49,818 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 00:55:49,824 INFO core: _init_accounts coroutine started
2026-09-01 00:55:49,825 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 00:55:49,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:00:36,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:05:31,670 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 01:05:31,672 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 01:05:31,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:10:12,313 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 01:10:12,324 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 01:10:12,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:15:12,937 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 01:15:12,938 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 01:15:12,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:20:17,185 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 01:20:17,186 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 01:20:17,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:25:20,469 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 01:25:20,470 WARNING core: Account 2: connect timed out after 35s
2026-09-01 01:25:20,471 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-01 01:25:20,471 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-01 01:25:20,472 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 01:25:20,473 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-01 01:25:20,473 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-01 01:25:20,481 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:30:27,442 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 01:30:27,442 WARNING core: Account 2: connect timed out after 35s
2026-09-01 01:30:27,443 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-01 01:30:27,443 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-01 01:30:27,444 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 01:30:27,445 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-01 01:30:27,445 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-01 01:30:49,592 INFO core: Event loop thread started, running loop forever
2026-09-01 01:30:49,893 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 01:30:49,898 INFO core: _init_accounts coroutine started
2026-09-01 01:30:49,898 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 01:30:49,907 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:35:10,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:40:14,204 INFO core: Event loop thread started, running loop forever
2026-09-01 01:40:14,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 01:40:14,510 INFO core: _init_accounts coroutine started
2026-09-01 01:40:14,511 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 01:40:14,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:45:26,835 INFO core: Event loop thread started, running loop forever
2026-09-01 01:45:27,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 01:45:27,139 INFO core: _init_accounts coroutine started
2026-09-01 01:45:27,140 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 01:45:27,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:50:38,010 INFO core: Event loop thread started, running loop forever
2026-09-01 01:50:38,311 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 01:50:38,319 INFO core: _init_accounts coroutine started
2026-09-01 01:50:38,319 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 01:50:38,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 01:55:13,996 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 01:55:14,002 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:00:10,798 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:05:42,016 INFO core: Event loop thread started, running loop forever
2026-09-01 02:05:42,324 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 02:05:42,332 INFO core: _init_accounts coroutine started
2026-09-01 02:05:42,332 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 02:05:42,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:10:21,199 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 02:10:21,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:15:14,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:20:38,445 INFO core: Event loop thread started, running loop forever
2026-09-01 02:20:38,749 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 02:20:38,754 INFO core: _init_accounts coroutine started
2026-09-01 02:20:38,755 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 02:20:38,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:25:39,831 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:30:33,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:35:40,019 INFO core: Event loop thread started, running loop forever
2026-09-01 02:35:40,330 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 02:35:40,335 INFO core: _init_accounts coroutine started
2026-09-01 02:35:40,335 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 02:35:40,342 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:40:21,778 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 02:40:21,778 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 02:40:21,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:45:04,466 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 02:45:17,366 INFO core: Event loop thread started, running loop forever
2026-09-01 02:45:17,667 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 02:45:17,671 INFO core: _init_accounts coroutine started
2026-09-01 02:45:17,671 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 02:45:17,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:50:24,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 02:50:49,600 INFO core: Event loop thread started, running loop forever
2026-09-01 02:50:49,901 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 02:50:49,906 INFO core: _init_accounts coroutine started
2026-09-01 02:50:49,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 02:50:49,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 02:50:49,922 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 02:50:49,922 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 02:50:49,923 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 02:50:49,925 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 02:55:12,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:00:18,707 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 03:00:18,708 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 03:00:18,747 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 03:00:18,748 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 03:00:35,588 INFO core: Event loop thread started, running loop forever
2026-09-01 03:00:35,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 03:00:35,904 INFO core: _init_accounts coroutine started
2026-09-01 03:00:35,904 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 03:00:35,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:05:25,333 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 03:05:25,334 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 03:05:25,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:10:31,520 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 03:10:48,537 INFO core: Event loop thread started, running loop forever
2026-09-01 03:10:48,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 03:10:48,842 INFO core: _init_accounts coroutine started
2026-09-01 03:10:48,844 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 03:10:48,854 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:15:33,621 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 03:15:33,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:15:33,648 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 03:20:30,784 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 03:20:30,813 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 03:20:30,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:25:28,731 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 03:25:28,736 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 03:25:28,753 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 03:25:28,756 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 03:25:28,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:30:34,424 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 03:30:49,431 INFO core: Event loop thread started, running loop forever
2026-09-01 03:30:49,732 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 03:30:49,738 INFO core: _init_accounts coroutine started
2026-09-01 03:30:49,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 03:30:49,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:35:50,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:40:48,050 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 03:40:48,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:45:40,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:50:06,863 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-01 03:50:06,868 INFO core: _init_accounts coroutine started
2026-09-01 03:50:06,868 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 03:50:06,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 03:50:06,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 03:50:06,879 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 03:50:06,883 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 03:50:06,901 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 03:55:12,441 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 03:55:12,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 03:55:37,858 INFO core: Event loop thread started, running loop forever
2026-09-01 03:55:38,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 03:55:38,167 INFO core: _init_accounts coroutine started
2026-09-01 03:55:38,167 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 03:55:38,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:00:16,482 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 04:00:16,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:05:32,717 INFO core: Event loop thread started, running loop forever
2026-09-01 04:05:33,019 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 04:05:33,027 INFO core: _init_accounts coroutine started
2026-09-01 04:05:33,027 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 04:05:33,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:10:23,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:15:47,459 INFO core: Event loop thread started, running loop forever
2026-09-01 04:15:47,760 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 04:15:47,767 INFO core: _init_accounts coroutine started
2026-09-01 04:15:47,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 04:15:47,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:20:50,909 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 04:20:50,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:25:15,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:30:40,861 INFO core: Event loop thread started, running loop forever
2026-09-01 04:30:41,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 04:30:41,172 INFO core: _init_accounts coroutine started
2026-09-01 04:30:41,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 04:30:41,195 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 04:30:41,196 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 04:30:41,198 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 04:30:41,201 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 04:30:41,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:35:37,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:40:29,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:45:17,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:45:17,083 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 04:45:17,084 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 04:50:10,917 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 04:50:10,919 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 04:50:10,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 04:55:17,489 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 04:55:17,490 WARNING core: Account 2: connect timed out after 35s
2026-09-01 04:55:19,044 INFO core: Event loop thread started, running loop forever
2026-09-01 04:55:19,350 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 04:55:19,367 INFO core: _init_accounts coroutine started
2026-09-01 04:55:19,367 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 04:55:19,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:00:05,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 05:00:35,163 INFO core: Event loop thread started, running loop forever
2026-09-01 05:00:35,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 05:00:35,470 INFO core: _init_accounts coroutine started
2026-09-01 05:00:35,470 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 05:00:35,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:05:26,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:10:09,108 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:15:16,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 05:15:34,464 INFO core: Event loop thread started, running loop forever
2026-09-01 05:15:34,768 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 05:15:34,773 INFO core: _init_accounts coroutine started
2026-09-01 05:15:34,774 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 05:15:34,800 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:20:08,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:25:11,597 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 05:25:11,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:30:37,865 INFO core: Event loop thread started, running loop forever
2026-09-01 05:30:38,168 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 05:30:38,172 INFO core: _init_accounts coroutine started
2026-09-01 05:30:38,174 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 05:30:38,181 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:35:49,852 INFO core: Event loop thread started, running loop forever
2026-09-01 05:35:50,154 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 05:35:50,160 INFO core: _init_accounts coroutine started
2026-09-01 05:35:50,161 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 05:35:50,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:40:15,718 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:45:21,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 05:45:21,496 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 05:45:21,497 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-01 05:45:21,498 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 05:45:21,498 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-01 05:45:21,498 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 05:45:21,498 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-01 05:45:21,498 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 05:45:21,498 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 05:45:51,659 INFO core: Event loop thread started, running loop forever
2026-09-01 05:45:51,963 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 05:45:51,969 INFO core: _init_accounts coroutine started
2026-09-01 05:45:51,975 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:45:51,976 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 05:50:28,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 05:50:28,477 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 05:50:28,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 05:55:23,151 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 05:55:23,164 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 05:55:23,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:00:14,421 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 06:00:14,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 06:00:14,445 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 06:00:14,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:05:20,496 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 06:05:20,532 INFO core: Event loop thread started, running loop forever
2026-09-01 06:05:20,835 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 06:05:20,842 INFO core: _init_accounts coroutine started
2026-09-01 06:05:20,842 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 06:05:20,855 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-01 06:05:20,857 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-01 06:10:13,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:15:43,670 INFO core: Event loop thread started, running loop forever
2026-09-01 06:15:43,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 06:15:43,977 INFO core: _init_accounts coroutine started
2026-09-01 06:15:43,979 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 06:15:43,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:20:24,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:25:25,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:30:32,457 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 06:30:32,458 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 06:30:32,458 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-01 06:30:32,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 06:30:32,459 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-01 06:30:32,459 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 06:30:32,459 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-01 06:30:32,459 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 06:30:32,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 06:30:38,328 INFO core: Event loop thread started, running loop forever
2026-09-01 06:30:38,631 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 06:30:38,636 INFO core: _init_accounts coroutine started
2026-09-01 06:30:38,637 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 06:30:38,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:35:45,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 06:35:51,877 INFO core: Event loop thread started, running loop forever
2026-09-01 06:35:52,180 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 06:35:52,187 INFO core: _init_accounts coroutine started
2026-09-01 06:35:52,189 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 06:35:52,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:40:37,973 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 06:40:37,974 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 06:40:37,982 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 06:40:37,984 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 06:40:38,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:45:31,998 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 06:45:31,999 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 06:45:32,002 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:50:22,429 INFO core: Event loop thread started, running loop forever
2026-09-01 06:50:22,731 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 06:50:22,743 INFO core: _init_accounts coroutine started
2026-09-01 06:50:22,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:50:22,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 06:50:39,462 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 06:50:39,463 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 06:55:49,389 INFO core: Event loop thread started, running loop forever
2026-09-01 06:55:49,691 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 06:55:49,698 INFO core: _init_accounts coroutine started
2026-09-01 06:55:49,698 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 06:55:49,710 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 06:55:49,714 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 06:55:49,714 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 07:00:21,976 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 07:00:21,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:05:27,500 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 07:05:45,242 INFO core: Event loop thread started, running loop forever
2026-09-01 07:05:45,543 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 07:05:45,548 INFO core: _init_accounts coroutine started
2026-09-01 07:05:45,548 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 07:05:45,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:10:52,488 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 07:10:52,489 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 07:10:52,489 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-01 07:10:52,490 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 07:10:52,490 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-01 07:10:52,490 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 07:10:52,490 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-01 07:10:52,492 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 07:10:52,492 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 07:10:58,472 INFO core: Event loop thread started, running loop forever
2026-09-01 07:10:58,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 07:10:58,778 INFO core: _init_accounts coroutine started
2026-09-01 07:10:58,779 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 07:10:58,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:10:58,791 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 07:10:58,798 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 07:15:10,783 INFO core: Event loop thread started, running loop forever
2026-09-01 07:15:11,084 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 07:15:11,089 INFO core: _init_accounts coroutine started
2026-09-01 07:15:11,090 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 07:15:11,101 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:20:38,958 INFO core: Event loop thread started, running loop forever
2026-09-01 07:20:39,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 07:20:39,262 INFO core: _init_accounts coroutine started
2026-09-01 07:20:39,263 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 07:20:39,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:25:47,043 INFO core: Event loop thread started, running loop forever
2026-09-01 07:25:47,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 07:25:47,356 INFO core: _init_accounts coroutine started
2026-09-01 07:25:47,356 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 07:25:47,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:30:16,171 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:35:11,477 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 07:35:11,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 07:35:11,480 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 07:35:11,482 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 07:35:11,492 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:35:11,497 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 07:35:11,498 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 07:35:11,506 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 07:35:11,507 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 07:40:18,455 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 07:40:18,460 WARNING core: Account 2: connect timed out after 35s
2026-09-01 07:40:18,461 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-01 07:40:18,461 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-01 07:40:18,462 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 07:40:18,463 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-01 07:40:18,464 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-01 07:40:48,471 INFO core: Event loop thread started, running loop forever
2026-09-01 07:40:48,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 07:40:48,779 INFO core: _init_accounts coroutine started
2026-09-01 07:40:48,780 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 07:40:48,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:45:48,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:50:21,167 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 07:50:21,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 07:55:14,890 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:00:10,749 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-01 08:00:10,750 INFO core: _init_accounts coroutine started
2026-09-01 08:00:10,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 08:00:10,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:05:16,514 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 08:05:29,501 INFO core: Event loop thread started, running loop forever
2026-09-01 08:05:29,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 08:05:29,810 INFO core: _init_accounts coroutine started
2026-09-01 08:05:29,811 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 08:05:29,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:10:36,546 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 08:10:49,129 INFO core: Event loop thread started, running loop forever
2026-09-01 08:10:49,430 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 08:10:49,435 INFO core: _init_accounts coroutine started
2026-09-01 08:10:49,436 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 08:10:49,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:15:17,554 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 08:15:17,556 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 08:15:17,559 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 08:15:17,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:20:15,975 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 08:20:15,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:25:08,006 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 08:25:08,021 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 08:25:08,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:30:51,494 INFO core: Event loop thread started, running loop forever
2026-09-01 08:30:51,804 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 08:30:51,810 INFO core: _init_accounts coroutine started
2026-09-01 08:30:51,810 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 08:30:51,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:35:09,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:35:09,235 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 08:35:09,236 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 08:35:09,239 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 08:40:17,699 INFO core: Event loop thread started, running loop forever
2026-09-01 08:40:18,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 08:40:18,005 INFO core: _init_accounts coroutine started
2026-09-01 08:40:18,006 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 08:40:18,018 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 08:40:18,018 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 08:40:18,019 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:40:18,021 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 08:45:24,449 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 08:45:24,449 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-01 08:45:24,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 08:45:24,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 08:45:26,185 INFO core: Event loop thread started, running loop forever
2026-09-01 08:45:26,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 08:45:26,490 INFO core: _init_accounts coroutine started
2026-09-01 08:45:26,492 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 08:45:26,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:50:12,829 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 08:50:12,830 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 08:50:12,833 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 08:50:12,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 08:50:12,838 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 08:55:24,817 INFO core: Event loop thread started, running loop forever
2026-09-01 08:55:25,118 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 08:55:25,124 INFO core: _init_accounts coroutine started
2026-09-01 08:55:25,125 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 08:55:25,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:00:36,972 INFO core: Event loop thread started, running loop forever
2026-09-01 09:00:37,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 09:00:37,277 INFO core: _init_accounts coroutine started
2026-09-01 09:00:37,278 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 09:00:37,321 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 09:00:37,321 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 09:00:37,325 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 09:00:37,329 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 09:00:37,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:05:28,521 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 09:05:28,522 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 09:05:28,527 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 09:05:28,528 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 09:05:28,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:10:31,251 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 09:10:31,252 WARNING core: Account 2: connect timed out after 35s
2026-09-01 09:10:31,253 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-01 09:10:31,253 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-01 09:10:31,254 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 09:10:31,256 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-01 09:10:31,256 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-01 09:10:31,268 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:15:06,220 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 09:15:06,220 WARNING core: Account 2: connect timed out after 35s
2026-09-01 09:15:06,221 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-01 09:15:06,221 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-01 09:15:06,222 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 09:15:06,222 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-01 09:15:06,223 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-01 09:15:06,255 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:20:13,428 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 09:20:13,429 WARNING core: Account 2: connect timed out after 35s
2026-09-01 09:20:13,433 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-01 09:20:21,432 INFO core: Event loop thread started, running loop forever
2026-09-01 09:20:21,734 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 09:20:21,738 INFO core: _init_accounts coroutine started
2026-09-01 09:20:21,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 09:20:21,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:25:56,104 INFO core: Event loop thread started, running loop forever
2026-09-01 09:25:56,410 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 09:25:56,418 INFO core: _init_accounts coroutine started
2026-09-01 09:25:56,420 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 09:25:56,421 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:30:06,345 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 09:30:24,593 INFO core: Event loop thread started, running loop forever
2026-09-01 09:30:24,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 09:30:24,904 INFO core: _init_accounts coroutine started
2026-09-01 09:30:24,905 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 09:30:24,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:35:30,481 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 09:35:55,636 INFO core: Event loop thread started, running loop forever
2026-09-01 09:35:55,938 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 09:35:55,943 INFO core: _init_accounts coroutine started
2026-09-01 09:35:55,944 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 09:35:55,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:40:12,561 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 09:40:12,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:45:11,311 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:50:11,184 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-01 09:50:11,185 INFO core: _init_accounts coroutine started
2026-09-01 09:50:11,186 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 09:50:11,189 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 09:55:22,812 INFO core: Event loop thread started, running loop forever
2026-09-01 09:55:23,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 09:55:23,119 INFO core: _init_accounts coroutine started
2026-09-01 09:55:23,119 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 09:55:23,142 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:00:29,410 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 10:00:52,967 INFO core: Event loop thread started, running loop forever
2026-09-01 10:00:53,268 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 10:00:53,291 INFO core: _init_accounts coroutine started
2026-09-01 10:00:53,291 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 10:00:53,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:05:14,946 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:10:08,281 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 10:10:08,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:15:21,202 INFO core: Event loop thread started, running loop forever
2026-09-01 10:15:21,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 10:15:21,508 INFO core: _init_accounts coroutine started
2026-09-01 10:15:21,509 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 10:15:21,517 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:20:28,441 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 10:20:45,803 INFO core: Event loop thread started, running loop forever
2026-09-01 10:20:46,104 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 10:20:46,111 INFO core: _init_accounts coroutine started
2026-09-01 10:20:46,112 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 10:20:46,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:25:45,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:30:09,080 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 10:30:09,083 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 10:30:09,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 10:30:09,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:35:38,766 INFO core: Event loop thread started, running loop forever
2026-09-01 10:35:39,068 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 10:35:39,072 INFO core: _init_accounts coroutine started
2026-09-01 10:35:39,074 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 10:35:39,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:35:39,260 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 10:35:39,261 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 10:40:22,518 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 10:40:22,521 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 10:40:22,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:45:26,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:50:32,550 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 10:50:32,551 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 10:50:32,553 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 10:50:53,122 INFO core: Event loop thread started, running loop forever
2026-09-01 10:50:53,423 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 10:50:53,428 INFO core: _init_accounts coroutine started
2026-09-01 10:50:53,429 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 10:50:53,438 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 10:50:53,443 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 10:50:53,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 10:50:53,447 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 10:55:53,659 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 10:55:53,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:00:38,848 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:05:42,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:10:06,278 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 11:10:06,279 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 11:10:06,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:15:34,776 INFO core: Event loop thread started, running loop forever
2026-09-01 11:15:35,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 11:15:35,083 INFO core: _init_accounts coroutine started
2026-09-01 11:15:35,087 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:15:35,102 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 11:15:35,107 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 11:15:35,108 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 11:15:35,109 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 11:15:35,110 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 11:20:35,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:25:42,499 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 11:25:45,462 INFO core: Event loop thread started, running loop forever
2026-09-01 11:25:45,763 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 11:25:45,771 INFO core: _init_accounts coroutine started
2026-09-01 11:25:45,771 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 11:25:45,810 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:30:34,704 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 11:30:34,705 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 11:30:34,710 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:35:40,520 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 11:35:40,548 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 11:35:40,548 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-01 11:35:40,548 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 11:35:40,549 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 11:35:49,547 INFO core: Event loop thread started, running loop forever
2026-09-01 11:35:49,848 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 11:35:49,851 INFO core: _init_accounts coroutine started
2026-09-01 11:35:49,854 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 11:35:49,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:40:47,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:45:07,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 11:45:29,541 INFO core: Event loop thread started, running loop forever
2026-09-01 11:45:29,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 11:45:29,850 INFO core: _init_accounts coroutine started
2026-09-01 11:45:29,850 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 11:45:29,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:50:35,595 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-01 11:50:47,635 INFO core: Event loop thread started, running loop forever
2026-09-01 11:50:47,936 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 11:50:47,944 INFO core: _init_accounts coroutine started
2026-09-01 11:50:47,946 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 11:50:47,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:55:52,579 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 11:55:52,583 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 11:55:52,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 12:00:23,665 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 12:00:23,672 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 12:00:23,721 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:05:11,052 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 12:05:11,054 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 12:05:11,065 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 12:05:11,072 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 12:05:11,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:10:18,523 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 12:10:18,523 WARNING core: Account 2: connect timed out after 35s
2026-09-01 12:10:18,524 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-01 12:10:18,524 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-01 12:10:18,525 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 12:10:18,525 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-01 12:10:18,526 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-01 12:10:33,254 INFO core: Event loop thread started, running loop forever
2026-09-01 12:10:33,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 12:10:33,561 INFO core: _init_accounts coroutine started
2026-09-01 12:10:33,561 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 12:10:33,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:15:40,473 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 12:15:52,533 INFO core: Event loop thread started, running loop forever
2026-09-01 12:15:52,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 12:15:52,839 INFO core: _init_accounts coroutine started
2026-09-01 12:15:52,840 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 12:15:52,853 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 12:15:52,853 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 12:15:52,855 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 12:15:52,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:20:46,388 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 12:20:46,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:25:04,570 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:30:38,707 INFO core: Event loop thread started, running loop forever
2026-09-01 12:30:39,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 12:30:39,018 INFO core: _init_accounts coroutine started
2026-09-01 12:30:39,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 12:30:39,036 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:35:45,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 12:35:51,431 INFO core: Event loop thread started, running loop forever
2026-09-01 12:35:51,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 12:35:51,744 INFO core: _init_accounts coroutine started
2026-09-01 12:35:51,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:35:51,758 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 12:40:39,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:45:31,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:50:37,496 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 12:50:37,497 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 12:50:44,320 INFO core: Event loop thread started, running loop forever
2026-09-01 12:50:44,624 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 12:50:44,634 INFO core: _init_accounts coroutine started
2026-09-01 12:50:44,634 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 12:50:44,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 12:55:20,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:00:16,661 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 13:00:16,662 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 13:00:16,664 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 13:00:16,668 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 13:00:16,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:05:05,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:10:36,839 INFO core: Event loop thread started, running loop forever
2026-09-01 13:10:37,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 13:10:37,148 INFO core: _init_accounts coroutine started
2026-09-01 13:10:37,148 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 13:10:37,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:15:20,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:20:27,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 13:20:50,046 INFO core: Event loop thread started, running loop forever
2026-09-01 13:20:50,347 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 13:20:50,353 INFO core: _init_accounts coroutine started
2026-09-01 13:20:50,355 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 13:20:50,366 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:25:24,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:30:45,221 INFO core: Event loop thread started, running loop forever
2026-09-01 13:30:45,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 13:30:45,527 INFO core: _init_accounts coroutine started
2026-09-01 13:30:45,528 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 13:30:45,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:35:29,331 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 13:35:29,332 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 13:35:29,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:40:21,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 13:40:21,116 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 13:40:21,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:45:35,288 INFO core: Event loop thread started, running loop forever
2026-09-01 13:45:35,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 13:45:35,600 INFO core: _init_accounts coroutine started
2026-09-01 13:45:35,600 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 13:45:35,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:50:48,804 INFO core: Event loop thread started, running loop forever
2026-09-01 13:50:49,105 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 13:50:49,109 INFO core: _init_accounts coroutine started
2026-09-01 13:50:49,111 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 13:50:49,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 13:55:35,706 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 13:55:35,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:00:57,834 INFO core: Event loop thread started, running loop forever
2026-09-01 14:00:58,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 14:00:58,140 INFO core: _init_accounts coroutine started
2026-09-01 14:00:58,140 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 14:00:58,148 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:05:19,113 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 14:05:19,116 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 14:05:19,118 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 14:05:19,120 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 14:05:19,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:10:20,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:15:26,569 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 14:15:26,569 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 14:15:26,570 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 14:15:50,780 INFO core: Event loop thread started, running loop forever
2026-09-01 14:15:51,088 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 14:15:51,095 INFO core: _init_accounts coroutine started
2026-09-01 14:15:51,095 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 14:15:51,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:20:11,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:25:12,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:30:48,222 INFO core: Event loop thread started, running loop forever
2026-09-01 14:30:48,523 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 14:30:48,533 INFO core: _init_accounts coroutine started
2026-09-01 14:30:48,534 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 14:30:48,557 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:35:19,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 14:35:19,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:35:19,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 14:40:43,262 INFO core: Event loop thread started, running loop forever
2026-09-01 14:40:43,563 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 14:40:43,567 INFO core: _init_accounts coroutine started
2026-09-01 14:40:43,569 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 14:40:43,579 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:45:50,484 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 14:45:54,396 INFO core: Event loop thread started, running loop forever
2026-09-01 14:45:54,697 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 14:45:54,702 INFO core: _init_accounts coroutine started
2026-09-01 14:45:54,703 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 14:45:54,714 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:50:49,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 14:55:22,794 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 14:55:22,794 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 14:55:22,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:00:28,553 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 15:00:50,471 INFO core: Event loop thread started, running loop forever
2026-09-01 15:00:50,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 15:00:50,779 INFO core: _init_accounts coroutine started
2026-09-01 15:00:50,779 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 15:00:50,837 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 15:00:50,837 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 15:00:50,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:05:45,115 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 15:05:45,128 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 15:05:45,131 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:10:41,864 INFO core: Event loop thread started, running loop forever
2026-09-01 15:10:42,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 15:10:42,172 INFO core: _init_accounts coroutine started
2026-09-01 15:10:42,178 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 15:10:42,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:15:25,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:20:32,472 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 15:20:32,472 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 15:20:47,296 INFO core: Event loop thread started, running loop forever
2026-09-01 15:20:47,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 15:20:47,611 INFO core: _init_accounts coroutine started
2026-09-01 15:20:47,612 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 15:20:47,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:25:24,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:30:21,125 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 15:30:21,126 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 15:30:21,129 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 15:30:21,132 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 15:30:21,156 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 15:30:21,156 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 15:30:21,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:30:21,165 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 15:30:21,167 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 15:35:18,649 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 15:35:18,651 WARNING core: Account 2: connect timed out after 35s
2026-09-01 15:35:18,652 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-01 15:35:18,652 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-01 15:35:18,653 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 15:35:18,653 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-01 15:35:18,654 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-01 15:35:18,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:40:18,943 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 15:40:18,944 WARNING core: Account 2: connect timed out after 35s
2026-09-01 15:40:18,945 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-01 15:40:18,945 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-01 15:40:18,945 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 15:40:18,947 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-01 15:40:18,947 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-01 15:40:19,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:45:52,115 INFO core: Event loop thread started, running loop forever
2026-09-01 15:45:52,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 15:45:52,420 INFO core: _init_accounts coroutine started
2026-09-01 15:45:52,422 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 15:45:52,428 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:50:48,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 15:55:07,264 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 15:55:07,265 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 15:55:07,268 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 15:55:07,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:00:06,707 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 16:00:06,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:05:38,390 INFO core: Event loop thread started, running loop forever
2026-09-01 16:05:38,692 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 16:05:38,698 INFO core: _init_accounts coroutine started
2026-09-01 16:05:38,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:05:38,711 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 16:10:12,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:15:13,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 16:15:53,568 INFO core: Event loop thread started, running loop forever
2026-09-01 16:15:53,869 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 16:15:53,874 INFO core: _init_accounts coroutine started
2026-09-01 16:15:53,875 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 16:15:53,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:20:29,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:25:35,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:30:14,216 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 16:30:14,217 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 16:30:14,224 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:35:24,410 INFO core: Event loop thread started, running loop forever
2026-09-01 16:35:24,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 16:35:24,717 INFO core: _init_accounts coroutine started
2026-09-01 16:35:24,718 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 16:35:24,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:40:23,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:45:29,449 INFO core: Event loop thread started, running loop forever
2026-09-01 16:45:29,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 16:45:29,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:45:29,763 INFO core: _init_accounts coroutine started
2026-09-01 16:45:29,764 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 16:50:52,252 INFO core: Event loop thread started, running loop forever
2026-09-01 16:50:52,553 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 16:50:52,558 INFO core: _init_accounts coroutine started
2026-09-01 16:50:52,559 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 16:50:52,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 16:55:06,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:00:12,422 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 17:00:52,081 INFO core: Event loop thread started, running loop forever
2026-09-01 17:00:52,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 17:00:52,397 INFO core: _init_accounts coroutine started
2026-09-01 17:00:52,397 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 17:00:52,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:05:46,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:10:53,680 INFO core: Event loop thread started, running loop forever
2026-09-01 17:10:53,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 17:10:53,986 INFO core: _init_accounts coroutine started
2026-09-01 17:10:53,986 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 17:10:53,999 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:15:11,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:20:18,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 17:20:18,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 17:20:18,410 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-01 17:20:18,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 17:20:18,411 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-01 17:20:18,411 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 17:20:18,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-01 17:20:18,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 17:20:18,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 17:20:29,849 INFO core: Event loop thread started, running loop forever
2026-09-01 17:20:30,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 17:20:30,154 INFO core: _init_accounts coroutine started
2026-09-01 17:20:30,154 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 17:20:30,165 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:25:48,466 INFO core: Event loop thread started, running loop forever
2026-09-01 17:25:48,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 17:25:48,772 INFO core: _init_accounts coroutine started
2026-09-01 17:25:48,772 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 17:25:48,795 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:30:50,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 17:30:50,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 17:30:50,886 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 17:30:50,897 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 17:30:50,922 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 17:30:50,922 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 17:30:50,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:35:39,162 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 17:35:39,165 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 17:35:39,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:40:29,278 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 17:40:29,282 WARNING core: Account 2: connect timed out after 35s
2026-09-01 17:40:29,283 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-01 17:40:29,283 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-01 17:40:29,284 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 17:40:29,286 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-01 17:40:29,286 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-01 17:40:29,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:45:09,071 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 17:45:09,072 WARNING core: Account 2: connect timed out after 35s
2026-09-01 17:45:09,075 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-01 17:45:09,076 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-01 17:45:09,076 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 17:45:09,078 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-01 17:45:09,079 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-01 17:45:09,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:50:16,412 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 17:50:16,412 WARNING core: Account 2: connect timed out after 35s
2026-09-01 17:50:16,413 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-01 17:50:16,414 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-01 17:50:16,415 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 17:50:32,850 INFO core: Event loop thread started, running loop forever
2026-09-01 17:50:33,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 17:50:33,155 INFO core: _init_accounts coroutine started
2026-09-01 17:50:33,158 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 17:50:33,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 17:55:48,337 INFO core: Event loop thread started, running loop forever
2026-09-01 17:55:48,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 17:55:48,644 INFO core: _init_accounts coroutine started
2026-09-01 17:55:48,645 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 17:55:48,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:00:52,630 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 18:00:52,631 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 18:00:52,633 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 18:00:52,635 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 18:00:52,638 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:05:20,734 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 18:05:20,735 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 18:05:20,744 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 18:05:20,746 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-01 18:05:20,749 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:10:26,448 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-01 18:10:26,449 WARNING core: Account 2: connect timed out after 35s
2026-09-01 18:10:26,449 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-01 18:10:26,449 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-01 18:10:26,450 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-01 18:10:26,451 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-01 18:10:26,451 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-01 18:10:49,430 INFO core: Event loop thread started, running loop forever
2026-09-01 18:10:49,731 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 18:10:49,736 INFO core: _init_accounts coroutine started
2026-09-01 18:10:49,737 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 18:10:49,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:15:08,189 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 18:15:08,189 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 18:15:08,191 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 18:15:08,193 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 18:15:08,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:20:15,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 18:20:15,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 18:20:15,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 18:20:30,642 INFO core: Event loop thread started, running loop forever
2026-09-01 18:20:30,943 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 18:20:30,951 INFO core: _init_accounts coroutine started
2026-09-01 18:20:30,952 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 18:20:30,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:20:30,972 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 18:20:30,972 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 18:25:36,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 18:25:36,451 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-01 18:25:43,054 INFO core: Event loop thread started, running loop forever
2026-09-01 18:25:43,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 18:25:43,360 INFO core: _init_accounts coroutine started
2026-09-01 18:25:43,361 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 18:25:43,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:30:07,395 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-01 18:30:50,584 INFO core: Event loop thread started, running loop forever
2026-09-01 18:30:50,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 18:30:50,889 INFO core: _init_accounts coroutine started
2026-09-01 18:30:50,889 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 18:30:50,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:35:35,412 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 18:35:35,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:40:40,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:45:30,058 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-01 18:45:30,059 INFO core: _init_accounts coroutine started
2026-09-01 18:45:30,060 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 18:45:30,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:50:40,856 INFO core: Event loop thread started, running loop forever
2026-09-01 18:50:41,157 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 18:50:41,164 INFO core: _init_accounts coroutine started
2026-09-01 18:50:41,164 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 18:50:41,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 18:55:22,021 INFO core: Event loop thread started, running loop forever
2026-09-01 18:55:22,323 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 18:55:22,327 INFO core: _init_accounts coroutine started
2026-09-01 18:55:22,328 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 18:55:22,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:00:29,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 19:00:51,420 INFO core: Event loop thread started, running loop forever
2026-09-01 19:00:51,730 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 19:00:51,738 INFO core: _init_accounts coroutine started
2026-09-01 19:00:51,739 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 19:00:51,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:05:48,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:10:35,994 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 19:10:35,995 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 19:10:36,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:10:36,003 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 19:10:36,005 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 19:15:13,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:20:20,472 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 19:20:20,473 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 19:20:20,473 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 19:20:30,525 INFO core: Event loop thread started, running loop forever
2026-09-01 19:20:30,827 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 19:20:30,835 INFO core: _init_accounts coroutine started
2026-09-01 19:20:30,847 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 19:20:30,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:25:16,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:25:16,378 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 19:25:16,378 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 19:25:16,379 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 19:25:16,381 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 19:30:22,529 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 19:30:44,318 INFO core: Event loop thread started, running loop forever
2026-09-01 19:30:44,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 19:30:44,624 INFO core: _init_accounts coroutine started
2026-09-01 19:30:44,625 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 19:30:44,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:35:33,134 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:40:40,417 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 19:40:41,673 INFO core: Event loop thread started, running loop forever
2026-09-01 19:40:41,974 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 19:40:41,978 INFO core: _init_accounts coroutine started
2026-09-01 19:40:41,979 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 19:40:41,993 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:45:40,520 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 19:45:40,542 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:50:52,661 INFO core: Event loop thread started, running loop forever
2026-09-01 19:50:52,968 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 19:50:52,972 INFO core: _init_accounts coroutine started
2026-09-01 19:50:52,974 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 19:50:52,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 19:55:06,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:00:54,929 INFO core: Event loop thread started, running loop forever
2026-09-01 20:00:55,230 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 20:00:55,236 INFO core: _init_accounts coroutine started
2026-09-01 20:00:55,236 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 20:00:55,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:05:30,496 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 20:05:30,497 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 20:05:30,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:10:18,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 20:10:18,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 20:10:18,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:15:25,490 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 20:15:25,491 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 20:15:25,491 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 20:15:44,009 INFO core: Event loop thread started, running loop forever
2026-09-01 20:15:44,310 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 20:15:44,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:15:44,322 INFO core: _init_accounts coroutine started
2026-09-01 20:20:10,511 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 20:20:10,521 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:25:17,980 INFO core: Event loop thread started, running loop forever
2026-09-01 20:25:18,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 20:25:18,287 INFO core: _init_accounts coroutine started
2026-09-01 20:25:18,287 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 20:25:18,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:30:25,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 20:30:47,044 INFO core: Event loop thread started, running loop forever
2026-09-01 20:30:47,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 20:30:47,351 INFO core: _init_accounts coroutine started
2026-09-01 20:30:47,353 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 20:30:47,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:35:42,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:40:39,118 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 20:40:39,126 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:45:28,750 INFO core: Event loop thread started, running loop forever
2026-09-01 20:45:29,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 20:45:29,063 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:50:28,535 INFO core: _init_accounts coroutine started
2026-09-01 20:50:28,536 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 20:50:28,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 20:55:19,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:00:26,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 21:00:26,408 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 21:00:55,786 INFO core: Event loop thread started, running loop forever
2026-09-01 21:00:56,087 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 21:00:56,091 INFO core: _init_accounts coroutine started
2026-09-01 21:00:56,091 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 21:00:56,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:05:08,726 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:10:13,129 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 21:10:13,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:15:20,317 INFO core: Event loop thread started, running loop forever
2026-09-01 21:15:20,618 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 21:15:20,623 INFO core: _init_accounts coroutine started
2026-09-01 21:15:20,624 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 21:15:20,636 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-01 21:15:20,643 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-01 21:20:41,212 INFO core: Event loop thread started, running loop forever
2026-09-01 21:20:41,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 21:20:41,524 INFO core: _init_accounts coroutine started
2026-09-01 21:20:41,525 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 21:20:41,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:25:27,461 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 21:25:27,462 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 21:25:27,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 21:25:27,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:30:12,643 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 21:30:12,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:35:19,469 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 21:35:26,881 INFO core: Event loop thread started, running loop forever
2026-09-01 21:35:27,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 21:35:27,188 INFO core: _init_accounts coroutine started
2026-09-01 21:35:27,189 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 21:35:27,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:40:25,311 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 21:40:25,324 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:45:20,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:50:53,245 INFO core: Event loop thread started, running loop forever
2026-09-01 21:50:53,546 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 21:50:53,553 INFO core: _init_accounts coroutine started
2026-09-01 21:50:53,553 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 21:50:53,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 21:55:07,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:00:14,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 22:00:14,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 22:00:14,451 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 22:00:47,703 INFO core: Event loop thread started, running loop forever
2026-09-01 22:00:48,004 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 22:00:48,009 INFO core: _init_accounts coroutine started
2026-09-01 22:00:48,010 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 22:00:48,029 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:05:54,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 22:05:54,506 INFO core: Event loop thread started, running loop forever
2026-09-01 22:05:54,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 22:05:54,811 INFO core: _init_accounts coroutine started
2026-09-01 22:05:54,811 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 22:05:54,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:05:54,835 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-01 22:10:39,436 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:15:39,562 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:20:28,573 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-01 22:20:28,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:25:23,215 INFO core: _init_accounts coroutine started
2026-09-01 22:25:23,218 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 22:25:23,228 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:30:26,351 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 22:30:26,351 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 22:30:26,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:35:05,366 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 22:35:05,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:40:51,413 INFO core: Event loop thread started, running loop forever
2026-09-01 22:40:51,714 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 22:40:51,727 INFO core: _init_accounts coroutine started
2026-09-01 22:40:51,729 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 22:40:51,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:45:29,178 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:50:31,174 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 22:50:31,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 22:55:43,253 INFO core: Event loop thread started, running loop forever
2026-09-01 22:55:43,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 22:55:43,560 INFO core: _init_accounts coroutine started
2026-09-01 22:55:43,562 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 22:55:43,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:00:04,427 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-01 23:00:16,905 INFO core: Event loop thread started, running loop forever
2026-09-01 23:00:17,209 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 23:00:17,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:05:23,449 INFO core: _init_accounts coroutine started
2026-09-01 23:05:23,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 23:05:23,470 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 23:05:27,670 INFO core: Event loop thread started, running loop forever
2026-09-01 23:05:27,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 23:05:27,978 INFO core: _init_accounts coroutine started
2026-09-01 23:05:27,978 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 23:05:27,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:10:33,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 23:10:50,333 INFO core: Event loop thread started, running loop forever
2026-09-01 23:10:50,634 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 23:10:50,640 INFO core: _init_accounts coroutine started
2026-09-01 23:10:50,641 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 23:10:50,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:15:52,297 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 23:15:52,297 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 23:15:52,301 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 23:15:52,303 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 23:15:52,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:20:19,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:20:19,674 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 23:20:19,676 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 23:25:26,251 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-01 23:25:26,253 INFO core: Event loop thread started, running loop forever
2026-09-01 23:25:26,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 23:25:26,563 INFO core: _init_accounts coroutine started
2026-09-01 23:25:26,563 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 23:25:26,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:30:53,489 INFO core: Event loop thread started, running loop forever
2026-09-01 23:30:53,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 23:30:53,796 INFO core: _init_accounts coroutine started
2026-09-01 23:30:53,797 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 23:30:53,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:35:28,609 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 23:35:28,610 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 23:35:28,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:35:28,614 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 23:40:50,765 INFO core: Event loop thread started, running loop forever
2026-09-01 23:40:51,066 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 23:40:51,072 INFO core: _init_accounts coroutine started
2026-09-01 23:40:51,073 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 23:40:51,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:45:38,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:45:38,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-01 23:45:38,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-01 23:50:42,772 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-01 23:50:42,776 INFO core: _init_accounts_inner: reloading LLM config
2026-09-01 23:50:42,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-01 23:55:48,449 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-01 23:55:48,449 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-01 23:55:48,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-01 23:55:51,879 INFO core: Event loop thread started, running loop forever
2026-09-01 23:55:52,180 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-01 23:55:52,185 INFO core: _init_accounts coroutine started
2026-09-01 23:55:52,186 INFO core: _init_accounts_inner: starting DB migrations
2026-09-01 23:55:52,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:00:22,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:05:27,760 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:10:33,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 00:10:33,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 00:10:33,403 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 00:10:52,350 INFO core: Event loop thread started, running loop forever
2026-09-02 00:10:52,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 00:10:52,660 INFO core: _init_accounts coroutine started
2026-09-02 00:10:52,661 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 00:10:52,663 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:15:28,681 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 00:15:28,681 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 00:15:28,683 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:15:28,684 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 00:20:23,065 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 00:20:23,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:25:12,857 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 00:25:12,858 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 00:25:12,866 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 00:25:12,867 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 00:25:12,874 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:30:18,459 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 00:30:58,634 INFO core: Event loop thread started, running loop forever
2026-09-02 00:30:58,935 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 00:30:58,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:35:12,506 INFO core: _init_accounts coroutine started
2026-09-02 00:35:12,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 00:35:12,513 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:40:19,441 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 00:40:49,918 INFO core: Event loop thread started, running loop forever
2026-09-02 00:40:50,219 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 00:40:50,223 INFO core: _init_accounts coroutine started
2026-09-02 00:40:50,224 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 00:40:50,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:45:54,514 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 00:45:54,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:50:48,814 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 00:55:34,989 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-02 00:55:34,992 INFO core: _init_accounts coroutine started
2026-09-02 00:55:34,992 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 00:55:34,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:00:44,129 INFO core: Event loop thread started, running loop forever
2026-09-02 01:00:44,430 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 01:00:44,433 INFO core: _init_accounts coroutine started
2026-09-02 01:00:44,434 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 01:00:44,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:05:19,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 01:05:19,381 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 01:05:19,383 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 01:05:19,400 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:10:10,317 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 01:10:10,341 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 01:10:10,341 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 01:10:10,346 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 01:10:10,347 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 01:10:10,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:15:03,395 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 01:15:03,395 WARNING core: Account 2: connect timed out after 35s
2026-09-02 01:15:03,396 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-02 01:15:03,396 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-02 01:15:03,397 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 01:15:03,398 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-02 01:15:03,399 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-02 01:15:30,232 INFO core: Event loop thread started, running loop forever
2026-09-02 01:15:30,533 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 01:15:30,538 INFO core: _init_accounts coroutine started
2026-09-02 01:15:30,539 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 01:15:30,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:20:08,934 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 01:20:08,935 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 01:20:08,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:20:08,941 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 01:25:38,486 INFO core: Event loop thread started, running loop forever
2026-09-02 01:25:38,793 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 01:25:38,800 INFO core: _init_accounts coroutine started
2026-09-02 01:25:38,800 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 01:25:38,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:30:45,444 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 01:30:51,224 INFO core: Event loop thread started, running loop forever
2026-09-02 01:30:51,525 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 01:30:51,530 INFO core: _init_accounts coroutine started
2026-09-02 01:30:51,532 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 01:30:51,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:35:47,950 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 01:35:47,951 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 01:35:47,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:40:10,180 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 01:40:10,189 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 01:40:10,190 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:45:16,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:50:09,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:55:15,489 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 01:55:15,489 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 01:55:15,489 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 01:55:30,540 INFO core: Event loop thread started, running loop forever
2026-09-02 01:55:30,842 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 01:55:30,847 INFO core: _init_accounts coroutine started
2026-09-02 01:55:30,848 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 01:55:30,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 01:55:30,874 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 01:55:30,874 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 02:00:32,580 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 02:00:32,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:05:06,230 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 02:05:06,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:10:53,835 INFO core: Event loop thread started, running loop forever
2026-09-02 02:10:54,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 02:10:54,154 INFO core: _init_accounts coroutine started
2026-09-02 02:10:54,161 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 02:10:54,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:15:17,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:20:12,127 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 02:20:12,133 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 02:20:12,147 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 02:20:12,156 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 02:20:12,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:25:55,740 INFO core: Event loop thread started, running loop forever
2026-09-02 02:25:56,042 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 02:25:56,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:30:13,103 INFO core: _init_accounts coroutine started
2026-09-02 02:30:13,108 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 02:30:13,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:35:20,589 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 02:35:25,615 INFO core: Event loop thread started, running loop forever
2026-09-02 02:35:25,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 02:35:25,926 INFO core: _init_accounts coroutine started
2026-09-02 02:35:25,927 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 02:35:25,939 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:40:31,612 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 02:40:48,979 INFO core: Event loop thread started, running loop forever
2026-09-02 02:40:49,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 02:40:49,288 INFO core: _init_accounts coroutine started
2026-09-02 02:40:49,291 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 02:40:49,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:45:20,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:50:21,828 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 02:50:21,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 02:55:36,394 INFO core: Event loop thread started, running loop forever
2026-09-02 02:55:36,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 02:55:36,706 INFO core: _init_accounts coroutine started
2026-09-02 02:55:36,706 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 02:55:36,718 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:00:14,957 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 03:00:14,958 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 03:00:14,967 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 03:00:14,973 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 03:00:15,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:05:23,115 INFO core: Event loop thread started, running loop forever
2026-09-02 03:05:23,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 03:05:23,437 INFO core: _init_accounts coroutine started
2026-09-02 03:05:23,437 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 03:05:23,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:10:30,554 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 03:10:39,546 INFO core: Event loop thread started, running loop forever
2026-09-02 03:10:39,847 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 03:10:39,854 INFO core: _init_accounts coroutine started
2026-09-02 03:10:39,854 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 03:10:39,885 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:15:36,744 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 03:15:36,746 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 03:15:36,762 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 03:15:36,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:20:07,221 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 03:20:07,223 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:25:41,566 INFO core: Event loop thread started, running loop forever
2026-09-02 03:25:41,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 03:25:41,876 INFO core: _init_accounts coroutine started
2026-09-02 03:25:41,876 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 03:25:41,923 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 03:25:41,924 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 03:25:41,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:25:41,936 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 03:25:41,938 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 03:30:36,099 INFO core: Event loop thread started, running loop forever
2026-09-02 03:30:36,401 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 03:30:36,408 INFO core: _init_accounts coroutine started
2026-09-02 03:30:36,409 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 03:30:36,419 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:35:37,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 03:35:37,428 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 03:35:37,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 03:35:37,436 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 03:35:37,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:40:27,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:45:28,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:45:28,628 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 03:45:28,629 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 03:50:08,790 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 03:50:08,793 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 03:50:08,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 03:55:14,577 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 03:55:36,773 INFO core: Event loop thread started, running loop forever
2026-09-02 03:55:37,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 03:55:37,100 INFO core: _init_accounts coroutine started
2026-09-02 03:55:37,101 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 03:55:37,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:00:43,611 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 04:00:54,481 INFO core: Event loop thread started, running loop forever
2026-09-02 04:00:54,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 04:00:54,794 INFO core: _init_accounts coroutine started
2026-09-02 04:00:54,800 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 04:00:54,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:05:45,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:05:45,640 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 04:05:45,641 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 04:10:52,284 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 04:10:52,294 INFO core: Event loop thread started, running loop forever
2026-09-02 04:10:52,595 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 04:10:52,602 INFO core: _init_accounts coroutine started
2026-09-02 04:10:52,602 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 04:10:52,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:15:19,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:15:19,342 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 04:15:19,342 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 04:15:19,343 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 04:20:11,551 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 04:20:11,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:25:18,502 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 04:25:48,216 INFO core: Event loop thread started, running loop forever
2026-09-02 04:25:48,518 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 04:25:48,525 INFO core: _init_accounts coroutine started
2026-09-02 04:25:48,526 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 04:25:48,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:30:32,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:35:36,658 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 04:35:36,660 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 04:35:36,668 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 04:35:36,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:40:27,726 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 04:40:27,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:45:53,575 INFO core: Event loop thread started, running loop forever
2026-09-02 04:45:53,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 04:45:53,887 INFO core: _init_accounts coroutine started
2026-09-02 04:45:53,888 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 04:45:53,894 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:50:52,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 04:55:05,254 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 04:55:05,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:00:35,439 INFO core: Event loop thread started, running loop forever
2026-09-02 05:00:35,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 05:00:35,747 INFO core: _init_accounts coroutine started
2026-09-02 05:00:35,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 05:00:35,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:05:30,825 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 05:05:30,827 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 05:05:30,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:10:46,723 INFO core: Event loop thread started, running loop forever
2026-09-02 05:10:47,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 05:10:47,034 INFO core: _init_accounts coroutine started
2026-09-02 05:10:47,035 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 05:10:47,045 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:15:25,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:20:35,952 INFO core: Event loop thread started, running loop forever
2026-09-02 05:20:36,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 05:20:36,261 INFO core: _init_accounts coroutine started
2026-09-02 05:20:36,262 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 05:20:36,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:25:18,834 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 05:25:18,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:30:08,395 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:35:32,108 INFO core: Event loop thread started, running loop forever
2026-09-02 05:35:32,410 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 05:35:32,418 INFO core: _init_accounts coroutine started
2026-09-02 05:35:32,418 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 05:35:32,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:35:32,437 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 05:35:32,438 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 05:40:19,224 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 05:40:19,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:45:05,425 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 05:45:54,681 INFO core: Event loop thread started, running loop forever
2026-09-02 05:45:54,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 05:45:54,986 INFO core: _init_accounts coroutine started
2026-09-02 05:45:54,988 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 05:45:55,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:50:53,228 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 05:50:53,228 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 05:50:53,235 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 05:50:53,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 05:50:53,241 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 05:55:52,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:00:42,102 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 06:00:42,104 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 06:00:42,112 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 06:00:42,114 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 06:00:42,124 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:05:05,059 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 06:05:05,060 WARNING core: Account 2: connect timed out after 35s
2026-09-02 06:05:05,060 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-02 06:05:05,061 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-02 06:05:05,062 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 06:05:05,063 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-02 06:05:05,064 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-02 06:05:05,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:10:12,514 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 06:10:12,516 WARNING core: Account 2: connect timed out after 35s
2026-09-02 06:10:12,517 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-02 06:10:12,517 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-02 06:10:12,518 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 06:10:12,519 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-02 06:10:12,520 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-02 06:10:45,646 INFO core: Event loop thread started, running loop forever
2026-09-02 06:10:45,947 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 06:10:45,953 INFO core: _init_accounts coroutine started
2026-09-02 06:10:45,953 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 06:10:45,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:15:18,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:15:18,940 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 06:15:18,940 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 06:20:24,517 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 06:20:24,518 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 06:20:24,519 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 06:20:24,519 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 06:20:24,519 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 06:20:24,519 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 06:20:48,985 INFO core: Event loop thread started, running loop forever
2026-09-02 06:20:49,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 06:20:49,293 INFO core: _init_accounts coroutine started
2026-09-02 06:20:49,294 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 06:20:49,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:25:21,570 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 06:25:21,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:30:21,371 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:35:40,207 INFO core: Event loop thread started, running loop forever
2026-09-02 06:35:40,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 06:35:40,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:35:40,521 INFO core: _init_accounts coroutine started
2026-09-02 06:40:44,272 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 06:40:44,292 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:45:19,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:50:29,020 INFO core: Event loop thread started, running loop forever
2026-09-02 06:50:29,321 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 06:50:29,327 INFO core: _init_accounts coroutine started
2026-09-02 06:50:29,328 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 06:50:29,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 06:55:36,437 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 06:55:36,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 06:55:54,334 INFO core: Event loop thread started, running loop forever
2026-09-02 06:55:54,635 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 06:55:54,642 INFO core: _init_accounts coroutine started
2026-09-02 06:55:54,644 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 06:55:54,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:00:39,570 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 07:00:39,583 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:00:39,592 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 07:05:24,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:10:05,710 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 07:10:05,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:15:30,060 INFO core: Event loop thread started, running loop forever
2026-09-02 07:15:30,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 07:15:30,367 INFO core: _init_accounts coroutine started
2026-09-02 07:15:30,368 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 07:15:30,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:20:19,606 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 07:20:19,607 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 07:20:19,617 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 07:20:19,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:20:19,620 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 07:25:43,007 INFO core: Event loop thread started, running loop forever
2026-09-02 07:25:43,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 07:25:43,319 INFO core: _init_accounts coroutine started
2026-09-02 07:25:43,320 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 07:25:43,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:30:19,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:35:26,511 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 07:35:41,924 INFO core: Event loop thread started, running loop forever
2026-09-02 07:35:42,225 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 07:35:42,239 INFO core: _init_accounts coroutine started
2026-09-02 07:35:42,239 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 07:35:42,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:40:22,131 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 07:40:22,131 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 07:40:22,133 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 07:40:22,135 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 07:40:22,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:45:20,223 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:50:19,365 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 07:50:19,366 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 07:50:19,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 07:55:46,484 INFO core: Event loop thread started, running loop forever
2026-09-02 07:55:46,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 07:55:46,787 INFO core: _init_accounts coroutine started
2026-09-02 07:55:46,789 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 07:55:46,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:00:06,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 08:00:18,291 INFO core: Event loop thread started, running loop forever
2026-09-02 08:00:18,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 08:00:18,596 INFO core: _init_accounts coroutine started
2026-09-02 08:00:18,597 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 08:00:18,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:05:23,320 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 08:05:23,320 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 08:05:23,322 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 08:05:23,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:10:29,487 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 08:10:51,294 INFO core: Event loop thread started, running loop forever
2026-09-02 08:10:51,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 08:10:51,600 INFO core: _init_accounts coroutine started
2026-09-02 08:10:51,601 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 08:10:51,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:15:15,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:20:44,202 INFO core: Event loop thread started, running loop forever
2026-09-02 08:20:44,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 08:20:44,509 INFO core: _init_accounts coroutine started
2026-09-02 08:20:44,510 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 08:20:44,517 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:25:23,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:30:29,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 08:30:29,407 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 08:30:29,408 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 08:30:29,409 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 08:30:29,409 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 08:30:29,409 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 08:30:29,409 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 08:30:29,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 08:30:29,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 08:30:35,945 INFO core: Event loop thread started, running loop forever
2026-09-02 08:30:36,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 08:30:36,254 INFO core: _init_accounts coroutine started
2026-09-02 08:30:36,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 08:30:36,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:30:36,281 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 08:30:36,282 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 08:30:36,284 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 08:35:42,439 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 08:35:53,669 INFO core: Event loop thread started, running loop forever
2026-09-02 08:35:53,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 08:35:53,974 INFO core: _init_accounts coroutine started
2026-09-02 08:35:53,974 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 08:35:53,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:40:19,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:40:19,720 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 08:40:19,721 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 08:45:25,437 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 08:45:25,438 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 08:45:25,438 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 08:45:25,439 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 08:45:25,439 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 08:45:25,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 08:45:27,722 INFO core: Event loop thread started, running loop forever
2026-09-02 08:45:28,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 08:45:28,028 INFO core: _init_accounts coroutine started
2026-09-02 08:45:28,029 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 08:45:28,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:50:33,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 08:55:30,636 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 08:55:30,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:00:14,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:05:04,471 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-02 09:05:04,472 INFO core: _init_accounts coroutine started
2026-09-02 09:05:04,473 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 09:05:04,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 09:05:04,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 09:05:04,478 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:10:11,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 09:10:11,394 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 09:10:11,395 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 09:10:21,637 INFO core: Event loop thread started, running loop forever
2026-09-02 09:10:21,938 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 09:10:21,941 INFO core: _init_accounts coroutine started
2026-09-02 09:10:21,943 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 09:10:21,954 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:10:21,954 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 09:10:21,955 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 09:15:21,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:20:28,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 09:20:28,394 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 09:20:28,394 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 09:20:28,395 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 09:20:28,395 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 09:20:28,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 09:20:45,836 INFO core: Event loop thread started, running loop forever
2026-09-02 09:20:46,137 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 09:20:46,140 INFO core: _init_accounts coroutine started
2026-09-02 09:20:46,141 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 09:20:46,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:25:50,510 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 09:25:50,511 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 09:25:50,517 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:30:09,326 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 09:30:09,351 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:35:47,373 INFO core: Event loop thread started, running loop forever
2026-09-02 09:35:47,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 09:35:47,683 INFO core: _init_accounts coroutine started
2026-09-02 09:35:47,685 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 09:35:47,692 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:40:41,964 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:40:41,966 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 09:45:47,378 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 09:45:47,378 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 09:45:47,379 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 09:45:47,379 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 09:45:47,379 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 09:45:47,379 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 09:45:47,379 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 09:45:47,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 09:45:47,632 INFO core: Event loop thread started, running loop forever
2026-09-02 09:45:47,933 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 09:45:47,939 INFO core: _init_accounts coroutine started
2026-09-02 09:45:47,940 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 09:45:47,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:50:32,371 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 09:55:25,134 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 09:55:25,135 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 09:55:25,142 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:00:27,473 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 10:00:27,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:05:34,394 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 10:05:34,395 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 10:05:44,074 INFO core: Event loop thread started, running loop forever
2026-09-02 10:05:44,375 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 10:05:44,379 INFO core: _init_accounts coroutine started
2026-09-02 10:05:44,382 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 10:05:44,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:05:44,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 10:05:44,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 10:10:30,708 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 10:10:30,711 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 10:10:30,724 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 10:10:30,724 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 10:10:30,729 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 10:10:30,730 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 10:10:30,743 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:15:03,341 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 10:15:03,343 WARNING core: Account 2: connect timed out after 35s
2026-09-02 10:15:22,947 INFO core: Event loop thread started, running loop forever
2026-09-02 10:15:23,248 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 10:15:23,252 INFO core: _init_accounts coroutine started
2026-09-02 10:15:23,253 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 10:15:23,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:20:29,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 10:20:29,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 10:20:29,441 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 10:20:29,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 10:20:29,442 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 10:20:38,995 INFO core: Event loop thread started, running loop forever
2026-09-02 10:20:39,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 10:20:39,300 INFO core: _init_accounts coroutine started
2026-09-02 10:20:39,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 10:20:39,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:25:35,803 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 10:25:35,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:30:12,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:35:15,680 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-02 10:35:15,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:40:10,779 INFO core: _init_accounts coroutine started
2026-09-02 10:40:10,786 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 10:40:10,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:45:32,236 INFO core: Event loop thread started, running loop forever
2026-09-02 10:45:32,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 10:45:32,540 INFO core: _init_accounts coroutine started
2026-09-02 10:45:32,542 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 10:45:32,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:50:10,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 10:55:17,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 10:55:19,375 INFO core: Event loop thread started, running loop forever
2026-09-02 10:55:19,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 10:55:19,679 INFO core: _init_accounts coroutine started
2026-09-02 10:55:19,681 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 10:55:19,687 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:00:05,277 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 11:00:05,277 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 11:00:05,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:05:11,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 11:05:11,391 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 11:05:11,392 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 11:05:11,392 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 11:05:11,392 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 11:05:11,392 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 11:05:18,832 INFO core: Event loop thread started, running loop forever
2026-09-02 11:05:19,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 11:05:19,138 INFO core: _init_accounts coroutine started
2026-09-02 11:05:19,139 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 11:05:19,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:10:06,896 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 11:10:06,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:15:23,717 INFO core: Event loop thread started, running loop forever
2026-09-02 11:15:24,017 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 11:15:24,021 INFO core: _init_accounts coroutine started
2026-09-02 11:15:24,021 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 11:15:24,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:20:30,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 11:20:34,691 INFO core: Event loop thread started, running loop forever
2026-09-02 11:20:34,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 11:20:34,999 INFO core: _init_accounts coroutine started
2026-09-02 11:20:34,999 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 11:20:35,006 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:25:12,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:25:12,386 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 11:25:12,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 11:30:03,976 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 11:30:03,981 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 11:30:03,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:35:07,416 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:40:49,123 INFO core: Event loop thread started, running loop forever
2026-09-02 11:40:49,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 11:40:49,427 INFO core: _init_accounts coroutine started
2026-09-02 11:40:49,429 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 11:40:49,436 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:45:21,328 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 11:45:21,329 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 11:45:21,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:45:21,331 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 11:50:26,363 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 11:50:26,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 11:55:32,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 11:55:51,437 INFO core: Event loop thread started, running loop forever
2026-09-02 11:55:51,739 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 11:55:51,744 INFO core: _init_accounts coroutine started
2026-09-02 11:55:51,746 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 11:55:51,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:00:05,915 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 12:00:05,918 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 12:00:05,921 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 12:00:05,923 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 12:00:05,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:05:11,498 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 12:05:11,503 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 12:05:11,503 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 12:05:18,799 INFO core: Event loop thread started, running loop forever
2026-09-02 12:05:19,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 12:05:19,110 INFO core: _init_accounts coroutine started
2026-09-02 12:05:19,110 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 12:05:19,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:10:25,524 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 12:10:51,469 INFO core: Event loop thread started, running loop forever
2026-09-02 12:10:51,770 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 12:10:51,775 INFO core: _init_accounts coroutine started
2026-09-02 12:10:51,776 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 12:10:51,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:15:06,450 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 12:15:06,450 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 12:15:06,453 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 12:15:06,456 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 12:15:06,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:20:12,432 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 12:20:30,277 INFO core: Event loop thread started, running loop forever
2026-09-02 12:20:30,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 12:20:30,583 INFO core: _init_accounts coroutine started
2026-09-02 12:20:30,584 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 12:20:30,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:25:09,331 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 12:25:09,331 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 12:25:09,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:30:32,466 INFO core: Event loop thread started, running loop forever
2026-09-02 12:30:32,767 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 12:30:32,771 INFO core: _init_accounts coroutine started
2026-09-02 12:30:32,772 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 12:30:32,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:35:37,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:40:17,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 12:40:17,625 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 12:40:17,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:45:24,438 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 12:45:24,442 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 12:45:24,443 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 12:45:24,443 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 12:45:24,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 12:45:24,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 12:45:24,475 INFO core: Event loop thread started, running loop forever
2026-09-02 12:45:24,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 12:45:24,779 INFO core: _init_accounts coroutine started
2026-09-02 12:45:24,780 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 12:45:24,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:45:24,790 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-02 12:50:08,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 12:55:46,198 INFO core: Event loop thread started, running loop forever
2026-09-02 12:55:46,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 12:55:46,506 INFO core: _init_accounts coroutine started
2026-09-02 12:55:46,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 12:55:46,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:00:12,039 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 13:00:12,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:05:36,389 INFO core: Event loop thread started, running loop forever
2026-09-02 13:05:36,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 13:05:36,693 INFO core: _init_accounts coroutine started
2026-09-02 13:05:36,695 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 13:05:36,701 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:10:43,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 13:10:43,407 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 13:10:43,407 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 13:10:43,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 13:10:43,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 13:10:43,408 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 13:10:43,408 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 13:10:43,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 13:10:43,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 13:10:51,901 INFO core: Event loop thread started, running loop forever
2026-09-02 13:10:52,207 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 13:10:52,211 INFO core: _init_accounts coroutine started
2026-09-02 13:10:52,212 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 13:10:52,222 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 13:10:52,223 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 13:10:52,224 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 13:10:52,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:10:52,225 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 13:15:09,705 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:20:53,156 INFO core: Event loop thread started, running loop forever
2026-09-02 13:20:53,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 13:20:53,462 INFO core: _init_accounts coroutine started
2026-09-02 13:20:53,462 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 13:20:53,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:25:10,076 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 13:25:10,076 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 13:25:10,077 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 13:25:10,078 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 13:25:10,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:30:17,532 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 13:30:21,230 INFO core: Event loop thread started, running loop forever
2026-09-02 13:30:21,531 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 13:30:21,537 INFO core: _init_accounts coroutine started
2026-09-02 13:30:21,537 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 13:30:21,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:35:20,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:40:27,937 INFO core: Event loop thread started, running loop forever
2026-09-02 13:40:28,238 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 13:40:28,242 INFO core: _init_accounts coroutine started
2026-09-02 13:40:28,244 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 13:40:28,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:45:34,387 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-02 13:45:47,050 INFO core: Event loop thread started, running loop forever
2026-09-02 13:45:47,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 13:45:47,354 INFO core: _init_accounts coroutine started
2026-09-02 13:45:47,356 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 13:45:47,373 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:50:24,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 13:55:31,449 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 13:55:31,450 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 13:55:31,450 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 13:55:31,451 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 13:55:31,451 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 13:55:31,451 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 13:55:31,451 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 13:55:31,451 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 13:55:31,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 13:55:47,841 INFO core: Event loop thread started, running loop forever
2026-09-02 13:55:48,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 13:55:48,160 INFO core: _init_accounts coroutine started
2026-09-02 13:55:48,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 13:55:48,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:00:46,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:05:47,780 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 14:05:47,780 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 14:05:47,789 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 14:05:47,792 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 14:05:47,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:05:47,811 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 14:05:47,812 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 14:10:48,819 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 14:10:48,822 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 14:10:48,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:15:07,679 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 14:15:07,680 WARNING core: Account 2: connect timed out after 35s
2026-09-02 14:15:07,680 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-02 14:15:07,681 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-02 14:15:07,682 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 14:15:07,683 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-02 14:15:07,683 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-02 14:15:07,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:20:11,520 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 14:20:11,520 WARNING core: Account 2: connect timed out after 35s
2026-09-02 14:20:11,521 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-02 14:20:11,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-02 14:20:11,521 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 14:20:11,522 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-02 14:20:11,523 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-02 14:20:11,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:25:18,433 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 14:25:36,816 INFO core: Event loop thread started, running loop forever
2026-09-02 14:25:37,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 14:25:37,126 INFO core: _init_accounts coroutine started
2026-09-02 14:25:37,126 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 14:25:37,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:30:40,482 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 14:30:40,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:35:10,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:40:42,401 INFO core: Event loop thread started, running loop forever
2026-09-02 14:40:42,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 14:40:42,708 INFO core: _init_accounts coroutine started
2026-09-02 14:40:42,709 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 14:40:42,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:45:03,346 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 14:45:15,299 INFO core: Event loop thread started, running loop forever
2026-09-02 14:45:15,604 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 14:45:15,613 INFO core: _init_accounts coroutine started
2026-09-02 14:45:15,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 14:45:15,617 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:50:32,530 INFO core: Event loop thread started, running loop forever
2026-09-02 14:50:32,831 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 14:50:32,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 14:55:39,407 INFO core: _init_accounts coroutine started
2026-09-02 14:55:39,407 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 14:55:39,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 14:55:45,431 INFO core: Event loop thread started, running loop forever
2026-09-02 14:55:45,732 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 14:55:45,736 INFO core: _init_accounts coroutine started
2026-09-02 14:55:45,736 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 14:55:45,743 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:00:22,171 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:05:47,078 INFO core: Event loop thread started, running loop forever
2026-09-02 15:05:47,379 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 15:05:47,382 INFO core: _init_accounts coroutine started
2026-09-02 15:05:47,384 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 15:05:47,390 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:10:28,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:15:34,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 15:15:34,409 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 15:15:50,024 INFO core: Event loop thread started, running loop forever
2026-09-02 15:15:50,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 15:15:50,333 INFO core: _init_accounts coroutine started
2026-09-02 15:15:50,333 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 15:15:50,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:20:16,995 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 15:20:17,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:25:31,951 INFO core: Event loop thread started, running loop forever
2026-09-02 15:25:32,257 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 15:25:32,261 INFO core: _init_accounts coroutine started
2026-09-02 15:25:32,263 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 15:25:32,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:30:25,910 INFO core: Event loop thread started, running loop forever
2026-09-02 15:30:26,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 15:30:26,214 INFO core: _init_accounts coroutine started
2026-09-02 15:30:26,215 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 15:30:26,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:30:38,919 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 15:35:40,185 INFO core: Event loop thread started, running loop forever
2026-09-02 15:35:40,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 15:35:40,490 INFO core: _init_accounts coroutine started
2026-09-02 15:35:40,492 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 15:35:40,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:40:23,489 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 15:40:23,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:45:08,736 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:50:14,918 INFO core: Event loop thread started, running loop forever
2026-09-02 15:50:15,220 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 15:50:15,223 INFO core: _init_accounts coroutine started
2026-09-02 15:50:15,224 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 15:50:15,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 15:55:16,286 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 15:55:16,287 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 15:55:16,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:00:23,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 16:00:31,641 INFO core: Event loop thread started, running loop forever
2026-09-02 16:00:31,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 16:00:31,947 INFO core: _init_accounts coroutine started
2026-09-02 16:00:31,947 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 16:00:31,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:05:29,647 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:10:11,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:10:11,734 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 16:15:17,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 16:15:17,376 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-02 16:15:17,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 16:15:17,377 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-02 16:15:17,377 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 16:15:17,377 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-02 16:15:17,377 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 16:15:17,377 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 16:15:18,431 INFO core: Event loop thread started, running loop forever
2026-09-02 16:15:18,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 16:15:18,737 INFO core: _init_accounts coroutine started
2026-09-02 16:15:18,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 16:15:18,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:20:06,367 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 16:20:06,368 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 16:20:06,368 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:25:09,179 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 16:25:09,182 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 16:25:09,187 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:30:53,069 INFO core: Event loop thread started, running loop forever
2026-09-02 16:30:53,370 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 16:30:53,374 INFO core: _init_accounts coroutine started
2026-09-02 16:30:53,376 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 16:30:53,382 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:35:14,452 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 16:35:14,452 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 16:35:14,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 16:35:14,457 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 16:35:14,478 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:40:14,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:45:28,423 INFO core: Event loop thread started, running loop forever
2026-09-02 16:45:28,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 16:45:28,730 INFO core: _init_accounts coroutine started
2026-09-02 16:45:28,732 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 16:45:28,750 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:50:35,378 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 16:50:50,035 INFO core: Event loop thread started, running loop forever
2026-09-02 16:50:50,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 16:50:50,339 INFO core: _init_accounts coroutine started
2026-09-02 16:50:50,341 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 16:50:50,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 16:55:35,836 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 16:55:35,842 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:00:25,353 INFO core: Event loop thread started, running loop forever
2026-09-02 17:00:25,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 17:00:25,659 INFO core: _init_accounts coroutine started
2026-09-02 17:00:25,660 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 17:00:25,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:05:38,040 INFO core: Event loop thread started, running loop forever
2026-09-02 17:05:38,342 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 17:05:38,345 INFO core: _init_accounts coroutine started
2026-09-02 17:05:38,346 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 17:05:38,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:10:30,650 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:15:29,629 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 17:15:29,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:20:35,580 INFO core: Event loop thread started, running loop forever
2026-09-02 17:20:35,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 17:20:35,891 INFO core: _init_accounts coroutine started
2026-09-02 17:20:35,892 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 17:20:35,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:25:45,807 INFO core: Event loop thread started, running loop forever
2026-09-02 17:25:46,108 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 17:25:46,111 INFO core: _init_accounts coroutine started
2026-09-02 17:25:46,114 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 17:25:46,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:25:46,128 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 17:25:46,128 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 17:30:48,375 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 17:30:48,384 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 17:30:48,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:35:41,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:40:03,995 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 17:40:03,996 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 17:40:04,003 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 17:40:04,004 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 17:40:04,028 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:45:11,405 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 17:45:11,405 WARNING core: Account 2: connect timed out after 35s
2026-09-02 17:45:11,405 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-02 17:45:11,406 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-02 17:45:11,407 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 17:45:11,408 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-02 17:45:42,007 INFO core: Event loop thread started, running loop forever
2026-09-02 17:45:42,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 17:45:42,312 INFO core: _init_accounts coroutine started
2026-09-02 17:45:42,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 17:45:42,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:50:43,460 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:55:22,379 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 17:55:22,379 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 17:55:22,381 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 17:55:22,383 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 17:55:22,397 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 17:55:22,398 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 17:55:22,399 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 18:00:17,784 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 18:00:17,785 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 18:00:17,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:05:18,778 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 18:05:18,779 WARNING core: Account 2: connect timed out after 35s
2026-09-02 18:05:18,779 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-02 18:05:18,780 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-02 18:05:18,781 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 18:05:18,781 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-02 18:05:18,782 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-02 18:05:18,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:10:24,412 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 18:10:36,071 INFO core: Event loop thread started, running loop forever
2026-09-02 18:10:36,372 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 18:10:36,376 INFO core: _init_accounts coroutine started
2026-09-02 18:10:36,378 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 18:10:36,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:15:07,751 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 18:15:07,751 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 18:15:07,757 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 18:15:07,760 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 18:15:07,765 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:20:25,631 INFO core: Event loop thread started, running loop forever
2026-09-02 18:20:25,933 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 18:20:25,939 INFO core: _init_accounts coroutine started
2026-09-02 18:20:25,941 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 18:20:25,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:25:22,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:30:04,693 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:35:10,393 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 18:35:10,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 18:35:10,395 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 18:35:46,453 INFO core: Event loop thread started, running loop forever
2026-09-02 18:35:46,754 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 18:35:46,758 INFO core: _init_accounts coroutine started
2026-09-02 18:35:46,760 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 18:35:46,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:40:25,108 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:45:32,407 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-02 18:45:56,821 INFO core: Event loop thread started, running loop forever
2026-09-02 18:45:57,122 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 18:45:57,126 INFO core: _init_accounts coroutine started
2026-09-02 18:45:57,127 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 18:45:57,133 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:50:14,071 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 18:55:21,364 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 18:55:21,365 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 18:55:21,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 18:55:43,807 INFO core: Event loop thread started, running loop forever
2026-09-02 18:55:44,108 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 18:55:44,112 INFO core: _init_accounts coroutine started
2026-09-02 18:55:44,114 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 18:55:44,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:00:28,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:05:34,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 19:05:47,930 INFO core: Event loop thread started, running loop forever
2026-09-02 19:05:48,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 19:05:48,240 INFO core: _init_accounts coroutine started
2026-09-02 19:05:48,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 19:05:48,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:10:27,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:15:03,353 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 19:15:24,889 INFO core: Event loop thread started, running loop forever
2026-09-02 19:15:25,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 19:15:25,208 INFO core: _init_accounts coroutine started
2026-09-02 19:15:25,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 19:15:25,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:20:06,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:25:40,547 INFO core: Event loop thread started, running loop forever
2026-09-02 19:25:40,848 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 19:25:40,852 INFO core: _init_accounts coroutine started
2026-09-02 19:25:40,853 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 19:25:40,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:30:35,696 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 19:30:35,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:30:35,697 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 19:35:03,626 INFO core: Event loop thread started, running loop forever
2026-09-02 19:35:03,927 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 19:35:03,930 INFO core: _init_accounts coroutine started
2026-09-02 19:35:03,933 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 19:35:03,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:35:42,714 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 19:35:42,715 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 19:35:42,715 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 19:35:42,716 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 19:35:42,716 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 19:35:42,716 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 19:40:10,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 19:40:14,791 INFO core: Event loop thread started, running loop forever
2026-09-02 19:40:15,093 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 19:40:15,098 INFO core: _init_accounts coroutine started
2026-09-02 19:40:15,099 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 19:40:15,109 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:45:21,430 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 19:45:40,225 INFO core: Event loop thread started, running loop forever
2026-09-02 19:45:40,527 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 19:45:40,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:50:35,970 INFO core: _init_accounts coroutine started
2026-09-02 19:50:35,972 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 19:50:35,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 19:55:34,560 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 19:55:34,561 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 19:55:34,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:00:13,880 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 20:00:13,884 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 20:00:13,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:05:19,474 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 20:05:19,475 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 20:05:19,475 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 20:05:53,832 INFO core: Event loop thread started, running loop forever
2026-09-02 20:05:54,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 20:05:54,137 INFO core: _init_accounts coroutine started
2026-09-02 20:05:54,138 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 20:05:54,144 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:10:05,175 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 20:10:05,176 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 20:10:05,179 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 20:10:05,185 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 20:10:05,204 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 20:10:05,205 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 20:10:05,211 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 20:10:05,212 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 20:10:05,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:15:31,958 INFO core: Event loop thread started, running loop forever
2026-09-02 20:15:32,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 20:15:32,264 INFO core: _init_accounts coroutine started
2026-09-02 20:15:32,266 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 20:15:32,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:20:37,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:25:18,836 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 20:25:18,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:25:18,837 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 20:30:24,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 20:30:24,447 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 20:30:24,448 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 20:30:24,448 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 20:30:24,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 20:30:24,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 20:30:45,536 INFO core: Event loop thread started, running loop forever
2026-09-02 20:30:45,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 20:30:45,842 INFO core: _init_accounts coroutine started
2026-09-02 20:30:45,846 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 20:30:45,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:35:27,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:40:33,347 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 20:40:50,557 INFO core: Event loop thread started, running loop forever
2026-09-02 20:40:50,858 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 20:40:50,862 INFO core: _init_accounts coroutine started
2026-09-02 20:40:50,864 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 20:40:50,872 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:45:32,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:50:39,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 20:50:39,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 20:50:39,478 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-02 20:50:39,479 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 20:50:39,479 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 20:50:39,479 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 20:50:39,479 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 20:50:39,479 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 20:50:39,480 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 20:50:53,419 INFO core: Event loop thread started, running loop forever
2026-09-02 20:50:53,720 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 20:50:53,723 INFO core: _init_accounts coroutine started
2026-09-02 20:50:53,725 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 20:50:53,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 20:55:15,585 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 20:55:15,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:00:44,039 INFO core: Event loop thread started, running loop forever
2026-09-02 21:00:44,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 21:00:44,347 INFO core: _init_accounts coroutine started
2026-09-02 21:00:44,348 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 21:00:44,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:05:51,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 21:05:53,318 INFO core: Event loop thread started, running loop forever
2026-09-02 21:05:53,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 21:05:53,623 INFO core: _init_accounts coroutine started
2026-09-02 21:05:53,624 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 21:05:53,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:10:08,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:15:15,400 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 21:15:23,887 INFO core: Event loop thread started, running loop forever
2026-09-02 21:15:24,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 21:15:24,192 INFO core: _init_accounts coroutine started
2026-09-02 21:15:24,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 21:15:24,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:20:23,928 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 21:20:23,929 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 21:20:23,930 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:20:23,930 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 21:25:29,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 21:25:29,417 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 21:25:29,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 21:25:29,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 21:25:41,547 INFO core: Event loop thread started, running loop forever
2026-09-02 21:25:41,848 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 21:25:41,854 INFO core: _init_accounts coroutine started
2026-09-02 21:25:41,854 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 21:25:41,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:30:03,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 21:30:43,679 INFO core: Event loop thread started, running loop forever
2026-09-02 21:30:43,980 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 21:30:43,984 INFO core: _init_accounts coroutine started
2026-09-02 21:30:43,985 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 21:30:43,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:35:06,428 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:35:06,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 21:35:06,431 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 21:40:56,322 INFO core: Event loop thread started, running loop forever
2026-09-02 21:40:56,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 21:40:56,626 INFO core: _init_accounts coroutine started
2026-09-02 21:40:56,627 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 21:40:56,633 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:45:21,426 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:50:28,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 21:50:34,631 INFO core: Event loop thread started, running loop forever
2026-09-02 21:50:34,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 21:50:34,944 INFO core: _init_accounts coroutine started
2026-09-02 21:50:34,945 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 21:50:34,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 21:55:35,587 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 21:55:35,592 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:00:36,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:05:43,595 INFO core: Event loop thread started, running loop forever
2026-09-02 22:05:43,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 22:05:43,900 INFO core: _init_accounts coroutine started
2026-09-02 22:05:43,902 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 22:05:43,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:10:05,657 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:15:47,946 INFO core: Event loop thread started, running loop forever
2026-09-02 22:15:48,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 22:15:48,251 INFO core: _init_accounts coroutine started
2026-09-02 22:15:48,252 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 22:15:48,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:20:19,665 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:25:06,998 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-02 22:25:07,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:30:49,891 INFO core: Event loop thread started, running loop forever
2026-09-02 22:30:50,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 22:30:50,197 INFO core: _init_accounts coroutine started
2026-09-02 22:30:50,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 22:30:50,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:35:13,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:40:48,108 INFO core: Event loop thread started, running loop forever
2026-09-02 22:40:48,409 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 22:40:48,412 INFO core: _init_accounts coroutine started
2026-09-02 22:40:48,412 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 22:40:48,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:45:11,329 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 22:45:11,330 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 22:45:11,333 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 22:45:11,335 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 22:45:11,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:50:48,197 INFO core: Event loop thread started, running loop forever
2026-09-02 22:50:48,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 22:50:48,503 INFO core: _init_accounts coroutine started
2026-09-02 22:50:48,504 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 22:50:48,511 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 22:50:48,511 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 22:50:48,512 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 22:50:48,514 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 22:50:48,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 22:55:27,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:00:19,297 INFO core: Event loop thread started, running loop forever
2026-09-02 23:00:19,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 23:00:19,601 INFO core: _init_accounts coroutine started
2026-09-02 23:00:19,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 23:00:19,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:00:34,322 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 23:05:13,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:10:44,643 INFO core: Event loop thread started, running loop forever
2026-09-02 23:10:44,944 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 23:10:44,948 INFO core: _init_accounts coroutine started
2026-09-02 23:10:44,954 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 23:10:44,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:15:35,134 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 23:15:35,134 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 23:15:35,135 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 23:15:35,137 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 23:15:35,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:20:28,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:25:10,475 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-02 23:25:10,476 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 23:25:10,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:30:11,700 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-02 23:30:11,702 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-02 23:30:11,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:35:17,376 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-02 23:35:17,377 WARNING core: Account 2: connect timed out after 35s
2026-09-02 23:35:17,377 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-02 23:35:17,377 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-02 23:35:17,378 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-02 23:35:17,379 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-02 23:35:42,117 INFO core: Event loop thread started, running loop forever
2026-09-02 23:35:42,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 23:35:42,423 INFO core: _init_accounts coroutine started
2026-09-02 23:35:42,424 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 23:35:42,431 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:40:13,428 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 23:40:13,429 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 23:40:13,433 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:45:03,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-02 23:45:03,389 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-02 23:45:03,390 INFO core: _init_accounts_inner: reloading LLM config
2026-09-02 23:45:03,390 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-02 23:45:03,390 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-02 23:45:03,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-02 23:45:53,267 INFO core: Event loop thread started, running loop forever
2026-09-02 23:45:53,568 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-02 23:45:53,579 INFO core: _init_accounts coroutine started
2026-09-02 23:45:53,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-02 23:45:53,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:50:49,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-02 23:55:34,667 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-02 23:55:34,668 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-02 23:55:34,683 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:00:41,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 00:00:46,136 INFO core: Event loop thread started, running loop forever
2026-09-03 00:00:46,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 00:00:46,452 INFO core: _init_accounts coroutine started
2026-09-03 00:00:46,453 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 00:00:46,463 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:05:31,731 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 00:05:31,732 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 00:05:31,733 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 00:05:31,734 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 00:05:31,747 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 00:05:31,747 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 00:05:31,751 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 00:05:31,752 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 00:05:31,761 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:10:28,513 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 00:10:28,513 WARNING core: Account 2: connect timed out after 35s
2026-09-03 00:10:28,514 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-03 00:10:28,514 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-03 00:10:28,515 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 00:10:28,516 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-03 00:10:28,516 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-03 00:10:28,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:15:35,427 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 00:15:35,428 WARNING core: Account 2: connect timed out after 35s
2026-09-03 00:15:35,429 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-03 00:15:35,429 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-03 00:15:58,022 INFO core: Event loop thread started, running loop forever
2026-09-03 00:15:58,323 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 00:15:58,330 INFO core: _init_accounts coroutine started
2026-09-03 00:15:58,331 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 00:15:58,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:20:26,778 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:25:08,238 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 00:25:08,239 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 00:25:08,245 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 00:25:08,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:25:08,252 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 00:30:05,568 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:35:36,699 INFO core: Event loop thread started, running loop forever
2026-09-03 00:35:37,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 00:35:37,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:40:31,938 INFO core: _init_accounts coroutine started
2026-09-03 00:40:31,938 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 00:40:31,944 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:45:37,427 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 00:45:37,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 00:45:37,427 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-03 00:45:37,428 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 00:45:37,429 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 00:45:37,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 00:45:37,429 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 00:45:37,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 00:45:37,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 00:45:48,072 INFO core: Event loop thread started, running loop forever
2026-09-03 00:45:48,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 00:45:48,375 INFO core: _init_accounts coroutine started
2026-09-03 00:45:48,377 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 00:45:48,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:50:10,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:55:04,605 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 00:55:04,606 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 00:55:04,608 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 00:55:04,609 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 01:00:10,388 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-03 01:00:10,389 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 01:00:10,390 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 01:00:10,390 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 01:00:10,390 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 01:00:46,777 INFO core: Event loop thread started, running loop forever
2026-09-03 01:00:47,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 01:00:47,084 INFO core: _init_accounts coroutine started
2026-09-03 01:00:47,085 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 01:00:47,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:05:37,259 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 01:05:37,259 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 01:05:37,263 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 01:05:37,265 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 01:05:37,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:10:35,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:15:13,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:20:08,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:25:23,706 INFO core: Event loop thread started, running loop forever
2026-09-03 01:25:24,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 01:25:24,012 INFO core: _init_accounts coroutine started
2026-09-03 01:25:24,013 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 01:25:24,020 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:30:58,318 INFO core: Event loop thread started, running loop forever
2026-09-03 01:30:58,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 01:30:58,624 INFO core: _init_accounts coroutine started
2026-09-03 01:30:58,625 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 01:30:58,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:35:38,416 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:40:42,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:45:36,641 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 01:45:36,641 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 01:45:36,644 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:50:07,974 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 01:50:07,977 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 01:50:07,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 01:55:14,552 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 01:55:18,138 INFO core: Event loop thread started, running loop forever
2026-09-03 01:55:18,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 01:55:18,445 INFO core: _init_accounts coroutine started
2026-09-03 01:55:18,447 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 01:55:18,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:00:03,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 02:00:17,417 INFO core: Event loop thread started, running loop forever
2026-09-03 02:00:17,718 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 02:00:17,726 INFO core: _init_accounts coroutine started
2026-09-03 02:00:17,727 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 02:00:17,728 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:05:15,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:10:08,083 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 02:10:08,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:15:14,990 INFO core: Event loop thread started, running loop forever
2026-09-03 02:15:15,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 02:15:15,295 INFO core: _init_accounts coroutine started
2026-09-03 02:15:15,296 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 02:15:15,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:20:22,565 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 02:20:35,775 INFO core: Event loop thread started, running loop forever
2026-09-03 02:20:36,076 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 02:20:36,085 INFO core: _init_accounts coroutine started
2026-09-03 02:20:36,085 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 02:20:36,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:25:33,757 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 02:25:33,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:30:46,017 INFO core: Event loop thread started, running loop forever
2026-09-03 02:30:46,318 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 02:30:46,322 INFO core: _init_accounts coroutine started
2026-09-03 02:30:46,323 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 02:30:46,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:35:27,833 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 02:35:27,833 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 02:35:27,844 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 02:35:27,847 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:40:34,460 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 02:40:34,484 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 02:40:34,485 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 02:40:48,590 INFO core: Event loop thread started, running loop forever
2026-09-03 02:40:48,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 02:40:48,897 INFO core: _init_accounts coroutine started
2026-09-03 02:40:48,898 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 02:40:48,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:45:54,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 02:45:59,295 INFO core: Event loop thread started, running loop forever
2026-09-03 02:45:59,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 02:45:59,602 INFO core: _init_accounts coroutine started
2026-09-03 02:45:59,602 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 02:45:59,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:50:30,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:55:21,936 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 02:55:21,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:55:33,509 INFO core: Event loop thread started, running loop forever
2026-09-03 02:55:33,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 02:55:33,817 INFO core: _init_accounts coroutine started
2026-09-03 02:55:33,818 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 02:55:33,827 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 02:55:33,827 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 02:55:33,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 02:55:33,844 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 03:00:40,038 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 03:00:40,039 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 03:00:40,039 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 03:00:40,039 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 03:00:47,308 INFO core: Event loop thread started, running loop forever
2026-09-03 03:00:47,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 03:00:47,616 INFO core: _init_accounts coroutine started
2026-09-03 03:00:47,616 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 03:00:47,660 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 03:00:47,660 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 03:00:47,662 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 03:00:47,664 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 03:00:47,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:05:33,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:10:04,592 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 03:10:04,593 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 03:10:04,608 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 03:10:04,609 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 03:10:04,623 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:15:10,446 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 03:15:10,446 WARNING core: Account 2: connect timed out after 35s
2026-09-03 03:15:10,447 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-03 03:15:10,447 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-03 03:15:10,448 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 03:15:10,449 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-03 03:15:10,449 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-03 03:15:50,969 INFO core: Event loop thread started, running loop forever
2026-09-03 03:15:51,271 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 03:15:51,274 INFO core: _init_accounts coroutine started
2026-09-03 03:15:51,276 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 03:15:51,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:15:51,288 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 03:15:51,289 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 03:20:07,180 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 03:20:07,181 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:25:47,738 INFO core: Event loop thread started, running loop forever
2026-09-03 03:25:48,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 03:25:48,048 INFO core: _init_accounts coroutine started
2026-09-03 03:25:48,050 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 03:25:48,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:30:29,628 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 03:30:29,629 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 03:30:29,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 03:30:29,639 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 03:30:29,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:35:22,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:40:04,195 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 03:40:04,196 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 03:40:04,203 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 03:40:04,205 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 03:40:04,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:45:11,392 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 03:45:11,400 WARNING core: Account 2: connect timed out after 35s
2026-09-03 03:45:54,556 INFO core: Event loop thread started, running loop forever
2026-09-03 03:45:54,857 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 03:45:54,861 INFO core: _init_accounts coroutine started
2026-09-03 03:45:54,863 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 03:45:54,872 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:50:45,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:55:48,202 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 03:55:48,205 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 03:55:48,712 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 03:55:48,717 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 03:55:48,719 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 04:00:31,280 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 04:00:31,282 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 04:00:31,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:00:31,289 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 04:00:31,291 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 04:05:13,163 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 04:05:13,163 WARNING core: Account 2: connect timed out after 35s
2026-09-03 04:05:13,164 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-03 04:05:13,165 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-03 04:05:13,166 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 04:05:13,167 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-03 04:05:13,168 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-03 04:05:13,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:10:07,147 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 04:10:07,147 WARNING core: Account 2: connect timed out after 35s
2026-09-03 04:10:07,147 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-03 04:10:07,148 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-03 04:10:07,148 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 04:10:07,149 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-03 04:10:07,149 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-03 04:10:07,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:15:03,435 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 04:15:03,436 WARNING core: Account 2: connect timed out after 35s
2026-09-03 04:15:03,437 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-03 04:15:03,437 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-03 04:15:03,438 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 04:15:03,440 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-03 04:15:03,440 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-03 04:15:41,007 INFO core: Event loop thread started, running loop forever
2026-09-03 04:15:41,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 04:15:41,311 INFO core: _init_accounts coroutine started
2026-09-03 04:15:41,311 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 04:15:41,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:20:24,148 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 04:20:24,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:25:39,226 INFO core: Event loop thread started, running loop forever
2026-09-03 04:25:39,527 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 04:25:39,533 INFO core: _init_accounts coroutine started
2026-09-03 04:25:39,533 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 04:25:39,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:30:09,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 04:30:09,456 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 04:30:09,458 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 04:30:09,461 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 04:30:09,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:35:44,342 INFO core: Event loop thread started, running loop forever
2026-09-03 04:35:44,643 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 04:35:44,648 INFO core: _init_accounts coroutine started
2026-09-03 04:35:44,649 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 04:35:44,660 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:40:09,276 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 04:40:09,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:45:39,142 INFO core: Event loop thread started, running loop forever
2026-09-03 04:45:39,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 04:45:39,457 INFO core: _init_accounts coroutine started
2026-09-03 04:45:39,459 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 04:45:39,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:50:22,011 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 04:50:22,015 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 04:55:15,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:00:16,362 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-03 05:00:16,363 INFO core: _init_accounts coroutine started
2026-09-03 05:00:16,363 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 05:00:16,371 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:05:23,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 05:05:43,267 INFO core: Event loop thread started, running loop forever
2026-09-03 05:05:43,568 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 05:05:43,572 INFO core: _init_accounts coroutine started
2026-09-03 05:05:43,573 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 05:05:43,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:10:42,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:15:10,460 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 05:15:10,468 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:20:29,820 INFO core: Event loop thread started, running loop forever
2026-09-03 05:20:30,121 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 05:20:30,125 INFO core: _init_accounts coroutine started
2026-09-03 05:20:30,126 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 05:20:30,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:25:15,153 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 05:25:15,171 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:30:36,527 INFO core: Event loop thread started, running loop forever
2026-09-03 05:30:36,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 05:30:36,836 INFO core: _init_accounts coroutine started
2026-09-03 05:30:36,837 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 05:30:36,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:35:44,637 INFO core: Event loop thread started, running loop forever
2026-09-03 05:35:44,939 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 05:35:44,945 INFO core: _init_accounts coroutine started
2026-09-03 05:35:44,946 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 05:35:44,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:40:48,586 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 05:40:48,587 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 05:40:48,589 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 05:40:48,591 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 05:40:48,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:45:11,419 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:50:45,169 INFO core: Event loop thread started, running loop forever
2026-09-03 05:50:45,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 05:50:45,474 INFO core: _init_accounts coroutine started
2026-09-03 05:50:45,477 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 05:50:45,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 05:55:12,550 INFO core: Event loop thread started, running loop forever
2026-09-03 05:55:12,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 05:55:12,855 INFO core: _init_accounts coroutine started
2026-09-03 05:55:12,856 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 05:55:12,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:00:07,716 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:05:56,596 INFO core: Event loop thread started, running loop forever
2026-09-03 06:05:56,897 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 06:05:56,899 INFO core: _init_accounts coroutine started
2026-09-03 06:05:56,902 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 06:05:56,907 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:10:50,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:15:54,721 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 06:15:54,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:20:26,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:25:39,722 INFO core: Event loop thread started, running loop forever
2026-09-03 06:25:40,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 06:25:40,029 INFO core: _init_accounts coroutine started
2026-09-03 06:25:40,030 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 06:25:40,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:25:40,052 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 06:25:40,056 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 06:30:03,305 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 06:30:52,932 INFO core: Event loop thread started, running loop forever
2026-09-03 06:30:53,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 06:30:53,239 INFO core: _init_accounts coroutine started
2026-09-03 06:30:53,239 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 06:30:53,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:35:14,453 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 06:35:14,454 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 06:35:14,458 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:40:12,610 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 06:40:12,615 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 06:40:12,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:45:18,491 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 06:45:18,493 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 06:45:18,493 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 06:45:55,126 INFO core: Event loop thread started, running loop forever
2026-09-03 06:45:55,427 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 06:45:55,430 INFO core: _init_accounts coroutine started
2026-09-03 06:45:55,431 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 06:45:55,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:50:24,755 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 06:50:24,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:55:32,106 INFO core: Event loop thread started, running loop forever
2026-09-03 06:55:32,407 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 06:55:32,413 INFO core: _init_accounts coroutine started
2026-09-03 06:55:32,413 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 06:55:32,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 06:55:32,421 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 06:55:32,422 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 06:55:32,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 06:55:32,425 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 07:00:39,559 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 07:00:39,559 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 07:00:39,560 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 07:00:43,396 INFO core: Event loop thread started, running loop forever
2026-09-03 07:00:43,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 07:00:43,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:05:22,243 INFO core: _init_accounts coroutine started
2026-09-03 07:05:22,245 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 07:05:22,252 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:10:37,331 INFO core: Event loop thread started, running loop forever
2026-09-03 07:10:37,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 07:10:37,645 INFO core: _init_accounts coroutine started
2026-09-03 07:10:37,648 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 07:10:37,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:15:32,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:20:11,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:25:17,414 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 07:25:25,006 INFO core: Event loop thread started, running loop forever
2026-09-03 07:25:25,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 07:25:25,313 INFO core: _init_accounts coroutine started
2026-09-03 07:25:25,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 07:25:25,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:30:32,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 07:30:44,443 INFO core: Event loop thread started, running loop forever
2026-09-03 07:30:44,743 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 07:30:44,749 INFO core: _init_accounts coroutine started
2026-09-03 07:30:44,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 07:30:44,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:35:08,780 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 07:35:08,780 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 07:35:08,781 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 07:35:08,782 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 07:35:08,791 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:40:14,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 07:40:14,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 07:40:14,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 07:40:32,576 INFO core: Event loop thread started, running loop forever
2026-09-03 07:40:32,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 07:40:32,880 INFO core: _init_accounts coroutine started
2026-09-03 07:40:32,880 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 07:40:32,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:45:39,450 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 07:45:39,451 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 07:45:39,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 07:45:39,456 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 07:45:40,463 INFO core: Event loop thread started, running loop forever
2026-09-03 07:45:40,764 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 07:45:40,766 INFO core: _init_accounts coroutine started
2026-09-03 07:45:40,769 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 07:45:40,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:50:43,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 07:55:35,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 07:55:35,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 07:55:35,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 07:55:35,109 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 07:55:35,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:00:41,468 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 08:00:41,468 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 08:00:41,469 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 08:00:43,494 INFO core: Event loop thread started, running loop forever
2026-09-03 08:00:43,804 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 08:00:43,808 INFO core: _init_accounts coroutine started
2026-09-03 08:00:43,808 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 08:00:43,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:05:05,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:10:12,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 08:10:32,955 INFO core: Event loop thread started, running loop forever
2026-09-03 08:10:33,256 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 08:10:33,261 INFO core: _init_accounts coroutine started
2026-09-03 08:10:33,262 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 08:10:33,268 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:15:07,311 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 08:15:07,311 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 08:15:07,313 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 08:15:07,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:20:38,081 INFO core: Event loop thread started, running loop forever
2026-09-03 08:20:38,384 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 08:20:38,389 INFO core: _init_accounts coroutine started
2026-09-03 08:20:38,390 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 08:20:38,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:25:13,124 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 08:25:13,133 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:30:13,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:35:30,755 INFO core: Event loop thread started, running loop forever
2026-09-03 08:35:31,056 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 08:35:31,062 INFO core: _init_accounts coroutine started
2026-09-03 08:35:31,063 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 08:35:31,076 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:40:35,290 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 08:40:35,291 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 08:40:35,292 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 08:40:35,294 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 08:40:35,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:45:40,645 INFO core: Event loop thread started, running loop forever
2026-09-03 08:45:40,946 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 08:45:40,950 INFO core: _init_accounts coroutine started
2026-09-03 08:45:40,950 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 08:45:40,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:50:33,212 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 08:50:33,212 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 08:50:33,214 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 08:50:33,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 08:50:33,217 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 08:55:40,546 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 08:55:40,546 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 08:55:40,546 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 08:55:52,836 INFO core: Event loop thread started, running loop forever
2026-09-03 08:55:53,137 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 08:55:53,146 INFO core: _init_accounts coroutine started
2026-09-03 08:55:53,146 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 08:55:53,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:00:24,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:05:31,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 09:05:31,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 09:05:31,410 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-03 09:05:31,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 09:05:31,411 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 09:05:31,411 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 09:05:31,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 09:05:31,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 09:05:31,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 09:05:48,529 INFO core: Event loop thread started, running loop forever
2026-09-03 09:05:48,829 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 09:05:48,835 INFO core: _init_accounts coroutine started
2026-09-03 09:05:48,835 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 09:05:48,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:10:35,633 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 09:10:35,634 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 09:10:35,636 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 09:10:35,641 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 09:10:35,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:15:41,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 09:15:41,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 09:15:41,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 09:15:49,679 INFO core: Event loop thread started, running loop forever
2026-09-03 09:15:49,980 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 09:15:49,984 INFO core: _init_accounts coroutine started
2026-09-03 09:15:49,986 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 09:15:49,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:20:17,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:25:18,551 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 09:25:18,552 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 09:25:18,554 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:30:25,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 09:30:25,434 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 09:30:25,435 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 09:30:25,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 09:30:25,435 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 09:30:25,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 09:30:46,081 INFO core: Event loop thread started, running loop forever
2026-09-03 09:30:46,382 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 09:30:46,387 INFO core: _init_accounts coroutine started
2026-09-03 09:30:46,388 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 09:30:46,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:35:10,575 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 09:35:10,576 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 09:35:10,578 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 09:35:10,580 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 09:35:10,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:40:17,366 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 09:40:17,367 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 09:40:17,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 09:40:49,926 INFO core: Event loop thread started, running loop forever
2026-09-03 09:40:50,227 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 09:40:50,230 INFO core: _init_accounts coroutine started
2026-09-03 09:40:50,232 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 09:40:50,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:45:16,814 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 09:45:16,816 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 09:45:16,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:50:21,944 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 09:50:21,944 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 09:50:21,949 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 09:50:21,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 09:55:27,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 09:55:41,506 INFO core: Event loop thread started, running loop forever
2026-09-03 09:55:41,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 09:55:41,811 INFO core: _init_accounts coroutine started
2026-09-03 09:55:41,812 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 09:55:41,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:00:45,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:05:34,665 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 10:05:34,665 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 10:05:34,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:10:51,827 INFO core: Event loop thread started, running loop forever
2026-09-03 10:10:52,128 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 10:10:52,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:15:43,777 INFO core: _init_accounts coroutine started
2026-09-03 10:15:43,777 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 10:15:43,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:20:35,047 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 10:20:35,047 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 10:20:35,051 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 10:20:35,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:20:35,053 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 10:25:53,297 INFO core: Event loop thread started, running loop forever
2026-09-03 10:25:53,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 10:25:53,604 INFO core: _init_accounts coroutine started
2026-09-03 10:25:53,605 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 10:25:53,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:30:52,311 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 10:30:52,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:35:20,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:40:39,612 INFO core: Event loop thread started, running loop forever
2026-09-03 10:40:39,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 10:40:39,921 INFO core: _init_accounts coroutine started
2026-09-03 10:40:39,922 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 10:40:39,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:40:39,939 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 10:40:39,939 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 10:40:39,942 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 10:45:31,565 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 10:45:31,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:47:45,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:50:47,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 10:55:22,075 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 10:55:22,076 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 10:55:22,082 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 10:55:22,082 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 10:55:22,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:00:03,392 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 11:00:03,393 WARNING core: Account 2: connect timed out after 35s
2026-09-03 11:00:03,393 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-03 11:00:03,394 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-03 11:00:03,394 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 11:00:03,395 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-03 11:00:03,396 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-03 11:00:36,367 INFO core: Event loop thread started, running loop forever
2026-09-03 11:00:36,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 11:00:36,676 INFO core: _init_accounts coroutine started
2026-09-03 11:00:36,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 11:00:36,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:05:12,540 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 11:05:12,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:10:40,411 INFO core: Event loop thread started, running loop forever
2026-09-03 11:10:40,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 11:10:40,716 INFO core: _init_accounts coroutine started
2026-09-03 11:10:40,717 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 11:10:40,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:15:52,682 INFO core: Event loop thread started, running loop forever
2026-09-03 11:15:52,983 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 11:15:52,986 INFO core: _init_accounts coroutine started
2026-09-03 11:15:52,987 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 11:15:52,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:20:14,197 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 11:20:14,200 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 11:20:14,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:20:14,204 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 11:25:45,490 INFO core: Event loop thread started, running loop forever
2026-09-03 11:25:45,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 11:25:45,795 INFO core: _init_accounts coroutine started
2026-09-03 11:25:45,796 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 11:25:45,803 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:30:21,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:30:21,922 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 11:30:21,923 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 11:35:27,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 11:35:27,418 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 11:35:33,310 INFO core: Event loop thread started, running loop forever
2026-09-03 11:35:33,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 11:35:33,619 INFO core: _init_accounts coroutine started
2026-09-03 11:35:33,620 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 11:35:33,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:40:23,971 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 11:40:23,981 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:45:26,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:50:18,398 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-03 11:50:18,400 INFO core: _init_accounts coroutine started
2026-09-03 11:50:18,401 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 11:50:18,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 11:55:32,315 INFO core: Event loop thread started, running loop forever
2026-09-03 11:55:32,616 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 11:55:32,619 INFO core: _init_accounts coroutine started
2026-09-03 11:55:32,620 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 11:55:32,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:00:39,494 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 12:01:00,677 INFO core: Event loop thread started, running loop forever
2026-09-03 12:01:00,978 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 12:01:00,984 INFO core: _init_accounts coroutine started
2026-09-03 12:01:00,985 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 12:01:00,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:05:25,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:05:25,807 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 12:05:25,808 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 12:10:21,598 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 12:10:21,603 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 12:10:21,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:15:20,554 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:20:15,749 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:25:05,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:30:11,151 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:35:06,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:40:30,006 INFO core: Event loop thread started, running loop forever
2026-09-03 12:40:30,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 12:40:30,310 INFO core: _init_accounts coroutine started
2026-09-03 12:40:30,313 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 12:40:30,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:40:30,335 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 12:40:30,335 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 12:45:29,422 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:45:29,422 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 12:50:35,259 INFO core: Event loop thread started, running loop forever
2026-09-03 12:50:35,565 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 12:50:35,575 INFO core: _init_accounts coroutine started
2026-09-03 12:50:35,576 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 12:50:35,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 12:55:41,511 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 12:55:42,272 INFO core: Event loop thread started, running loop forever
2026-09-03 12:55:42,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 12:55:42,578 INFO core: _init_accounts coroutine started
2026-09-03 12:55:42,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 12:55:42,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:00:19,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:05:25,186 INFO core: Event loop thread started, running loop forever
2026-09-03 13:05:25,487 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 13:05:25,491 INFO core: _init_accounts coroutine started
2026-09-03 13:05:25,493 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 13:05:25,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:10:31,452 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-03 13:10:33,570 INFO core: Event loop thread started, running loop forever
2026-09-03 13:10:33,871 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 13:10:33,875 INFO core: _init_accounts coroutine started
2026-09-03 13:10:33,876 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 13:10:33,883 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:15:03,432 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 13:15:03,432 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 13:15:03,432 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-03 13:15:03,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 13:15:03,433 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 13:15:03,433 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 13:15:03,433 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 13:15:03,433 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 13:15:03,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 13:15:51,511 INFO core: Event loop thread started, running loop forever
2026-09-03 13:15:51,813 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 13:15:51,818 INFO core: _init_accounts coroutine started
2026-09-03 13:15:51,820 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 13:15:51,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:20:51,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:25:19,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:25:19,330 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 13:25:19,330 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 13:30:26,426 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 13:30:26,427 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 13:30:26,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 13:30:26,429 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 13:30:26,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 13:30:51,639 INFO core: Event loop thread started, running loop forever
2026-09-03 13:30:51,947 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 13:30:51,952 INFO core: _init_accounts coroutine started
2026-09-03 13:30:51,953 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 13:30:51,979 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:35:07,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:40:18,057 INFO core: Event loop thread started, running loop forever
2026-09-03 13:40:18,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 13:40:18,364 INFO core: _init_accounts coroutine started
2026-09-03 13:40:18,364 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 13:40:18,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:45:25,390 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 13:45:31,249 INFO core: Event loop thread started, running loop forever
2026-09-03 13:45:31,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 13:45:31,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:50:38,403 INFO core: _init_accounts coroutine started
2026-09-03 13:50:38,403 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 13:50:38,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 13:50:43,862 INFO core: Event loop thread started, running loop forever
2026-09-03 13:50:44,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 13:50:44,167 INFO core: _init_accounts coroutine started
2026-09-03 13:50:44,169 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 13:50:44,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 13:55:30,651 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 13:55:30,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:00:07,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:05:31,654 INFO core: Event loop thread started, running loop forever
2026-09-03 14:05:31,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 14:05:31,969 INFO core: _init_accounts coroutine started
2026-09-03 14:05:31,969 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 14:05:31,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:10:13,441 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:15:14,076 INFO core: Event loop thread started, running loop forever
2026-09-03 14:15:14,378 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 14:15:14,382 INFO core: _init_accounts coroutine started
2026-09-03 14:15:14,385 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 14:15:14,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:15:20,088 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 14:20:53,297 INFO core: Event loop thread started, running loop forever
2026-09-03 14:20:53,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 14:20:53,603 INFO core: _init_accounts coroutine started
2026-09-03 14:20:53,605 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 14:20:53,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:25:32,186 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 14:25:32,186 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 14:25:32,189 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 14:25:32,192 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 14:25:32,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:30:40,509 INFO core: Event loop thread started, running loop forever
2026-09-03 14:30:40,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 14:30:40,816 INFO core: _init_accounts coroutine started
2026-09-03 14:30:40,816 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 14:30:40,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:35:28,519 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 14:35:28,520 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 14:35:28,522 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 14:35:28,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:40:34,455 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 14:40:34,456 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 14:40:47,738 INFO core: Event loop thread started, running loop forever
2026-09-03 14:40:48,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 14:40:48,045 INFO core: _init_accounts coroutine started
2026-09-03 14:40:48,046 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 14:40:48,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:45:11,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:50:18,470 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 14:50:50,712 INFO core: Event loop thread started, running loop forever
2026-09-03 14:50:51,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 14:50:51,019 INFO core: _init_accounts coroutine started
2026-09-03 14:50:51,019 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 14:50:51,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 14:55:22,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:00:17,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:05:22,305 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 15:05:22,305 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 15:05:22,309 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 15:05:22,309 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:10:18,283 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 15:10:18,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:15:20,166 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:20:08,623 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 15:20:08,624 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 15:20:08,629 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 15:20:08,630 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 15:20:08,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:25:06,153 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 15:25:06,155 WARNING core: Account 2: connect timed out after 35s
2026-09-03 15:25:06,155 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-03 15:25:06,156 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-03 15:25:06,157 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 15:25:06,159 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-03 15:25:06,159 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-03 15:25:06,311 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:30:04,439 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 15:30:04,440 WARNING core: Account 2: connect timed out after 35s
2026-09-03 15:30:04,440 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-03 15:30:04,441 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-03 15:30:04,442 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 15:30:04,444 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-03 15:30:04,444 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-03 15:30:16,892 INFO core: Event loop thread started, running loop forever
2026-09-03 15:30:17,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 15:30:17,198 INFO core: _init_accounts coroutine started
2026-09-03 15:30:17,199 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 15:30:17,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:35:10,183 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 15:35:10,204 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:40:49,186 INFO core: Event loop thread started, running loop forever
2026-09-03 15:40:49,487 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 15:40:49,494 INFO core: _init_accounts coroutine started
2026-09-03 15:40:49,494 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 15:40:49,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:45:49,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:50:49,708 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 15:50:49,709 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 15:50:49,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 15:55:16,719 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 15:55:16,727 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 15:55:16,740 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:00:19,020 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:05:48,043 INFO core: Event loop thread started, running loop forever
2026-09-03 16:05:48,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 16:05:48,348 INFO core: _init_accounts coroutine started
2026-09-03 16:05:48,349 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 16:05:48,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:10:14,009 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 16:10:14,009 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 16:10:14,015 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 16:10:14,016 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 16:10:14,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:15:25,898 INFO core: Event loop thread started, running loop forever
2026-09-03 16:15:26,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 16:15:26,203 INFO core: _init_accounts coroutine started
2026-09-03 16:15:26,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 16:15:26,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:20:43,897 INFO core: Event loop thread started, running loop forever
2026-09-03 16:20:44,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 16:20:44,204 INFO core: _init_accounts coroutine started
2026-09-03 16:20:44,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 16:20:44,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:25:30,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:30:37,364 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 16:30:37,364 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 16:30:37,364 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-03 16:30:37,364 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 16:30:37,365 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 16:30:37,365 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 16:30:37,365 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 16:30:37,365 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 16:30:37,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 16:30:53,207 INFO core: Event loop thread started, running loop forever
2026-09-03 16:30:53,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 16:30:53,514 INFO core: _init_accounts coroutine started
2026-09-03 16:30:53,515 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 16:30:53,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:35:44,012 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 16:35:44,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:40:13,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:45:17,072 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-03 16:45:17,072 INFO core: _init_accounts coroutine started
2026-09-03 16:45:17,073 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 16:45:17,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:50:14,597 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 16:50:14,597 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 16:50:14,599 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 16:50:14,600 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 16:50:14,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:55:12,460 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 16:55:12,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 16:55:12,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 16:55:12,466 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 16:55:12,467 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 17:00:18,463 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 17:00:18,464 WARNING core: Account 2: connect timed out after 35s
2026-09-03 17:00:44,676 INFO core: Event loop thread started, running loop forever
2026-09-03 17:00:44,977 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 17:00:44,984 INFO core: _init_accounts coroutine started
2026-09-03 17:00:44,984 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 17:00:44,992 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:05:46,304 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 17:05:46,304 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 17:05:46,305 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:10:46,211 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 17:10:46,223 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:15:23,007 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 17:15:23,023 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 17:15:23,024 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 17:15:23,030 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 17:15:23,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:15:23,038 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 17:20:26,650 WARNING core: Account 2: connect timed out after 35s
2026-09-03 17:20:26,651 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-03 17:20:26,652 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-03 17:20:26,653 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 17:20:26,654 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-03 17:20:26,654 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-03 17:20:26,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:25:15,886 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 17:25:15,887 WARNING core: Account 2: connect timed out after 35s
2026-09-03 17:25:15,888 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-03 17:25:15,888 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-03 17:25:15,889 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 17:25:15,890 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-03 17:25:15,890 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-03 17:25:15,921 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:30:22,411 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 17:30:22,411 WARNING core: Account 2: connect timed out after 35s
2026-09-03 17:30:22,411 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-03 17:30:22,411 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-03 17:30:22,411 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 17:30:22,412 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-03 17:30:22,412 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-03 17:30:49,611 INFO core: Event loop thread started, running loop forever
2026-09-03 17:30:49,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 17:30:49,920 INFO core: _init_accounts coroutine started
2026-09-03 17:30:49,921 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 17:30:49,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:35:44,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:40:08,757 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 17:40:08,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:45:53,726 INFO core: Event loop thread started, running loop forever
2026-09-03 17:45:54,026 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 17:45:54,030 INFO core: _init_accounts coroutine started
2026-09-03 17:45:54,030 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 17:45:54,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:50:55,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 17:55:52,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:00:44,763 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 18:00:44,763 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 18:00:44,766 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 18:00:44,770 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 18:00:44,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:05:41,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:10:17,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:15:05,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:20:09,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:25:16,383 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 18:25:51,070 INFO core: Event loop thread started, running loop forever
2026-09-03 18:25:51,371 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 18:25:51,374 INFO core: _init_accounts coroutine started
2026-09-03 18:25:51,376 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 18:25:51,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:30:11,205 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 18:30:11,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:35:31,666 INFO core: Event loop thread started, running loop forever
2026-09-03 18:35:31,967 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 18:35:31,971 INFO core: _init_accounts coroutine started
2026-09-03 18:35:31,971 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 18:35:31,979 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:40:37,260 INFO core: Event loop thread started, running loop forever
2026-09-03 18:40:37,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 18:40:37,566 INFO core: _init_accounts coroutine started
2026-09-03 18:40:37,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 18:40:37,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:45:37,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:50:43,037 INFO core: Event loop thread started, running loop forever
2026-09-03 18:50:43,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 18:50:43,342 INFO core: _init_accounts coroutine started
2026-09-03 18:50:43,344 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 18:50:43,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 18:55:19,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:00:16,366 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 19:00:16,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:05:48,951 INFO core: Event loop thread started, running loop forever
2026-09-03 19:05:49,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 19:05:49,257 INFO core: _init_accounts coroutine started
2026-09-03 19:05:49,259 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 19:05:49,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:05:49,271 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 19:10:10,523 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 19:10:10,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:15:17,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 19:15:17,431 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 19:15:17,432 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 19:15:17,432 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 19:15:17,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 19:15:17,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 19:15:22,609 INFO core: Event loop thread started, running loop forever
2026-09-03 19:15:22,910 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 19:15:22,913 INFO core: _init_accounts coroutine started
2026-09-03 19:15:22,916 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 19:15:22,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:20:33,412 INFO core: Event loop thread started, running loop forever
2026-09-03 19:20:33,714 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 19:20:33,720 INFO core: _init_accounts coroutine started
2026-09-03 19:20:33,721 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 19:20:33,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:20:33,735 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 19:20:33,735 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 19:20:33,737 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 19:25:40,394 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 19:25:40,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 19:25:40,394 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 19:25:40,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 19:25:44,527 INFO core: Event loop thread started, running loop forever
2026-09-03 19:25:44,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 19:25:44,839 INFO core: _init_accounts coroutine started
2026-09-03 19:25:44,840 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 19:25:44,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:30:12,016 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:35:18,431 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 19:35:18,431 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 19:35:18,431 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-03 19:35:18,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 19:35:18,431 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 19:35:18,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 19:35:18,432 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 19:35:18,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 19:35:18,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 19:35:45,443 INFO core: Event loop thread started, running loop forever
2026-09-03 19:35:45,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 19:35:45,749 INFO core: _init_accounts coroutine started
2026-09-03 19:35:45,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 19:35:45,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:40:38,952 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 19:40:38,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:45:13,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:50:49,601 INFO core: Event loop thread started, running loop forever
2026-09-03 19:50:49,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 19:50:49,906 INFO core: _init_accounts coroutine started
2026-09-03 19:50:49,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 19:50:49,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 19:55:09,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:00:03,418 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 20:00:20,105 INFO core: Event loop thread started, running loop forever
2026-09-03 20:00:20,406 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 20:00:20,409 INFO core: _init_accounts coroutine started
2026-09-03 20:00:20,411 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 20:00:20,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:05:21,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:10:07,887 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 20:10:07,887 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 20:10:07,896 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 20:10:07,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:15:11,159 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 20:15:11,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:20:18,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 20:20:18,420 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 20:20:18,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 20:20:50,851 INFO core: Event loop thread started, running loop forever
2026-09-03 20:20:51,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 20:20:51,154 INFO core: _init_accounts coroutine started
2026-09-03 20:20:51,155 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 20:20:51,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:25:44,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:30:42,264 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 20:30:42,267 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 20:30:42,273 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 20:30:42,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:30:42,275 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 20:35:08,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:40:39,309 INFO core: Event loop thread started, running loop forever
2026-09-03 20:40:39,610 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 20:40:39,617 INFO core: _init_accounts coroutine started
2026-09-03 20:40:39,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:40:39,623 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 20:45:46,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 20:45:46,933 INFO core: Event loop thread started, running loop forever
2026-09-03 20:45:47,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 20:45:47,240 INFO core: _init_accounts coroutine started
2026-09-03 20:45:47,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 20:45:47,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:50:43,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 20:55:50,422 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 20:55:50,422 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 20:55:50,422 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-03 20:55:50,423 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 20:55:50,423 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-03 20:55:50,423 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 20:55:50,423 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-03 20:55:50,423 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 20:55:50,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 20:55:51,701 INFO core: Event loop thread started, running loop forever
2026-09-03 20:55:52,003 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 20:55:52,010 INFO core: _init_accounts coroutine started
2026-09-03 20:55:52,022 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 20:55:52,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:00:32,623 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 21:00:32,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:05:31,389 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:10:45,899 INFO core: Event loop thread started, running loop forever
2026-09-03 21:10:46,200 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 21:10:46,206 INFO core: _init_accounts coroutine started
2026-09-03 21:10:46,207 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 21:10:46,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:15:14,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:20:33,776 INFO core: Event loop thread started, running loop forever
2026-09-03 21:20:34,078 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 21:20:34,082 INFO core: _init_accounts coroutine started
2026-09-03 21:20:34,084 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 21:20:34,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:25:12,194 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 21:25:12,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:30:13,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:35:37,280 INFO core: Event loop thread started, running loop forever
2026-09-03 21:35:37,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 21:35:37,595 INFO core: _init_accounts coroutine started
2026-09-03 21:35:37,596 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 21:35:37,616 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 21:35:37,616 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 21:35:37,617 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 21:35:37,619 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 21:35:37,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:40:12,223 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 21:40:12,223 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 21:40:12,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:45:18,422 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 21:45:51,585 INFO core: Event loop thread started, running loop forever
2026-09-03 21:45:51,886 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 21:45:51,892 INFO core: _init_accounts coroutine started
2026-09-03 21:45:51,893 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 21:45:51,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:50:25,050 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 21:50:25,050 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 21:50:25,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 21:55:13,471 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 21:55:13,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:00:42,929 INFO core: Event loop thread started, running loop forever
2026-09-03 22:00:43,231 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 22:00:43,234 INFO core: _init_accounts coroutine started
2026-09-03 22:00:43,234 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 22:00:43,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:05:07,334 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 22:05:07,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:10:17,413 INFO core: Event loop thread started, running loop forever
2026-09-03 22:10:17,714 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 22:10:17,718 INFO core: _init_accounts coroutine started
2026-09-03 22:10:17,720 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 22:10:17,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:15:23,350 INFO core: Event loop thread started, running loop forever
2026-09-03 22:15:23,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 22:15:23,654 INFO core: _init_accounts coroutine started
2026-09-03 22:15:23,655 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 22:15:23,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:20:30,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 22:20:33,499 INFO core: Event loop thread started, running loop forever
2026-09-03 22:20:33,800 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 22:20:33,804 INFO core: _init_accounts coroutine started
2026-09-03 22:20:33,804 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 22:20:33,810 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:25:26,902 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 22:25:26,902 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 22:25:26,903 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 22:25:26,904 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 22:25:26,915 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 22:25:26,916 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 22:25:26,919 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 22:25:26,920 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 22:25:26,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:30:32,497 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-03 22:30:32,498 WARNING core: Account 2: connect timed out after 35s
2026-09-03 22:30:32,499 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-03 22:30:32,499 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-03 22:30:32,500 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-03 22:30:32,501 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-03 22:30:32,501 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-03 22:30:41,311 INFO core: Event loop thread started, running loop forever
2026-09-03 22:30:41,613 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 22:30:41,617 INFO core: _init_accounts coroutine started
2026-09-03 22:30:41,617 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 22:30:41,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:35:17,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:40:23,400 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-03 22:40:41,074 INFO core: Event loop thread started, running loop forever
2026-09-03 22:40:41,375 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 22:40:41,378 INFO core: _init_accounts coroutine started
2026-09-03 22:40:41,380 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 22:40:41,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:45:44,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:50:38,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 22:55:37,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 22:55:37,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 22:55:37,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:00:45,224 INFO core: Event loop thread started, running loop forever
2026-09-03 23:00:45,525 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 23:00:45,537 INFO core: _init_accounts coroutine started
2026-09-03 23:00:45,538 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 23:00:45,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:05:31,594 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 23:05:31,595 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 23:05:31,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:10:08,680 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 23:10:08,682 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 23:10:08,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:15:52,534 INFO core: Event loop thread started, running loop forever
2026-09-03 23:15:52,842 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 23:15:52,848 INFO core: _init_accounts coroutine started
2026-09-03 23:15:52,848 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 23:15:52,866 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 23:15:52,866 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 23:15:52,868 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 23:15:52,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:20:26,325 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 23:20:26,353 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:25:33,433 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 23:25:33,434 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 23:25:33,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-03 23:25:42,421 INFO core: Event loop thread started, running loop forever
2026-09-03 23:25:42,722 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 23:25:42,727 INFO core: _init_accounts coroutine started
2026-09-03 23:25:42,728 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 23:25:42,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:30:55,859 INFO core: Event loop thread started, running loop forever
2026-09-03 23:30:56,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-03 23:30:56,164 INFO core: _init_accounts coroutine started
2026-09-03 23:30:56,164 INFO core: _init_accounts_inner: starting DB migrations
2026-09-03 23:30:56,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:35:39,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:40:37,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:40:37,025 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-03 23:45:07,095 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-03 23:45:07,105 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-03 23:45:07,136 INFO core: _init_accounts_inner: reloading LLM config
2026-09-03 23:45:07,164 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-03 23:45:07,164 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-03 23:45:07,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:50:11,602 INFO core: status() clients=0 connected=False forwarding=False
2026-09-03 23:55:13,850 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-03 23:55:13,851 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-03 23:55:13,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:00:26,325 INFO core: Event loop thread started, running loop forever
2026-09-04 00:00:26,626 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 00:00:26,630 INFO core: _init_accounts coroutine started
2026-09-04 00:00:26,631 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 00:00:26,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:05:10,841 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 00:05:10,841 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 00:05:10,847 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 00:05:10,849 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 00:05:10,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:05:10,861 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 00:05:10,863 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 00:05:10,868 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 00:05:10,869 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 00:10:09,870 WARNING core: Account 2: connect timed out after 35s
2026-09-04 00:10:09,872 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 00:10:09,872 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 00:10:09,873 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 00:10:09,874 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 00:10:09,874 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 00:10:09,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:15:16,183 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 00:15:16,184 WARNING core: Account 2: connect timed out after 35s
2026-09-04 00:15:16,184 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-04 00:15:16,184 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-04 00:15:16,184 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 00:15:16,185 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-04 00:15:16,185 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-04 00:15:16,192 INFO core: Event loop thread started, running loop forever
2026-09-04 00:15:16,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 00:15:16,495 INFO core: _init_accounts coroutine started
2026-09-04 00:15:16,497 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 00:15:16,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:20:22,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 00:20:29,298 INFO core: Event loop thread started, running loop forever
2026-09-04 00:20:29,599 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 00:20:29,602 INFO core: _init_accounts coroutine started
2026-09-04 00:20:29,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 00:20:29,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:25:17,818 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 00:25:17,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 00:25:17,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:25:17,819 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 00:30:02,426 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 00:30:02,427 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 00:30:29,300 INFO core: Event loop thread started, running loop forever
2026-09-04 00:30:29,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 00:30:29,605 INFO core: _init_accounts coroutine started
2026-09-04 00:30:29,607 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 00:30:29,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:35:36,089 INFO core: Event loop thread started, running loop forever
2026-09-04 00:35:36,391 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 00:35:36,395 INFO core: _init_accounts coroutine started
2026-09-04 00:35:36,396 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 00:35:36,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:40:07,892 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 00:40:07,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 00:40:07,894 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 00:40:07,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:40:07,896 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 00:45:52,769 INFO core: Event loop thread started, running loop forever
2026-09-04 00:45:53,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 00:45:53,075 INFO core: _init_accounts coroutine started
2026-09-04 00:45:53,075 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 00:45:53,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:50:05,063 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 00:50:05,063 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 00:50:05,066 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 00:50:05,069 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 00:50:05,078 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 00:55:26,927 INFO core: Event loop thread started, running loop forever
2026-09-04 00:55:27,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 00:55:27,239 INFO core: _init_accounts coroutine started
2026-09-04 00:55:27,239 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 00:55:27,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:00:14,324 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:05:21,388 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 01:05:21,388 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 01:05:21,388 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-04 01:05:21,389 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 01:05:21,389 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 01:05:21,389 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 01:05:21,389 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 01:05:21,389 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 01:05:21,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 01:05:46,965 INFO core: Event loop thread started, running loop forever
2026-09-04 01:05:47,266 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 01:05:47,271 INFO core: _init_accounts coroutine started
2026-09-04 01:05:47,271 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 01:05:47,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:10:32,685 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 01:10:32,686 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 01:10:32,687 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 01:10:32,688 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 01:10:32,699 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 01:10:32,700 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 01:10:32,706 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 01:10:32,707 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 01:10:32,708 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:15:42,829 INFO core: Event loop thread started, running loop forever
2026-09-04 01:15:43,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 01:15:43,139 INFO core: _init_accounts coroutine started
2026-09-04 01:15:43,139 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 01:15:43,149 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 01:15:43,149 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 01:15:43,150 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 01:15:43,151 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 01:15:43,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:20:30,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:20:30,328 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 01:20:30,328 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 01:25:37,425 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 01:25:47,510 INFO core: Event loop thread started, running loop forever
2026-09-04 01:25:47,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 01:25:47,820 INFO core: _init_accounts coroutine started
2026-09-04 01:25:47,821 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 01:25:47,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:30:27,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:35:05,267 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 01:35:05,267 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 01:35:05,268 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 01:35:05,269 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 01:35:05,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:40:19,960 INFO core: Event loop thread started, running loop forever
2026-09-04 01:40:20,262 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 01:40:20,266 INFO core: _init_accounts coroutine started
2026-09-04 01:40:20,267 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 01:40:20,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:45:26,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 01:45:50,794 INFO core: Event loop thread started, running loop forever
2026-09-04 01:45:51,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 01:45:51,099 INFO core: _init_accounts coroutine started
2026-09-04 01:45:51,101 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 01:45:51,109 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:50:36,812 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 01:50:36,812 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 01:50:36,813 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 01:50:36,815 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 01:50:36,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:55:31,185 INFO core: Event loop thread started, running loop forever
2026-09-04 01:55:31,487 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 01:55:31,490 INFO core: _init_accounts coroutine started
2026-09-04 01:55:31,491 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 01:55:31,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 01:55:42,246 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 02:00:26,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 02:00:26,429 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 02:00:26,438 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 02:00:26,440 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 02:00:26,452 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 02:00:26,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 02:00:26,457 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 02:00:26,458 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 02:00:26,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:05:24,364 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 02:05:24,365 WARNING core: Account 2: connect timed out after 35s
2026-09-04 02:05:24,366 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 02:05:24,366 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 02:05:24,366 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 02:05:24,368 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 02:05:24,368 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 02:05:24,372 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:10:08,961 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 02:10:08,961 WARNING core: Account 2: connect timed out after 35s
2026-09-04 02:10:08,961 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-04 02:10:08,961 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-04 02:10:08,962 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 02:10:08,962 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-04 02:10:08,963 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-04 02:10:08,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:15:13,759 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 02:15:13,834 WARNING core: Account 2: connect timed out after 35s
2026-09-04 02:15:13,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:15:13,835 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-04 02:20:19,399 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-04 02:20:19,400 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 02:20:19,401 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-04 02:20:19,402 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-04 02:20:44,255 INFO core: Event loop thread started, running loop forever
2026-09-04 02:20:44,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 02:20:44,561 INFO core: _init_accounts coroutine started
2026-09-04 02:20:44,563 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 02:20:44,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:25:30,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:30:22,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 02:30:22,582 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 02:30:22,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:35:22,730 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 02:35:22,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:40:15,229 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 02:40:15,240 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:45:03,394 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 02:45:03,395 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 02:45:03,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 02:45:52,833 INFO core: Event loop thread started, running loop forever
2026-09-04 02:45:53,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 02:45:53,146 INFO core: _init_accounts coroutine started
2026-09-04 02:45:53,147 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 02:45:53,151 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:50:30,300 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 02:50:30,301 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 02:50:30,302 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 02:50:30,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 02:55:37,388 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 02:55:37,389 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 02:55:46,711 INFO core: Event loop thread started, running loop forever
2026-09-04 02:55:47,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 02:55:47,017 INFO core: _init_accounts coroutine started
2026-09-04 02:55:47,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 02:55:47,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:00:22,954 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 03:00:22,954 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 03:00:22,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:05:28,483 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 03:05:28,495 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 03:05:28,496 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 03:05:28,496 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 03:05:28,496 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 03:05:28,497 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 03:05:50,209 INFO core: Event loop thread started, running loop forever
2026-09-04 03:05:50,512 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 03:05:50,517 INFO core: _init_accounts coroutine started
2026-09-04 03:05:50,518 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 03:05:50,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:10:38,678 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:15:28,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:20:04,839 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 03:20:04,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:25:23,473 INFO core: Event loop thread started, running loop forever
2026-09-04 03:25:23,775 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 03:25:23,785 INFO core: _init_accounts coroutine started
2026-09-04 03:25:23,786 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 03:25:23,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:30:42,116 INFO core: Event loop thread started, running loop forever
2026-09-04 03:30:42,417 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 03:30:42,427 INFO core: _init_accounts coroutine started
2026-09-04 03:30:42,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:30:42,446 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 03:35:47,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:40:28,592 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:45:22,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:50:29,457 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 03:50:44,209 INFO core: Event loop thread started, running loop forever
2026-09-04 03:50:44,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 03:50:44,514 INFO core: _init_accounts coroutine started
2026-09-04 03:50:44,517 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 03:50:44,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 03:55:05,187 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 03:55:05,187 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 03:55:05,188 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 03:55:05,189 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:00:12,435 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 04:00:12,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 04:00:12,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 04:00:12,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 04:00:57,037 INFO core: Event loop thread started, running loop forever
2026-09-04 04:00:57,338 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 04:00:57,342 INFO core: _init_accounts coroutine started
2026-09-04 04:00:57,344 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 04:00:57,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:05:00,296 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 04:05:00,297 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 04:05:00,301 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 04:05:00,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:05:00,306 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 04:05:30,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:10:44,043 INFO core: Event loop thread started, running loop forever
2026-09-04 04:10:44,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 04:10:44,348 INFO core: _init_accounts coroutine started
2026-09-04 04:10:44,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 04:10:44,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:15:12,450 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 04:15:12,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:20:23,951 INFO core: Event loop thread started, running loop forever
2026-09-04 04:20:24,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 04:20:24,258 INFO core: _init_accounts coroutine started
2026-09-04 04:20:24,260 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 04:20:24,364 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 04:20:24,364 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 04:20:24,365 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:25:31,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 04:25:31,445 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-04 04:25:31,446 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 04:25:31,447 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 04:25:31,447 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 04:25:31,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 04:25:50,514 INFO core: Event loop thread started, running loop forever
2026-09-04 04:25:50,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 04:25:50,819 INFO core: _init_accounts coroutine started
2026-09-04 04:25:50,820 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 04:25:50,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:30:55,635 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 04:30:55,636 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 04:30:55,641 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 04:30:55,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:35:21,566 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 04:35:21,568 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:40:27,982 INFO core: Event loop thread started, running loop forever
2026-09-04 04:40:28,283 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 04:40:28,288 INFO core: _init_accounts coroutine started
2026-09-04 04:40:28,289 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 04:40:28,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:45:13,399 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-04 04:45:13,412 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-04 04:50:26,517 INFO core: Event loop thread started, running loop forever
2026-09-04 04:50:26,818 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 04:50:26,824 INFO core: _init_accounts coroutine started
2026-09-04 04:50:26,824 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 04:50:26,831 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 04:55:05,914 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 04:55:05,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:00:52,464 INFO core: Event loop thread started, running loop forever
2026-09-04 05:00:52,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 05:00:52,771 INFO core: _init_accounts coroutine started
2026-09-04 05:00:52,771 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 05:00:52,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:05:49,019 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:10:29,724 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 05:10:29,725 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 05:10:29,730 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 05:10:29,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:15:07,366 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 05:15:07,368 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:20:14,603 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 05:20:32,722 INFO core: Event loop thread started, running loop forever
2026-09-04 05:20:33,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 05:20:33,027 INFO core: _init_accounts coroutine started
2026-09-04 05:20:33,031 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 05:20:33,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:25:16,896 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 05:25:16,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:30:52,239 INFO core: Event loop thread started, running loop forever
2026-09-04 05:30:52,545 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 05:30:52,554 INFO core: _init_accounts coroutine started
2026-09-04 05:30:52,554 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 05:30:52,557 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:35:38,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:40:37,405 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 05:40:37,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:40:37,408 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 05:45:44,484 INFO core: Event loop thread started, running loop forever
2026-09-04 05:45:44,786 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 05:45:44,791 INFO core: _init_accounts coroutine started
2026-09-04 05:45:44,792 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 05:45:44,798 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:50:15,913 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 05:50:15,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 05:55:38,413 INFO core: Event loop thread started, running loop forever
2026-09-04 05:55:38,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 05:55:38,720 INFO core: _init_accounts coroutine started
2026-09-04 05:55:38,723 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 05:55:38,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:00:45,430 INFO core: Event loop thread started, running loop forever
2026-09-04 06:00:45,732 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 06:00:45,737 INFO core: _init_accounts coroutine started
2026-09-04 06:00:45,739 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 06:00:45,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:05:22,446 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:10:29,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 06:10:29,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 06:10:29,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 06:10:29,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 06:10:29,408 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 06:10:29,409 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 06:10:29,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 06:10:29,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 06:10:53,587 INFO core: Event loop thread started, running loop forever
2026-09-04 06:10:53,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 06:10:53,892 INFO core: _init_accounts coroutine started
2026-09-04 06:10:53,893 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 06:10:53,903 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:15:40,583 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 06:15:40,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 06:15:40,585 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 06:15:40,586 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:15:40,588 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 06:20:27,224 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:25:28,903 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 06:25:28,904 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 06:25:28,912 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 06:25:28,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:25:28,913 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 06:30:26,714 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 06:30:26,715 WARNING core: Account 2: connect timed out after 35s
2026-09-04 06:30:26,715 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 06:30:26,716 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 06:30:26,717 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 06:30:26,717 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 06:30:26,718 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 06:30:26,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:35:08,318 INFO core: Event loop thread started, running loop forever
2026-09-04 06:35:08,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 06:35:08,622 INFO core: _init_accounts coroutine started
2026-09-04 06:35:08,625 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 06:35:08,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:35:32,363 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 06:35:32,368 WARNING core: Account 2: connect timed out after 35s
2026-09-04 06:40:14,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 06:40:55,845 INFO core: Event loop thread started, running loop forever
2026-09-04 06:40:56,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 06:40:56,152 INFO core: _init_accounts coroutine started
2026-09-04 06:40:56,152 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 06:40:56,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:45:51,029 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:45:51,030 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 06:50:12,964 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 06:50:12,977 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 06:55:18,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 06:55:42,051 INFO core: Event loop thread started, running loop forever
2026-09-04 06:55:42,352 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 06:55:42,358 INFO core: _init_accounts coroutine started
2026-09-04 06:55:42,359 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 06:55:42,365 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:00:49,390 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 07:00:51,003 INFO core: Event loop thread started, running loop forever
2026-09-04 07:00:51,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 07:00:51,308 INFO core: _init_accounts coroutine started
2026-09-04 07:00:51,309 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 07:00:51,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:00:51,319 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 07:00:51,319 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 07:05:51,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 07:05:51,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 07:05:51,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:10:06,085 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 07:10:06,086 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 07:10:06,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:15:42,523 INFO core: Event loop thread started, running loop forever
2026-09-04 07:15:42,824 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 07:15:42,828 INFO core: _init_accounts coroutine started
2026-09-04 07:15:42,829 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 07:15:42,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:20:14,779 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 07:20:14,780 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 07:20:14,782 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 07:20:14,783 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 07:20:14,794 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 07:20:14,794 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 07:20:14,798 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 07:20:14,800 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 07:20:14,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:25:38,461 INFO core: Event loop thread started, running loop forever
2026-09-04 07:25:38,763 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 07:25:38,767 INFO core: _init_accounts coroutine started
2026-09-04 07:25:38,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 07:25:38,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:30:45,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 07:30:58,008 INFO core: Event loop thread started, running loop forever
2026-09-04 07:30:58,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 07:30:58,312 INFO core: _init_accounts coroutine started
2026-09-04 07:30:58,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 07:30:58,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:35:26,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 07:35:26,409 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 07:35:26,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 07:35:26,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:35:26,415 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 07:40:41,419 INFO core: Event loop thread started, running loop forever
2026-09-04 07:40:41,721 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 07:40:41,726 INFO core: _init_accounts coroutine started
2026-09-04 07:40:41,726 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 07:40:41,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:45:45,869 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 07:45:45,870 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 07:45:45,874 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:50:27,423 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 07:50:27,428 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 07:55:23,996 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 07:55:23,998 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:00:45,195 INFO core: Event loop thread started, running loop forever
2026-09-04 08:00:45,496 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 08:00:45,500 INFO core: _init_accounts coroutine started
2026-09-04 08:00:45,502 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 08:00:45,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:05:50,520 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:10:45,955 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 08:10:45,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:10:45,958 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 08:15:07,211 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 08:15:07,235 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 08:15:07,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:20:14,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 08:20:36,284 INFO core: Event loop thread started, running loop forever
2026-09-04 08:20:36,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 08:20:36,599 INFO core: _init_accounts coroutine started
2026-09-04 08:20:36,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:20:36,602 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 08:25:25,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:30:32,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 08:30:32,458 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 08:30:32,458 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-04 08:30:32,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 08:30:32,459 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 08:30:32,459 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 08:30:32,459 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 08:30:32,459 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 08:30:32,459 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 08:30:45,171 INFO core: Event loop thread started, running loop forever
2026-09-04 08:30:45,472 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 08:30:45,476 INFO core: _init_accounts coroutine started
2026-09-04 08:30:45,478 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 08:30:45,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:35:15,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:40:11,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:45:13,982 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 08:45:13,983 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 08:45:13,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:50:20,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 08:50:20,434 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 08:50:20,435 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 08:50:20,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 08:50:20,435 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 08:50:20,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 08:50:37,268 INFO core: Event loop thread started, running loop forever
2026-09-04 08:50:37,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 08:50:37,574 INFO core: _init_accounts coroutine started
2026-09-04 08:50:37,576 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 08:50:37,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 08:55:42,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:00:21,794 INFO core: Event loop thread started, running loop forever
2026-09-04 09:00:22,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 09:00:22,099 INFO core: _init_accounts coroutine started
2026-09-04 09:00:22,101 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 09:00:22,109 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:00:48,820 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 09:00:48,820 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 09:00:48,821 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-04 09:00:48,821 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 09:00:48,822 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 09:00:48,822 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 09:00:48,822 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 09:00:48,822 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 09:00:48,822 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 09:05:29,390 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-04 09:05:42,546 INFO core: Event loop thread started, running loop forever
2026-09-04 09:05:42,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 09:05:42,864 INFO core: _init_accounts coroutine started
2026-09-04 09:05:42,871 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 09:05:42,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 09:05:42,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 09:05:42,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:05:42,880 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 09:05:42,882 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 09:10:21,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:15:12,271 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 09:15:12,271 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 09:15:12,279 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 09:15:12,280 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 09:15:12,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:20:19,432 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 09:20:47,255 INFO core: Event loop thread started, running loop forever
2026-09-04 09:20:47,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 09:20:47,559 INFO core: _init_accounts coroutine started
2026-09-04 09:20:47,561 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 09:20:47,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:25:11,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:30:03,459 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 09:30:03,462 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 09:30:03,462 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-04 09:30:03,463 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 09:30:03,463 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 09:30:03,463 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 09:30:03,464 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 09:30:03,464 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 09:30:03,464 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 09:30:52,308 INFO core: Event loop thread started, running loop forever
2026-09-04 09:30:52,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 09:30:52,615 INFO core: _init_accounts coroutine started
2026-09-04 09:30:52,615 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 09:30:52,623 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:35:41,559 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 09:35:41,559 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 09:35:41,560 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 09:35:41,561 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 09:35:41,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:35:41,571 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 09:40:32,724 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 09:40:32,731 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 09:40:32,732 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 09:40:32,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:45:23,310 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 09:45:23,311 WARNING core: Account 2: connect timed out after 35s
2026-09-04 09:45:23,311 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 09:45:23,312 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 09:45:23,313 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 09:45:23,314 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 09:45:23,314 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 09:45:23,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:50:06,047 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 09:50:06,047 WARNING core: Account 2: connect timed out after 35s
2026-09-04 09:50:06,047 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-04 09:50:06,048 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-04 09:50:06,048 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 09:50:06,049 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-04 09:50:06,049 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-04 09:50:06,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 09:55:13,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 09:55:13,415 WARNING core: Account 2: connect timed out after 35s
2026-09-04 09:55:13,416 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-04 09:55:19,208 INFO core: Event loop thread started, running loop forever
2026-09-04 09:55:19,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 09:55:19,513 INFO core: _init_accounts coroutine started
2026-09-04 09:55:19,515 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 09:55:19,521 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:00:26,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 10:00:33,929 INFO core: Event loop thread started, running loop forever
2026-09-04 10:00:34,230 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 10:00:34,233 INFO core: _init_accounts coroutine started
2026-09-04 10:00:34,235 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 10:00:34,240 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:05:29,189 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:10:26,993 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 10:10:26,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:10:27,003 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 10:15:36,210 INFO core: Event loop thread started, running loop forever
2026-09-04 10:15:36,512 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 10:15:36,518 INFO core: _init_accounts coroutine started
2026-09-04 10:15:36,518 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 10:15:36,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:20:43,470 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 10:20:52,984 INFO core: Event loop thread started, running loop forever
2026-09-04 10:20:53,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 10:20:53,289 INFO core: _init_accounts coroutine started
2026-09-04 10:20:53,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 10:20:53,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:25:09,057 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 10:25:09,071 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:30:10,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:35:47,150 INFO core: Event loop thread started, running loop forever
2026-09-04 10:35:47,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 10:35:47,463 INFO core: _init_accounts coroutine started
2026-09-04 10:35:47,465 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 10:35:47,472 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:40:17,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:45:17,469 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 10:45:17,469 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 10:45:17,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 10:45:17,474 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:50:25,615 INFO core: Event loop thread started, running loop forever
2026-09-04 10:50:25,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 10:50:25,918 INFO core: _init_accounts coroutine started
2026-09-04 10:50:25,920 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 10:50:25,924 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 10:55:16,112 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 10:55:16,112 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 10:55:16,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:00:15,012 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 11:00:15,015 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:05:22,372 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 11:05:48,746 INFO core: Event loop thread started, running loop forever
2026-09-04 11:05:49,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 11:05:49,053 INFO core: _init_accounts coroutine started
2026-09-04 11:05:49,054 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 11:05:49,066 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 11:05:49,066 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 11:05:49,067 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 11:05:49,068 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 11:05:49,076 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:10:18,577 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 11:10:18,577 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 11:10:18,581 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 11:10:18,581 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 11:10:18,592 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:15:25,369 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 11:15:25,369 WARNING core: Account 2: connect timed out after 35s
2026-09-04 11:15:25,370 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 11:15:42,196 INFO core: Event loop thread started, running loop forever
2026-09-04 11:15:42,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 11:15:42,503 INFO core: _init_accounts coroutine started
2026-09-04 11:15:42,504 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 11:15:42,511 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:20:28,749 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:25:24,727 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 11:25:24,728 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 11:25:24,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:30:30,391 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 11:30:30,392 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 11:30:30,393 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 11:30:30,393 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 11:30:30,393 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 11:30:30,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 11:30:42,802 INFO core: Event loop thread started, running loop forever
2026-09-04 11:30:43,106 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 11:30:43,113 INFO core: _init_accounts coroutine started
2026-09-04 11:30:43,114 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 11:30:43,122 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 11:30:43,122 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 11:30:43,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:35:26,212 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 11:35:26,215 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 11:35:26,226 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 11:35:26,227 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 11:35:26,231 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 11:35:26,232 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 11:35:26,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:40:21,823 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 11:40:21,824 WARNING core: Account 2: connect timed out after 35s
2026-09-04 11:40:21,825 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 11:40:21,825 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 11:40:21,827 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 11:40:21,828 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 11:40:21,830 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 11:40:21,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:45:02,374 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 11:45:02,375 WARNING core: Account 2: connect timed out after 35s
2026-09-04 11:45:02,375 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-04 11:45:02,375 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-04 11:45:02,376 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 11:45:02,377 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-04 11:45:02,377 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-04 11:45:05,982 INFO core: Event loop thread started, running loop forever
2026-09-04 11:45:06,294 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 11:45:06,304 INFO core: _init_accounts coroutine started
2026-09-04 11:45:06,304 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 11:45:06,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:50:09,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 11:55:15,761 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 11:55:16,356 INFO core: Event loop thread started, running loop forever
2026-09-04 11:55:16,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 11:55:16,668 INFO core: _init_accounts coroutine started
2026-09-04 11:55:16,669 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 11:55:16,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:00:10,583 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 12:00:10,594 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:05:28,424 INFO core: Event loop thread started, running loop forever
2026-09-04 12:05:28,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 12:05:28,729 INFO core: _init_accounts coroutine started
2026-09-04 12:05:28,730 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 12:05:28,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:10:14,460 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 12:10:14,472 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:15:49,003 INFO core: Event loop thread started, running loop forever
2026-09-04 12:15:49,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 12:15:49,309 INFO core: _init_accounts coroutine started
2026-09-04 12:15:49,309 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 12:15:49,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:20:06,650 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 12:20:06,650 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 12:20:06,653 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 12:20:06,658 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 12:20:06,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:25:21,344 INFO core: Event loop thread started, running loop forever
2026-09-04 12:25:21,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 12:25:21,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:30:28,425 INFO core: _init_accounts coroutine started
2026-09-04 12:30:28,426 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 12:30:44,017 INFO core: Event loop thread started, running loop forever
2026-09-04 12:30:44,319 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 12:30:44,326 INFO core: _init_accounts coroutine started
2026-09-04 12:30:44,326 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 12:30:44,337 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:35:08,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:40:12,083 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 12:40:12,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:45:46,875 INFO core: Event loop thread started, running loop forever
2026-09-04 12:45:47,176 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 12:45:47,179 INFO core: _init_accounts coroutine started
2026-09-04 12:45:47,181 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 12:45:47,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:50:36,936 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 12:50:36,947 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 12:55:23,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:00:36,917 INFO core: Event loop thread started, running loop forever
2026-09-04 13:00:37,218 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 13:00:37,223 INFO core: _init_accounts coroutine started
2026-09-04 13:00:37,223 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 13:00:37,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:05:11,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:10:18,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 13:10:33,609 INFO core: Event loop thread started, running loop forever
2026-09-04 13:10:33,910 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 13:10:33,913 INFO core: _init_accounts coroutine started
2026-09-04 13:10:33,914 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 13:10:33,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:15:33,449 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 13:15:33,449 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 13:15:33,460 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 13:15:33,462 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 13:15:33,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:20:10,372 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:25:15,248 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:30:46,283 INFO core: Event loop thread started, running loop forever
2026-09-04 13:30:46,588 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 13:30:46,590 INFO core: _init_accounts coroutine started
2026-09-04 13:30:46,592 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 13:30:46,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:35:47,694 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 13:35:47,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:40:44,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:45:12,727 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-04 13:45:12,728 INFO core: _init_accounts coroutine started
2026-09-04 13:45:12,729 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 13:45:12,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:50:19,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 13:50:26,044 INFO core: Event loop thread started, running loop forever
2026-09-04 13:50:26,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 13:50:26,359 INFO core: _init_accounts coroutine started
2026-09-04 13:50:26,360 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 13:50:26,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 13:55:22,065 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 13:55:22,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:00:43,075 INFO core: Event loop thread started, running loop forever
2026-09-04 14:00:43,377 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 14:00:43,381 INFO core: _init_accounts coroutine started
2026-09-04 14:00:43,381 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 14:00:43,392 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:05:17,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:10:24,457 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 14:10:42,240 INFO core: Event loop thread started, running loop forever
2026-09-04 14:10:42,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 14:10:42,548 INFO core: _init_accounts coroutine started
2026-09-04 14:10:42,548 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 14:10:42,554 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:15:45,458 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:20:11,981 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 14:20:11,982 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 14:20:11,983 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 14:20:11,985 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 14:20:11,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:25:52,565 INFO core: Event loop thread started, running loop forever
2026-09-04 14:25:52,869 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 14:25:52,873 INFO core: _init_accounts coroutine started
2026-09-04 14:25:52,874 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 14:25:52,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:30:40,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:30:40,197 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 14:30:40,197 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 14:35:11,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:40:18,410 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 14:40:18,413 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-04 14:40:18,414 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 14:40:18,414 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-04 14:40:18,414 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 14:40:18,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 14:40:41,773 INFO core: Event loop thread started, running loop forever
2026-09-04 14:40:42,075 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 14:40:42,078 INFO core: _init_accounts coroutine started
2026-09-04 14:40:42,080 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 14:40:42,088 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:45:44,227 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 14:45:44,227 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 14:45:44,233 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 14:45:44,234 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 14:45:44,250 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 14:45:44,250 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 14:45:44,255 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 14:45:44,255 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 14:45:44,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:50:28,868 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 14:50:28,868 WARNING core: Account 2: connect timed out after 35s
2026-09-04 14:50:28,869 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 14:50:28,869 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 14:50:28,870 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 14:50:28,871 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 14:50:28,871 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 14:50:28,874 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 14:55:34,454 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 14:55:34,455 WARNING core: Account 2: connect timed out after 35s
2026-09-04 14:55:44,700 INFO core: Event loop thread started, running loop forever
2026-09-04 14:55:45,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 14:55:45,006 INFO core: _init_accounts coroutine started
2026-09-04 14:55:45,007 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 14:55:45,013 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:00:39,398 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:05:10,346 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 15:05:10,346 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 15:05:10,354 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 15:05:10,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:10:05,283 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 15:10:05,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:15:11,400 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 15:15:39,128 INFO core: Event loop thread started, running loop forever
2026-09-04 15:15:39,430 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 15:15:39,433 INFO core: _init_accounts coroutine started
2026-09-04 15:15:39,435 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 15:15:39,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:15:39,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 15:15:39,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 15:15:39,462 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 15:15:39,463 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 15:20:20,577 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:25:17,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:30:46,925 INFO core: Event loop thread started, running loop forever
2026-09-04 15:30:47,227 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 15:30:47,230 INFO core: _init_accounts coroutine started
2026-09-04 15:30:47,232 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 15:30:47,238 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:35:08,253 INFO core: Event loop thread started, running loop forever
2026-09-04 15:35:08,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 15:35:08,560 INFO core: _init_accounts coroutine started
2026-09-04 15:35:08,560 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 15:35:08,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:35:53,378 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 15:40:14,486 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 15:40:21,007 INFO core: Event loop thread started, running loop forever
2026-09-04 15:40:21,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 15:40:21,312 INFO core: _init_accounts coroutine started
2026-09-04 15:40:21,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 15:40:21,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:45:15,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 15:45:15,620 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 15:45:15,622 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:50:21,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 15:50:21,435 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 15:50:21,435 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 15:50:21,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 15:50:21,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 15:50:21,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 15:50:50,139 INFO core: Event loop thread started, running loop forever
2026-09-04 15:50:50,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 15:50:50,444 INFO core: _init_accounts coroutine started
2026-09-04 15:50:50,446 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 15:50:50,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 15:55:15,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:00:21,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 16:00:36,999 INFO core: Event loop thread started, running loop forever
2026-09-04 16:00:37,299 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 16:00:37,304 INFO core: _init_accounts coroutine started
2026-09-04 16:00:37,305 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 16:00:37,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:05:18,561 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 16:05:18,561 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 16:05:18,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 16:05:18,564 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 16:05:18,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:10:19,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:15:50,757 INFO core: Event loop thread started, running loop forever
2026-09-04 16:15:51,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 16:15:51,062 INFO core: _init_accounts coroutine started
2026-09-04 16:15:51,062 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 16:15:51,073 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 16:15:51,073 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 16:15:51,074 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 16:15:51,075 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 16:15:51,078 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:20:37,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:25:29,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:30:50,228 INFO core: Event loop thread started, running loop forever
2026-09-04 16:30:50,529 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 16:30:50,534 INFO core: _init_accounts coroutine started
2026-09-04 16:30:50,534 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 16:30:50,557 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:35:03,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:35:03,920 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 16:35:03,920 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 16:40:36,641 INFO core: Event loop thread started, running loop forever
2026-09-04 16:40:36,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 16:40:36,946 INFO core: _init_accounts coroutine started
2026-09-04 16:40:36,947 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 16:40:36,956 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 16:40:36,957 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 16:40:36,958 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 16:40:36,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:45:20,097 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 16:45:20,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:50:27,484 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 16:50:38,648 INFO core: Event loop thread started, running loop forever
2026-09-04 16:50:38,949 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 16:50:38,954 INFO core: _init_accounts coroutine started
2026-09-04 16:50:38,956 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 16:50:38,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:55:09,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 16:55:09,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 16:55:09,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 17:00:16,435 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 17:00:16,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 17:00:16,436 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 17:00:16,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 17:00:16,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 17:00:16,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 17:00:36,731 INFO core: Event loop thread started, running loop forever
2026-09-04 17:00:37,038 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 17:00:37,044 INFO core: _init_accounts coroutine started
2026-09-04 17:00:37,045 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 17:00:37,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:00:37,065 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 17:00:37,070 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 17:05:21,594 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 17:05:21,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:10:13,495 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 17:10:13,522 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 17:10:13,522 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 17:10:13,529 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 17:10:13,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:10:13,538 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 17:15:20,457 WARNING core: Account 2: connect timed out after 35s
2026-09-04 17:15:20,459 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 17:15:20,459 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 17:15:20,460 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 17:15:20,462 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 17:15:20,462 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 17:15:22,411 INFO core: Event loop thread started, running loop forever
2026-09-04 17:15:22,711 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 17:15:22,717 INFO core: _init_accounts coroutine started
2026-09-04 17:15:22,717 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 17:15:22,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:20:44,307 INFO core: Event loop thread started, running loop forever
2026-09-04 17:20:44,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 17:20:44,613 INFO core: _init_accounts coroutine started
2026-09-04 17:20:44,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 17:20:44,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:25:44,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:30:05,382 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 17:30:05,413 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:35:51,033 INFO core: Event loop thread started, running loop forever
2026-09-04 17:35:51,334 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 17:35:51,339 INFO core: _init_accounts coroutine started
2026-09-04 17:35:51,344 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 17:35:51,353 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:40:07,332 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:45:26,608 INFO core: Event loop thread started, running loop forever
2026-09-04 17:45:26,910 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 17:45:26,914 INFO core: _init_accounts coroutine started
2026-09-04 17:45:26,915 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 17:45:26,924 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:50:32,350 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 17:50:49,303 INFO core: Event loop thread started, running loop forever
2026-09-04 17:50:49,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 17:50:49,608 INFO core: _init_accounts coroutine started
2026-09-04 17:50:49,609 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 17:50:49,622 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 17:50:49,622 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 17:50:49,624 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 17:50:49,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 17:55:14,594 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 17:55:14,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:00:20,382 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 18:00:31,117 INFO core: Event loop thread started, running loop forever
2026-09-04 18:00:31,419 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 18:00:31,423 INFO core: _init_accounts coroutine started
2026-09-04 18:00:31,424 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 18:00:31,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:05:40,147 INFO core: Event loop thread started, running loop forever
2026-09-04 18:05:40,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 18:05:40,452 INFO core: _init_accounts coroutine started
2026-09-04 18:05:40,452 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 18:05:40,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:10:22,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:15:29,376 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 18:15:47,246 INFO core: Event loop thread started, running loop forever
2026-09-04 18:15:47,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 18:15:47,552 INFO core: _init_accounts coroutine started
2026-09-04 18:15:47,554 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 18:15:47,559 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:20:24,249 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:25:12,031 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 18:25:12,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:30:49,582 INFO core: Event loop thread started, running loop forever
2026-09-04 18:30:49,884 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 18:30:49,888 INFO core: _init_accounts coroutine started
2026-09-04 18:30:49,888 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 18:30:49,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:35:46,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:40:10,148 INFO core: Event loop thread started, running loop forever
2026-09-04 18:40:10,455 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 18:40:10,461 INFO core: _init_accounts coroutine started
2026-09-04 18:40:10,461 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 18:40:10,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:45:36,710 INFO core: Event loop thread started, running loop forever
2026-09-04 18:45:37,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 18:45:37,015 INFO core: _init_accounts coroutine started
2026-09-04 18:45:37,016 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 18:45:37,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:50:18,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:55:17,030 INFO core: Event loop thread started, running loop forever
2026-09-04 18:55:17,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 18:55:17,337 INFO core: _init_accounts coroutine started
2026-09-04 18:55:17,338 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 18:55:17,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 18:55:25,043 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 18:55:25,043 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 18:55:25,043 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-04 18:55:25,044 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 18:55:25,044 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 18:55:25,044 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 18:55:25,044 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 18:55:25,044 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 18:55:25,044 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 19:00:24,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 19:00:40,606 INFO core: Event loop thread started, running loop forever
2026-09-04 19:00:40,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 19:00:40,913 INFO core: _init_accounts coroutine started
2026-09-04 19:00:40,913 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 19:00:40,924 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 19:00:40,925 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 19:00:40,926 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 19:00:40,926 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 19:00:40,935 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 19:00:40,935 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 19:00:40,939 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 19:00:40,939 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 19:00:40,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:05:18,528 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 19:05:18,529 WARNING core: Account 2: connect timed out after 35s
2026-09-04 19:05:18,529 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 19:05:18,529 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 19:05:18,530 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 19:05:18,530 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 19:05:18,531 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 19:05:18,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:10:13,837 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 19:10:13,838 WARNING core: Account 2: connect timed out after 35s
2026-09-04 19:10:13,839 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-04 19:10:13,839 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-04 19:10:13,840 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 19:10:13,841 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-04 19:10:13,841 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-04 19:10:13,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:15:08,872 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 19:15:08,873 WARNING core: Account 2: connect timed out after 35s
2026-09-04 19:15:08,874 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-04 19:15:08,874 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-04 19:15:08,875 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 19:15:08,876 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-04 19:15:08,876 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-04 19:15:08,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:20:14,402 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 19:20:14,403 WARNING core: Account 2: connect timed out after 35s
2026-09-04 19:20:14,404 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-04 19:20:14,404 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-04 19:20:14,405 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 19:20:14,407 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-09-04 19:20:14,407 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-09-04 19:20:21,408 INFO core: Event loop thread started, running loop forever
2026-09-04 19:20:21,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 19:20:21,713 INFO core: _init_accounts coroutine started
2026-09-04 19:20:21,715 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 19:20:21,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:25:06,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 19:25:06,582 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 19:25:06,584 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 19:25:06,586 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 19:25:06,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:30:11,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:35:12,973 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 19:35:12,973 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 19:35:12,978 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 19:35:12,979 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 19:35:12,992 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:40:19,059 INFO core: Event loop thread started, running loop forever
2026-09-04 19:40:19,360 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 19:40:19,363 INFO core: _init_accounts coroutine started
2026-09-04 19:40:19,364 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 19:40:19,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:40:19,376 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 19:40:19,377 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 19:45:05,138 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 19:45:05,150 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 19:45:05,151 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:50:12,533 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 19:50:18,846 INFO core: Event loop thread started, running loop forever
2026-09-04 19:50:19,147 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 19:50:19,157 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 19:55:10,874 INFO core: _init_accounts coroutine started
2026-09-04 19:55:10,876 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 19:55:10,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:00:20,337 INFO core: Event loop thread started, running loop forever
2026-09-04 20:00:20,639 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 20:00:20,647 INFO core: _init_accounts coroutine started
2026-09-04 20:00:20,647 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 20:00:20,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:05:16,157 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:10:23,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 20:10:43,510 INFO core: Event loop thread started, running loop forever
2026-09-04 20:10:43,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 20:10:43,818 INFO core: _init_accounts coroutine started
2026-09-04 20:10:43,831 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 20:10:43,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:15:40,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:20:46,525 INFO core: Event loop thread started, running loop forever
2026-09-04 20:20:46,826 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 20:20:46,830 INFO core: _init_accounts coroutine started
2026-09-04 20:20:46,831 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 20:20:46,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:25:39,215 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 20:25:39,215 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 20:25:39,216 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 20:25:39,217 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 20:25:39,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:30:30,877 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 20:30:30,878 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 20:30:30,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:35:05,139 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-04 20:35:05,140 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-04 20:35:05,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:40:12,370 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-04 20:40:12,371 WARNING core: Account 2: connect timed out after 35s
2026-09-04 20:40:12,372 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-04 20:40:12,372 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-04 20:40:12,373 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-04 20:40:12,374 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-04 20:40:12,374 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-04 20:40:22,200 INFO core: Event loop thread started, running loop forever
2026-09-04 20:40:22,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 20:40:22,505 INFO core: _init_accounts coroutine started
2026-09-04 20:40:22,508 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 20:40:22,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:45:03,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 20:45:03,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 20:45:03,416 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-04 20:45:03,416 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 20:45:03,416 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-04 20:45:03,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 20:45:03,417 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-04 20:45:03,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-04 20:45:03,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 20:45:48,501 INFO core: Event loop thread started, running loop forever
2026-09-04 20:45:48,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 20:45:48,806 INFO core: _init_accounts coroutine started
2026-09-04 20:45:48,807 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 20:45:48,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:50:28,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 20:55:41,619 INFO core: Event loop thread started, running loop forever
2026-09-04 20:55:41,920 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 20:55:41,924 INFO core: _init_accounts coroutine started
2026-09-04 20:55:41,924 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 20:55:41,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:00:47,396 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 21:00:47,975 INFO core: Event loop thread started, running loop forever
2026-09-04 21:00:48,276 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 21:00:48,279 INFO core: _init_accounts coroutine started
2026-09-04 21:00:48,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 21:00:48,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:05:11,499 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 21:05:11,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 21:05:11,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:05:11,502 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 21:10:05,211 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 21:10:05,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:15:51,059 INFO core: Event loop thread started, running loop forever
2026-09-04 21:15:51,360 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 21:15:51,364 INFO core: _init_accounts coroutine started
2026-09-04 21:15:51,365 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 21:15:51,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:20:25,778 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:25:31,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 21:25:49,667 INFO core: Event loop thread started, running loop forever
2026-09-04 21:25:49,968 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 21:25:49,973 INFO core: _init_accounts coroutine started
2026-09-04 21:25:49,974 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 21:25:49,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:30:17,988 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:35:49,236 INFO core: Event loop thread started, running loop forever
2026-09-04 21:35:49,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 21:35:49,540 INFO core: _init_accounts coroutine started
2026-09-04 21:35:49,542 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 21:35:49,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:40:21,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:45:17,197 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 21:45:17,198 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 21:45:17,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:50:17,737 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 21:50:17,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 21:55:19,912 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 21:55:19,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:00:12,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:05:19,404 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-04 22:05:34,587 INFO core: Event loop thread started, running loop forever
2026-09-04 22:05:34,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 22:05:34,893 INFO core: _init_accounts coroutine started
2026-09-04 22:05:34,893 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 22:05:34,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:10:40,654 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 22:10:40,654 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 22:10:40,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:15:46,334 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 22:15:50,520 INFO core: Event loop thread started, running loop forever
2026-09-04 22:15:50,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 22:15:50,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:20:39,739 INFO core: _init_accounts coroutine started
2026-09-04 22:20:39,740 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 22:20:39,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:25:37,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:30:44,420 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 22:30:56,516 INFO core: Event loop thread started, running loop forever
2026-09-04 22:30:56,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 22:30:56,821 INFO core: _init_accounts coroutine started
2026-09-04 22:30:56,823 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 22:30:56,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:35:11,119 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-04 22:35:11,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:40:16,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:45:09,170 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-04 22:45:09,171 INFO core: _init_accounts coroutine started
2026-09-04 22:45:09,172 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 22:45:09,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:50:16,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 22:50:45,473 INFO core: Event loop thread started, running loop forever
2026-09-04 22:50:45,775 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 22:50:45,779 INFO core: _init_accounts coroutine started
2026-09-04 22:50:45,781 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 22:50:45,788 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 22:55:12,617 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:00:03,386 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-04 23:00:24,143 INFO core: Event loop thread started, running loop forever
2026-09-04 23:00:24,444 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 23:00:24,447 INFO core: _init_accounts coroutine started
2026-09-04 23:00:24,448 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 23:00:24,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:05:16,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:10:23,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-04 23:10:43,338 INFO core: Event loop thread started, running loop forever
2026-09-04 23:10:43,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 23:10:43,652 INFO core: _init_accounts coroutine started
2026-09-04 23:10:43,653 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 23:10:43,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:15:43,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:20:50,427 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 23:20:50,428 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 23:20:50,429 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-04 23:20:53,187 INFO core: Event loop thread started, running loop forever
2026-09-04 23:20:53,488 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 23:20:53,491 INFO core: _init_accounts coroutine started
2026-09-04 23:20:53,493 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 23:20:53,500 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:25:13,737 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 23:25:13,737 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 23:25:13,755 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 23:25:13,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:30:19,489 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 23:30:49,601 INFO core: Event loop thread started, running loop forever
2026-09-04 23:30:49,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 23:30:49,905 INFO core: _init_accounts coroutine started
2026-09-04 23:30:49,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 23:30:49,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:35:52,112 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-04 23:35:52,112 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-04 23:35:52,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:35:52,118 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-04 23:40:34,812 INFO core: _init_accounts_inner: reloading LLM config
2026-09-04 23:40:34,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:45:19,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:50:47,758 INFO core: Event loop thread started, running loop forever
2026-09-04 23:50:48,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-04 23:50:48,064 INFO core: _init_accounts coroutine started
2026-09-04 23:50:48,064 INFO core: _init_accounts_inner: starting DB migrations
2026-09-04 23:50:48,069 INFO core: status() clients=0 connected=False forwarding=False
2026-09-04 23:55:08,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:00:18,612 INFO core: Event loop thread started, running loop forever
2026-09-05 00:00:18,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 00:00:18,915 INFO core: _init_accounts coroutine started
2026-09-05 00:00:18,917 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 00:00:18,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:05:33,406 INFO core: Event loop thread started, running loop forever
2026-09-05 00:05:33,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 00:05:33,710 INFO core: _init_accounts coroutine started
2026-09-05 00:05:33,711 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 00:05:33,717 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:10:34,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:10:34,466 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 00:10:34,466 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 00:15:11,813 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 00:15:11,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:20:17,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 00:20:17,579 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 00:20:17,580 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 00:20:17,580 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 00:20:56,432 INFO core: Event loop thread started, running loop forever
2026-09-05 00:20:56,732 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 00:20:56,736 INFO core: _init_accounts coroutine started
2026-09-05 00:20:56,737 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 00:20:56,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:25:08,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:30:14,447 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 00:30:14,450 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 00:30:49,911 INFO core: Event loop thread started, running loop forever
2026-09-05 00:30:50,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 00:30:50,215 INFO core: _init_accounts coroutine started
2026-09-05 00:30:50,217 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 00:30:50,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:35:25,631 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 00:35:25,631 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 00:35:25,634 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 00:35:25,636 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:40:32,442 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 00:40:45,729 INFO core: Event loop thread started, running loop forever
2026-09-05 00:40:46,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 00:40:46,033 INFO core: _init_accounts coroutine started
2026-09-05 00:40:46,034 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 00:40:46,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:45:19,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:45:19,489 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 00:45:19,489 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 00:50:48,726 INFO core: Event loop thread started, running loop forever
2026-09-05 00:50:49,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 00:50:49,042 INFO core: _init_accounts coroutine started
2026-09-05 00:50:49,043 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 00:50:49,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 00:55:19,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:00:26,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 01:00:54,881 INFO core: Event loop thread started, running loop forever
2026-09-05 01:00:55,182 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 01:00:55,186 INFO core: _init_accounts coroutine started
2026-09-05 01:00:55,187 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 01:00:55,192 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:05:14,980 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:10:21,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 01:10:53,174 INFO core: Event loop thread started, running loop forever
2026-09-05 01:10:53,475 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 01:10:53,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:15:02,321 INFO core: _init_accounts coroutine started
2026-09-05 01:15:02,321 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 01:15:02,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 01:15:12,514 INFO core: Event loop thread started, running loop forever
2026-09-05 01:15:12,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 01:15:12,820 INFO core: _init_accounts coroutine started
2026-09-05 01:15:12,820 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 01:15:12,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:20:09,839 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 01:20:09,839 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 01:20:09,855 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 01:20:09,857 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 01:20:09,872 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 01:20:09,872 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 01:20:09,877 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 01:20:09,878 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 01:20:09,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:25:15,459 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 01:25:15,459 WARNING core: Account 2: connect timed out after 35s
2026-09-05 01:25:15,460 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 01:25:15,460 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 01:25:15,461 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 01:25:15,462 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 01:25:15,462 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 01:25:44,329 INFO core: Event loop thread started, running loop forever
2026-09-05 01:25:44,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 01:25:44,634 INFO core: _init_accounts coroutine started
2026-09-05 01:25:44,636 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 01:25:44,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:30:38,730 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 01:30:38,736 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:35:27,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:40:39,373 INFO core: Event loop thread started, running loop forever
2026-09-05 01:40:39,674 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 01:40:39,678 INFO core: _init_accounts coroutine started
2026-09-05 01:40:39,680 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 01:40:39,683 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:45:28,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:50:35,436 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 01:50:35,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 01:50:35,436 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-05 01:50:35,437 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 01:50:52,606 INFO core: Event loop thread started, running loop forever
2026-09-05 01:50:52,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 01:50:52,911 INFO core: _init_accounts coroutine started
2026-09-05 01:50:52,913 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 01:50:52,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 01:55:41,358 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 01:55:41,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:00:17,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:05:53,145 INFO core: Event loop thread started, running loop forever
2026-09-05 02:05:53,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 02:05:53,450 INFO core: _init_accounts coroutine started
2026-09-05 02:05:53,451 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 02:05:53,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:10:34,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:15:05,583 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 02:15:05,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 02:15:05,585 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 02:15:05,586 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 02:15:05,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:20:11,497 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 02:20:27,637 INFO core: Event loop thread started, running loop forever
2026-09-05 02:20:27,938 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 02:20:27,946 INFO core: _init_accounts coroutine started
2026-09-05 02:20:27,946 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 02:20:27,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:25:21,339 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 02:25:21,340 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 02:25:21,359 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:30:28,396 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 02:30:28,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 02:30:28,419 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 02:30:28,419 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 02:30:28,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 02:30:32,377 INFO core: Event loop thread started, running loop forever
2026-09-05 02:30:32,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 02:30:32,681 INFO core: _init_accounts coroutine started
2026-09-05 02:30:32,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 02:30:32,689 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:35:27,479 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 02:35:27,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:40:22,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:45:37,903 INFO core: Event loop thread started, running loop forever
2026-09-05 02:45:38,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 02:45:38,207 INFO core: _init_accounts coroutine started
2026-09-05 02:45:38,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 02:45:38,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:50:38,224 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 02:50:38,224 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 02:50:38,225 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 02:50:38,226 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 02:55:08,076 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 02:55:08,099 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 02:55:08,100 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 02:55:08,105 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 02:55:08,106 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 02:55:08,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:00:10,400 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 03:00:10,400 WARNING core: Account 2: connect timed out after 35s
2026-09-05 03:00:10,401 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 03:00:10,401 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 03:00:10,402 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 03:00:10,404 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 03:00:10,406 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 03:00:10,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:05:17,436 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 03:05:45,369 INFO core: Event loop thread started, running loop forever
2026-09-05 03:05:45,670 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 03:05:45,674 INFO core: _init_accounts coroutine started
2026-09-05 03:05:45,676 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 03:05:45,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:10:24,930 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 03:10:24,938 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:15:34,148 INFO core: Event loop thread started, running loop forever
2026-09-05 03:15:34,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 03:15:34,455 INFO core: _init_accounts coroutine started
2026-09-05 03:15:34,457 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 03:15:34,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:20:13,991 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 03:20:13,992 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 03:20:13,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:25:19,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 03:25:49,929 INFO core: Event loop thread started, running loop forever
2026-09-05 03:25:50,231 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 03:25:50,236 INFO core: _init_accounts coroutine started
2026-09-05 03:25:50,237 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 03:25:50,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:30:02,334 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 03:30:36,659 INFO core: Event loop thread started, running loop forever
2026-09-05 03:30:36,960 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 03:30:36,964 INFO core: _init_accounts coroutine started
2026-09-05 03:30:36,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:30:36,967 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 03:35:28,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:40:34,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 03:40:38,933 INFO core: Event loop thread started, running loop forever
2026-09-05 03:40:39,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 03:40:39,239 INFO core: _init_accounts coroutine started
2026-09-05 03:40:39,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 03:40:39,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:45:22,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:50:23,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 03:55:19,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 03:55:19,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 03:55:19,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 03:55:19,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:00:26,473 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 04:00:32,169 INFO core: Event loop thread started, running loop forever
2026-09-05 04:00:32,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 04:00:32,477 INFO core: _init_accounts coroutine started
2026-09-05 04:00:32,477 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 04:00:32,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:05:43,935 INFO core: Event loop thread started, running loop forever
2026-09-05 04:05:44,237 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 04:05:44,242 INFO core: _init_accounts coroutine started
2026-09-05 04:05:44,243 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 04:05:44,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:10:36,947 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 04:10:36,948 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 04:10:36,949 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 04:10:36,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:10:36,952 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 04:15:17,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:20:23,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 04:20:45,699 INFO core: Event loop thread started, running loop forever
2026-09-05 04:20:46,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 04:20:46,005 INFO core: _init_accounts coroutine started
2026-09-05 04:20:46,006 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 04:20:46,034 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 04:20:46,034 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 04:20:46,035 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 04:20:46,037 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 04:20:46,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:25:48,741 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:30:42,266 INFO core: Event loop thread started, running loop forever
2026-09-05 04:30:42,567 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 04:30:42,575 INFO core: _init_accounts coroutine started
2026-09-05 04:30:42,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:30:42,586 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 04:30:55,287 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 04:35:46,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:40:24,039 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 04:40:24,039 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 04:40:24,041 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 04:40:24,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:45:31,414 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 04:45:41,337 INFO core: Event loop thread started, running loop forever
2026-09-05 04:45:41,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 04:45:41,642 INFO core: _init_accounts coroutine started
2026-09-05 04:45:41,643 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 04:45:41,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:50:39,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:55:15,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 04:55:15,818 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 04:55:15,819 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 05:00:45,032 INFO core: Event loop thread started, running loop forever
2026-09-05 05:00:45,334 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 05:00:45,340 INFO core: _init_accounts coroutine started
2026-09-05 05:00:45,340 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 05:00:45,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:05:26,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:10:37,722 INFO core: Event loop thread started, running loop forever
2026-09-05 05:10:38,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 05:10:38,028 INFO core: _init_accounts coroutine started
2026-09-05 05:10:38,028 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 05:10:38,038 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 05:10:38,039 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 05:10:38,040 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 05:10:38,041 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 05:10:38,050 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 05:10:38,051 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 05:10:38,055 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 05:10:38,056 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 05:10:38,071 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:15:26,549 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 05:15:26,550 WARNING core: Account 2: connect timed out after 35s
2026-09-05 05:15:26,550 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 05:15:26,551 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 05:15:26,551 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 05:15:26,552 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 05:15:26,553 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 05:15:26,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:20:36,379 INFO core: Event loop thread started, running loop forever
2026-09-05 05:20:36,680 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 05:20:36,684 INFO core: _init_accounts coroutine started
2026-09-05 05:20:36,684 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 05:20:36,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:25:30,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:30:33,226 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 05:30:33,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:35:40,975 INFO core: Event loop thread started, running loop forever
2026-09-05 05:35:41,276 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 05:35:41,279 INFO core: _init_accounts coroutine started
2026-09-05 05:35:41,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 05:35:41,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:40:21,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 05:40:21,426 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 05:40:21,430 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:40:21,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 05:45:02,396 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 05:45:22,068 INFO core: Event loop thread started, running loop forever
2026-09-05 05:45:22,369 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 05:45:22,372 INFO core: _init_accounts coroutine started
2026-09-05 05:45:22,373 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 05:45:22,378 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:50:13,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 05:50:13,505 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 05:50:13,506 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 05:55:18,240 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 05:55:18,246 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 05:55:18,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:00:10,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:05:04,234 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:10:35,700 INFO core: Event loop thread started, running loop forever
2026-09-05 06:10:36,001 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 06:10:36,005 INFO core: _init_accounts coroutine started
2026-09-05 06:10:36,007 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 06:10:36,037 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 06:10:36,037 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 06:10:36,039 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 06:10:36,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:10:36,040 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 06:15:35,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:20:38,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:25:44,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 06:25:53,362 INFO core: Event loop thread started, running loop forever
2026-09-05 06:25:53,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 06:25:53,670 INFO core: _init_accounts coroutine started
2026-09-05 06:25:53,671 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 06:25:53,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:30:41,003 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 06:30:41,003 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 06:30:41,004 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:35:17,040 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 06:35:17,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:40:24,381 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 06:40:34,468 INFO core: Event loop thread started, running loop forever
2026-09-05 06:40:34,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 06:40:34,773 INFO core: _init_accounts coroutine started
2026-09-05 06:40:34,777 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 06:40:34,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:45:52,540 INFO core: Event loop thread started, running loop forever
2026-09-05 06:45:52,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 06:45:52,847 INFO core: _init_accounts coroutine started
2026-09-05 06:45:52,847 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 06:45:52,853 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:50:09,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 06:55:17,269 INFO core: Event loop thread started, running loop forever
2026-09-05 06:55:17,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 06:55:17,575 INFO core: _init_accounts coroutine started
2026-09-05 06:55:17,576 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 06:55:17,586 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:00:24,471 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 07:00:47,490 INFO core: Event loop thread started, running loop forever
2026-09-05 07:00:47,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 07:00:47,794 INFO core: _init_accounts coroutine started
2026-09-05 07:00:47,796 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 07:00:47,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:05:25,975 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 07:05:25,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:05:25,976 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 07:10:32,378 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 07:10:32,379 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-05 07:10:39,285 INFO core: Event loop thread started, running loop forever
2026-09-05 07:10:39,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 07:10:39,590 INFO core: _init_accounts coroutine started
2026-09-05 07:10:39,591 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 07:10:39,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:15:11,030 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 07:15:11,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:20:28,432 INFO core: Event loop thread started, running loop forever
2026-09-05 07:20:28,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 07:20:28,738 INFO core: _init_accounts coroutine started
2026-09-05 07:20:28,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 07:20:28,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:25:35,382 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 07:25:51,464 INFO core: Event loop thread started, running loop forever
2026-09-05 07:25:51,765 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 07:25:51,769 INFO core: _init_accounts coroutine started
2026-09-05 07:25:51,770 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 07:25:51,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:30:51,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:35:11,005 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:40:18,484 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 07:40:18,485 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 07:40:18,485 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-05 07:40:18,486 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 07:40:18,486 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-05 07:40:18,486 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 07:40:18,486 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-05 07:40:18,486 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 07:40:18,486 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 07:40:45,397 INFO core: Event loop thread started, running loop forever
2026-09-05 07:40:45,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 07:40:45,704 INFO core: _init_accounts coroutine started
2026-09-05 07:40:45,704 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 07:40:45,714 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:45:48,408 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 07:45:48,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:50:46,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 07:55:24,804 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-05 07:55:24,805 INFO core: _init_accounts coroutine started
2026-09-05 07:55:24,805 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 07:55:24,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:00:02,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 08:00:25,063 INFO core: Event loop thread started, running loop forever
2026-09-05 08:00:25,366 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 08:00:25,370 INFO core: _init_accounts coroutine started
2026-09-05 08:00:25,371 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 08:00:25,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:05:30,357 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 08:05:30,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:05:30,626 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 08:10:37,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 08:10:44,460 INFO core: Event loop thread started, running loop forever
2026-09-05 08:10:44,761 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 08:10:44,765 INFO core: _init_accounts coroutine started
2026-09-05 08:10:44,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 08:10:44,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:15:20,602 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 08:15:20,602 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 08:15:20,603 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 08:15:20,604 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 08:15:20,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:20:13,105 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 08:20:13,106 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 08:20:13,108 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:25:20,385 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 08:25:45,734 INFO core: Event loop thread started, running loop forever
2026-09-05 08:25:46,037 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 08:25:46,043 INFO core: _init_accounts coroutine started
2026-09-05 08:25:46,044 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 08:25:46,052 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 08:25:46,052 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 08:25:46,053 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 08:25:46,055 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 08:25:46,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:30:09,877 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:35:28,231 INFO core: Event loop thread started, running loop forever
2026-09-05 08:35:28,534 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 08:35:28,538 INFO core: _init_accounts coroutine started
2026-09-05 08:35:28,540 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 08:35:28,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:40:20,193 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:40:20,194 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 08:45:27,386 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 08:45:36,332 INFO core: Event loop thread started, running loop forever
2026-09-05 08:45:36,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 08:45:36,646 INFO core: _init_accounts coroutine started
2026-09-05 08:45:36,646 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 08:45:36,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:50:07,944 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 08:55:26,046 INFO core: Event loop thread started, running loop forever
2026-09-05 08:55:26,347 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 08:55:26,353 INFO core: _init_accounts coroutine started
2026-09-05 08:55:26,353 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 08:55:26,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:00:49,557 INFO core: Event loop thread started, running loop forever
2026-09-05 09:00:49,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 09:00:49,865 INFO core: _init_accounts coroutine started
2026-09-05 09:00:49,866 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 09:00:49,872 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:05:36,632 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 09:05:36,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:05:36,633 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 09:10:20,076 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 09:10:20,079 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 09:10:20,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:15:43,321 INFO core: Event loop thread started, running loop forever
2026-09-05 09:15:43,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 09:15:43,627 INFO core: _init_accounts coroutine started
2026-09-05 09:15:43,629 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 09:15:43,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:20:29,630 INFO core: Event loop thread started, running loop forever
2026-09-05 09:20:29,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 09:20:29,935 INFO core: _init_accounts coroutine started
2026-09-05 09:20:29,938 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 09:20:29,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:25:36,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 09:25:51,532 INFO core: Event loop thread started, running loop forever
2026-09-05 09:25:51,833 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 09:25:51,836 INFO core: _init_accounts coroutine started
2026-09-05 09:25:51,838 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 09:25:51,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:30:30,276 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 09:30:30,277 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 09:30:30,278 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 09:30:30,279 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 09:30:30,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:35:26,998 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:40:33,405 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 09:40:49,032 INFO core: Event loop thread started, running loop forever
2026-09-05 09:40:49,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 09:40:49,340 INFO core: _init_accounts coroutine started
2026-09-05 09:40:49,341 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 09:40:49,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:45:15,525 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 09:45:15,526 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 09:45:15,528 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 09:45:15,529 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 09:45:15,538 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 09:45:15,538 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 09:45:15,543 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 09:45:15,544 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 09:45:15,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:50:50,245 INFO core: Event loop thread started, running loop forever
2026-09-05 09:50:50,546 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 09:50:50,550 INFO core: _init_accounts coroutine started
2026-09-05 09:50:50,553 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 09:50:50,569 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 09:50:50,570 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 09:50:50,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 09:55:24,571 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 09:55:24,576 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 09:55:24,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:00:13,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:05:20,383 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 10:05:36,814 INFO core: Event loop thread started, running loop forever
2026-09-05 10:05:37,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 10:05:37,124 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:10:43,402 INFO core: _init_accounts coroutine started
2026-09-05 10:10:43,402 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 10:10:52,912 INFO core: Event loop thread started, running loop forever
2026-09-05 10:10:53,213 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 10:10:53,217 INFO core: _init_accounts coroutine started
2026-09-05 10:10:53,218 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 10:10:53,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:15:03,295 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 10:15:28,513 INFO core: Event loop thread started, running loop forever
2026-09-05 10:15:28,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 10:15:28,817 INFO core: _init_accounts coroutine started
2026-09-05 10:15:28,818 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 10:15:28,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:20:08,334 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 10:20:08,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:25:24,662 INFO core: Event loop thread started, running loop forever
2026-09-05 10:25:24,964 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 10:25:24,971 INFO core: _init_accounts coroutine started
2026-09-05 10:25:24,971 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 10:25:24,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:30:18,147 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 10:30:18,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:35:21,232 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:40:18,726 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-05 10:40:18,727 INFO core: _init_accounts coroutine started
2026-09-05 10:40:18,727 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 10:40:18,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:45:24,374 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 10:45:34,047 INFO core: Event loop thread started, running loop forever
2026-09-05 10:45:34,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 10:45:34,355 INFO core: _init_accounts coroutine started
2026-09-05 10:45:34,356 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 10:45:34,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:50:11,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 10:55:18,347 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 10:55:46,872 INFO core: Event loop thread started, running loop forever
2026-09-05 10:55:47,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 10:55:47,182 INFO core: _init_accounts coroutine started
2026-09-05 10:55:47,183 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 10:55:47,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:00:25,045 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 11:00:25,046 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 11:00:25,047 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 11:00:25,048 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 11:00:25,059 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 11:00:25,059 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 11:00:25,063 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 11:00:25,064 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 11:00:25,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:05:28,066 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 11:05:28,066 WARNING core: Account 2: connect timed out after 35s
2026-09-05 11:05:28,067 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 11:05:28,067 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 11:05:28,068 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 11:05:28,069 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 11:05:28,069 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 11:05:28,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:10:06,780 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 11:10:06,783 WARNING core: Account 2: connect timed out after 35s
2026-09-05 11:10:06,784 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-05 11:10:06,784 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-05 11:10:06,784 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 11:10:06,785 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-05 11:10:06,786 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-05 11:10:06,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:15:11,981 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 11:15:11,981 WARNING core: Account 2: connect timed out after 35s
2026-09-05 11:15:11,982 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-05 11:15:11,982 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-05 11:15:11,982 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 11:15:11,983 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-05 11:15:11,983 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-05 11:15:11,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:20:18,344 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 11:20:18,345 WARNING core: Account 2: connect timed out after 35s
2026-09-05 11:20:18,346 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-05 11:20:18,358 INFO core: Event loop thread started, running loop forever
2026-09-05 11:20:18,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 11:20:18,668 INFO core: _init_accounts coroutine started
2026-09-05 11:20:18,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 11:20:18,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:20:18,678 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-05 11:25:36,197 INFO core: Event loop thread started, running loop forever
2026-09-05 11:25:36,498 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 11:25:36,503 INFO core: _init_accounts coroutine started
2026-09-05 11:25:36,504 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 11:25:36,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:30:31,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:35:10,675 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 11:35:10,676 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 11:35:10,677 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 11:35:10,678 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 11:35:10,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:40:33,646 INFO core: Event loop thread started, running loop forever
2026-09-05 11:40:33,954 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 11:40:33,959 INFO core: _init_accounts coroutine started
2026-09-05 11:40:33,961 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 11:40:33,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:45:05,128 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 11:45:05,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:50:20,851 INFO core: Event loop thread started, running loop forever
2026-09-05 11:50:21,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 11:50:21,158 INFO core: _init_accounts coroutine started
2026-09-05 11:50:21,160 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 11:50:21,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 11:55:42,488 INFO core: Event loop thread started, running loop forever
2026-09-05 11:55:42,789 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 11:55:42,792 INFO core: _init_accounts coroutine started
2026-09-05 11:55:42,794 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 11:55:42,812 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 11:55:42,812 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 11:55:42,814 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 11:55:42,817 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 11:55:42,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:00:17,190 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:05:23,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 12:05:23,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 12:05:23,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 12:05:49,199 INFO core: Event loop thread started, running loop forever
2026-09-05 12:05:49,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 12:05:49,508 INFO core: _init_accounts coroutine started
2026-09-05 12:05:49,508 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 12:05:49,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:10:22,144 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:15:20,356 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 12:15:20,356 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 12:15:20,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:20:12,460 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 12:20:12,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:25:07,632 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 12:25:07,633 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 12:25:07,647 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:30:28,421 INFO core: Event loop thread started, running loop forever
2026-09-05 12:30:28,722 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 12:30:28,725 INFO core: _init_accounts coroutine started
2026-09-05 12:30:28,727 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 12:30:28,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:35:14,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:40:32,093 INFO core: Event loop thread started, running loop forever
2026-09-05 12:40:32,394 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 12:40:32,401 INFO core: _init_accounts coroutine started
2026-09-05 12:40:32,401 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 12:40:32,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:45:42,761 INFO core: Event loop thread started, running loop forever
2026-09-05 12:45:43,062 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 12:45:43,065 INFO core: _init_accounts coroutine started
2026-09-05 12:45:43,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 12:45:43,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:50:26,693 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 12:55:34,837 INFO core: Event loop thread started, running loop forever
2026-09-05 12:55:35,138 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 12:55:35,140 INFO core: _init_accounts coroutine started
2026-09-05 12:55:35,143 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 12:55:35,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:00:38,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 13:00:38,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:00:38,535 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 13:05:45,407 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-05 13:05:45,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 13:05:45,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-05 13:05:45,408 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 13:05:45,408 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-05 13:05:45,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 13:05:45,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 13:05:45,941 INFO core: Event loop thread started, running loop forever
2026-09-05 13:05:46,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 13:05:46,245 INFO core: _init_accounts coroutine started
2026-09-05 13:05:46,247 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 13:05:46,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:10:44,749 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 13:10:44,749 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 13:10:44,751 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 13:10:44,753 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 13:10:44,761 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 13:10:44,761 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 13:10:44,765 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 13:10:44,766 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 13:10:44,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:15:48,271 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 13:15:48,272 WARNING core: Account 2: connect timed out after 35s
2026-09-05 13:15:48,274 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 13:15:48,274 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 13:15:48,276 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 13:15:48,277 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 13:15:48,278 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 13:15:48,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:20:43,353 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 13:20:43,353 WARNING core: Account 2: connect timed out after 35s
2026-09-05 13:20:43,354 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-05 13:20:43,354 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-05 13:20:43,355 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 13:20:43,356 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-05 13:20:43,356 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-05 13:20:43,359 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:25:48,895 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 13:25:48,896 WARNING core: Account 2: connect timed out after 35s
2026-09-05 13:25:48,896 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-05 13:25:48,897 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-05 13:25:48,897 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 13:25:48,899 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-05 13:25:48,899 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-05 13:25:48,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:30:38,230 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 13:30:38,230 WARNING core: Account 2: connect timed out after 35s
2026-09-05 13:30:38,231 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-05 13:30:38,231 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-05 13:30:38,232 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 13:30:38,233 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-09-05 13:30:38,234 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-09-05 13:30:38,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:35:39,649 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 13:35:39,651 WARNING core: Account 2: connect timed out after 35s
2026-09-05 13:35:39,651 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-09-05 13:35:39,652 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-09-05 13:35:39,652 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 13:35:39,652 WARNING core: Account 2: exhausted all Telegram server candidates
2026-09-05 13:35:39,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:40:41,233 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-09-05 13:40:41,233 INFO core: Signal processor started
2026-09-05 13:40:41,234 INFO core: Initialized 0 account(s), 1 pair(s)
2026-09-05 13:40:41,234 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:40:41,235 INFO core: Memory RSS: 90.64 MB
2026-09-05 13:45:33,463 INFO core: Memory RSS: 90.64 MB
2026-09-05 13:45:33,468 INFO core: Watchdog: connecting missing account 2
2026-09-05 13:45:33,471 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 13:45:33,472 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 13:45:33,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:45:33,475 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-09-05 13:50:40,357 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 13:50:40,358 WARNING core: Account 2: connect timed out after 35s
2026-09-05 13:50:43,290 INFO core: Event loop thread started, running loop forever
2026-09-05 13:50:43,591 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 13:50:43,595 INFO core: _init_accounts coroutine started
2026-09-05 13:50:43,597 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 13:50:43,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 13:55:17,462 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 13:55:17,463 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 13:55:17,464 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 13:55:17,465 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 13:55:17,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:00:20,272 INFO core: Event loop thread started, running loop forever
2026-09-05 14:00:20,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 14:00:20,578 INFO core: _init_accounts coroutine started
2026-09-05 14:00:20,580 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 14:00:20,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:00:24,279 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 14:05:08,453 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:10:28,930 INFO core: Event loop thread started, running loop forever
2026-09-05 14:10:29,231 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 14:10:29,321 INFO core: _init_accounts coroutine started
2026-09-05 14:10:29,322 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 14:10:29,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:15:21,571 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 14:15:21,572 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 14:15:21,574 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 14:15:21,580 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 14:15:21,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:20:52,769 INFO core: Event loop thread started, running loop forever
2026-09-05 14:20:53,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 14:20:53,075 INFO core: _init_accounts coroutine started
2026-09-05 14:20:53,075 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 14:20:53,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:20:53,103 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 14:20:53,105 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 14:20:53,109 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 14:20:53,110 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 14:25:26,632 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 14:25:26,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:25:26,637 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 14:30:19,949 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 14:30:19,950 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 14:30:19,954 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:35:14,476 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 14:35:14,477 WARNING core: Account 2: connect timed out after 35s
2026-09-05 14:35:14,477 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 14:35:14,478 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 14:35:14,479 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 14:35:14,480 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 14:35:14,480 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 14:35:14,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:40:21,467 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 14:40:21,468 WARNING core: Account 2: connect timed out after 35s
2026-09-05 14:40:21,468 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-05 14:40:25,478 INFO core: Event loop thread started, running loop forever
2026-09-05 14:40:25,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 14:40:25,783 INFO core: _init_accounts coroutine started
2026-09-05 14:40:25,784 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 14:40:25,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:40:25,793 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 14:40:25,793 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 14:45:35,865 INFO core: Event loop thread started, running loop forever
2026-09-05 14:45:36,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 14:45:36,172 INFO core: _init_accounts coroutine started
2026-09-05 14:45:36,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:45:36,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 14:50:42,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 14:55:17,283 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 14:55:17,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:00:58,242 INFO core: Event loop thread started, running loop forever
2026-09-05 15:00:58,543 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 15:00:58,550 INFO core: _init_accounts coroutine started
2026-09-05 15:00:58,550 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 15:00:58,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:00:58,562 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 15:00:58,563 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 15:05:03,663 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:10:26,908 INFO core: Event loop thread started, running loop forever
2026-09-05 15:10:27,209 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 15:10:27,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:15:33,446 INFO core: _init_accounts coroutine started
2026-09-05 15:15:33,448 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 15:15:33,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 15:15:37,559 INFO core: Event loop thread started, running loop forever
2026-09-05 15:15:37,860 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 15:15:37,865 INFO core: _init_accounts coroutine started
2026-09-05 15:15:37,867 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 15:15:37,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:20:15,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:25:44,032 INFO core: Event loop thread started, running loop forever
2026-09-05 15:25:44,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 15:25:44,336 INFO core: _init_accounts coroutine started
2026-09-05 15:25:44,338 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 15:25:44,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:30:50,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 15:30:51,416 INFO core: Event loop thread started, running loop forever
2026-09-05 15:30:51,717 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 15:30:51,721 INFO core: _init_accounts coroutine started
2026-09-05 15:30:51,722 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 15:30:51,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:35:22,133 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 15:35:22,133 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 15:35:22,135 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 15:35:22,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:40:29,447 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 15:40:45,265 INFO core: Event loop thread started, running loop forever
2026-09-05 15:40:45,566 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 15:40:45,569 INFO core: _init_accounts coroutine started
2026-09-05 15:40:45,571 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 15:40:45,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:45:24,305 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:50:31,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 15:50:49,024 INFO core: Event loop thread started, running loop forever
2026-09-05 15:50:49,325 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 15:50:49,328 INFO core: _init_accounts coroutine started
2026-09-05 15:50:49,330 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 15:50:49,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 15:55:13,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:00:20,343 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 16:00:37,141 INFO core: Event loop thread started, running loop forever
2026-09-05 16:00:37,442 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 16:00:37,450 INFO core: _init_accounts coroutine started
2026-09-05 16:00:37,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 16:00:37,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:05:08,973 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:05:08,974 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 16:05:08,975 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 16:10:15,185 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-05 16:10:15,187 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 16:10:15,192 INFO core: Event loop thread started, running loop forever
2026-09-05 16:10:15,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 16:10:15,496 INFO core: _init_accounts coroutine started
2026-09-05 16:10:15,497 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 16:10:15,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:15:21,423 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-09-05 16:15:49,348 INFO core: Event loop thread started, running loop forever
2026-09-05 16:15:49,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 16:15:49,654 INFO core: _init_accounts coroutine started
2026-09-05 16:15:49,655 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 16:15:49,661 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:20:22,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:20:22,115 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 16:20:22,115 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 16:25:04,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:30:11,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 16:30:11,447 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 16:30:11,447 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-05 16:30:11,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 16:30:11,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 16:30:27,970 INFO core: Event loop thread started, running loop forever
2026-09-05 16:30:28,271 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 16:30:28,280 INFO core: _init_accounts coroutine started
2026-09-05 16:30:28,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 16:30:28,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:35:31,577 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 16:35:31,577 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:35:31,578 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 16:40:17,766 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 16:40:17,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:45:23,432 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 16:45:51,355 INFO core: Event loop thread started, running loop forever
2026-09-05 16:45:51,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 16:45:51,663 INFO core: _init_accounts coroutine started
2026-09-05 16:45:51,663 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 16:45:51,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:50:43,505 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 16:50:43,506 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 16:50:43,507 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 16:50:43,512 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 16:50:43,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:55:27,139 INFO core: Event loop thread started, running loop forever
2026-09-05 16:55:27,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 16:55:27,445 INFO core: _init_accounts coroutine started
2026-09-05 16:55:27,445 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 16:55:27,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 16:55:50,172 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 16:55:50,173 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 16:55:50,173 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 17:00:32,156 INFO core: Event loop thread started, running loop forever
2026-09-05 17:00:32,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 17:00:32,460 INFO core: _init_accounts coroutine started
2026-09-05 17:00:32,462 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 17:00:32,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:05:39,362 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 17:05:42,315 INFO core: Event loop thread started, running loop forever
2026-09-05 17:05:42,616 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 17:05:42,623 INFO core: _init_accounts coroutine started
2026-09-05 17:05:42,624 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 17:05:42,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:10:45,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:15:26,708 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 17:15:26,709 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 17:15:26,715 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 17:15:26,721 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:20:24,592 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 17:20:24,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:25:40,493 INFO core: Event loop thread started, running loop forever
2026-09-05 17:25:40,794 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 17:25:40,799 INFO core: _init_accounts coroutine started
2026-09-05 17:25:40,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 17:25:40,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:30:35,393 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 17:30:35,393 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 17:30:35,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 17:30:35,396 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 17:30:35,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:35:50,986 INFO core: Event loop thread started, running loop forever
2026-09-05 17:35:51,287 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 17:35:51,292 INFO core: _init_accounts coroutine started
2026-09-05 17:35:51,293 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 17:35:51,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:40:29,651 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 17:40:29,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:45:47,560 INFO core: Event loop thread started, running loop forever
2026-09-05 17:45:47,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 17:45:47,865 INFO core: _init_accounts coroutine started
2026-09-05 17:45:47,868 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 17:45:47,874 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:50:51,463 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 17:55:44,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:00:46,373 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:00:46,374 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 18:00:46,374 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 18:05:41,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:05:41,826 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 18:10:43,150 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 18:10:43,162 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 18:10:43,162 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 18:10:43,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:15:19,164 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 18:15:19,166 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 18:15:19,178 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:20:08,957 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 18:20:08,957 WARNING core: Account 2: connect timed out after 35s
2026-09-05 18:20:08,958 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 18:20:08,959 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 18:20:08,960 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 18:20:08,961 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 18:20:08,962 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 18:20:08,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:25:14,476 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 18:25:14,477 WARNING core: Account 2: connect timed out after 35s
2026-09-05 18:25:14,477 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-05 18:25:14,477 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-05 18:25:14,478 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 18:25:14,478 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-05 18:25:14,479 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-05 18:25:50,503 INFO core: Event loop thread started, running loop forever
2026-09-05 18:25:50,804 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 18:25:50,808 INFO core: _init_accounts coroutine started
2026-09-05 18:25:50,809 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 18:25:50,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:30:47,623 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 18:30:47,623 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 18:30:47,624 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 18:30:47,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:35:06,928 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 18:35:06,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:40:32,795 INFO core: Event loop thread started, running loop forever
2026-09-05 18:40:33,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 18:40:33,101 INFO core: _init_accounts coroutine started
2026-09-05 18:40:33,101 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 18:40:33,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:45:29,164 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 18:45:29,164 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 18:45:29,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:45:29,166 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 18:50:36,366 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-05 18:50:36,366 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 18:50:36,367 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-05 18:50:36,367 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 18:50:36,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 18:50:37,101 INFO core: Event loop thread started, running loop forever
2026-09-05 18:50:37,402 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 18:50:37,405 INFO core: _init_accounts coroutine started
2026-09-05 18:50:37,409 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 18:50:37,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 18:55:44,405 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 18:55:44,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 18:55:44,405 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-05 18:55:51,784 INFO core: Event loop thread started, running loop forever
2026-09-05 18:55:52,084 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 18:55:52,087 INFO core: _init_accounts coroutine started
2026-09-05 18:55:52,088 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 18:55:52,097 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:00:15,030 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 19:00:15,030 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 19:00:15,035 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 19:00:15,037 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 19:00:15,048 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 19:00:15,049 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 19:00:15,053 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 19:00:15,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:00:15,055 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 19:05:22,381 WARNING core: Account 2: connect timed out after 35s
2026-09-05 19:05:22,382 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 19:05:22,382 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 19:05:22,383 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 19:05:22,385 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 19:05:22,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 19:05:43,337 INFO core: Event loop thread started, running loop forever
2026-09-05 19:05:43,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 19:05:43,642 INFO core: _init_accounts coroutine started
2026-09-05 19:05:43,644 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 19:05:43,657 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 19:05:43,658 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 19:05:43,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:10:43,500 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 19:10:43,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:10:43,503 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 19:15:12,614 INFO core: Event loop thread started, running loop forever
2026-09-05 19:15:12,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 19:15:12,920 INFO core: _init_accounts coroutine started
2026-09-05 19:15:12,920 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 19:15:12,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:20:27,308 INFO core: Event loop thread started, running loop forever
2026-09-05 19:20:27,609 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 19:20:27,613 INFO core: _init_accounts coroutine started
2026-09-05 19:20:27,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 19:20:27,622 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:25:29,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:30:35,345 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 19:30:45,543 INFO core: Event loop thread started, running loop forever
2026-09-05 19:30:45,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 19:30:45,848 INFO core: _init_accounts coroutine started
2026-09-05 19:30:45,848 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 19:30:45,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:35:29,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:40:18,388 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 19:40:18,389 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 19:40:18,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:45:25,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 19:45:32,577 INFO core: Event loop thread started, running loop forever
2026-09-05 19:45:32,878 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 19:45:32,881 INFO core: _init_accounts coroutine started
2026-09-05 19:45:32,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 19:45:32,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:50:20,699 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 19:50:20,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 19:55:25,228 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:00:44,946 INFO core: Event loop thread started, running loop forever
2026-09-05 20:00:45,247 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 20:00:45,250 INFO core: _init_accounts coroutine started
2026-09-05 20:00:45,251 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 20:00:45,260 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:05:22,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:10:18,469 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 20:10:18,469 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 20:10:18,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:15:04,682 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-05 20:15:04,684 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 20:15:04,687 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 20:15:04,688 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:20:10,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 20:20:33,712 INFO core: Event loop thread started, running loop forever
2026-09-05 20:20:34,013 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 20:20:34,016 INFO core: _init_accounts coroutine started
2026-09-05 20:20:34,017 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 20:20:34,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:25:14,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:30:32,280 INFO core: Event loop thread started, running loop forever
2026-09-05 20:30:32,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 20:30:32,585 INFO core: _init_accounts coroutine started
2026-09-05 20:30:32,586 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 20:30:32,594 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:35:10,481 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:40:11,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 20:40:11,626 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 20:40:11,631 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 20:40:11,632 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 20:40:11,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:45:48,366 INFO core: Event loop thread started, running loop forever
2026-09-05 20:45:48,667 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 20:45:48,670 INFO core: _init_accounts coroutine started
2026-09-05 20:45:48,672 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 20:45:48,678 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:50:44,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 20:55:28,128 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 20:55:28,128 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 20:55:28,130 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 20:55:28,131 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:00:05,346 INFO core: Event loop thread started, running loop forever
2026-09-05 21:00:05,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 21:00:05,669 INFO core: _init_accounts coroutine started
2026-09-05 21:00:05,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 21:00:05,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:00:35,387 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 21:00:35,388 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-05 21:00:35,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 21:00:35,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 21:05:11,356 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 21:05:33,355 INFO core: Event loop thread started, running loop forever
2026-09-05 21:05:33,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 21:05:33,659 INFO core: _init_accounts coroutine started
2026-09-05 21:05:33,662 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 21:05:33,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:10:21,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 21:10:21,583 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 21:10:21,584 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 21:10:21,586 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 21:10:21,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:15:16,634 INFO core: Event loop thread started, running loop forever
2026-09-05 21:15:16,936 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 21:15:16,941 INFO core: _init_accounts coroutine started
2026-09-05 21:15:16,942 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 21:15:16,946 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:20:23,368 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-05 21:20:32,932 INFO core: Event loop thread started, running loop forever
2026-09-05 21:20:33,233 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 21:20:33,237 INFO core: _init_accounts coroutine started
2026-09-05 21:20:33,238 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 21:20:33,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:25:31,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:25:31,259 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 21:25:31,260 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 21:30:03,341 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 21:30:27,002 INFO core: Event loop thread started, running loop forever
2026-09-05 21:30:27,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 21:30:27,305 INFO core: _init_accounts coroutine started
2026-09-05 21:30:27,307 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 21:30:27,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:35:27,360 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 21:35:27,360 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 21:35:27,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 21:35:27,363 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 21:35:27,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:40:32,556 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 21:40:32,557 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 21:40:32,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:45:49,866 INFO core: Event loop thread started, running loop forever
2026-09-05 21:45:50,167 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 21:45:50,172 INFO core: _init_accounts coroutine started
2026-09-05 21:45:50,172 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 21:45:50,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:50:41,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 21:50:41,086 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 21:50:41,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 21:55:05,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 21:55:05,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:00:09,295 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 22:00:09,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:05:31,545 INFO core: Event loop thread started, running loop forever
2026-09-05 22:05:31,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 22:05:31,851 INFO core: _init_accounts coroutine started
2026-09-05 22:05:31,853 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 22:05:31,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:10:11,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:15:42,144 INFO core: Event loop thread started, running loop forever
2026-09-05 22:15:42,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 22:15:42,449 INFO core: _init_accounts coroutine started
2026-09-05 22:15:42,452 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 22:15:42,460 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:20:28,386 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 22:20:28,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 22:20:28,391 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 22:20:28,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:20:28,394 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 22:25:10,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:30:08,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:35:11,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:40:19,040 INFO core: Event loop thread started, running loop forever
2026-09-05 22:40:19,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 22:40:19,345 INFO core: _init_accounts coroutine started
2026-09-05 22:40:19,346 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 22:40:19,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:45:31,933 INFO core: Event loop thread started, running loop forever
2026-09-05 22:45:32,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 22:45:32,237 INFO core: _init_accounts coroutine started
2026-09-05 22:45:32,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 22:45:32,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:50:37,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 22:50:37,681 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 22:55:25,268 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 22:55:25,275 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 22:55:25,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:00:32,385 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 23:00:32,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-05 23:00:38,513 INFO core: Event loop thread started, running loop forever
2026-09-05 23:00:38,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 23:00:38,821 INFO core: _init_accounts coroutine started
2026-09-05 23:00:38,821 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 23:00:38,826 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:05:21,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:10:09,190 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:15:09,146 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 23:15:09,147 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 23:15:09,152 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 23:15:09,160 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 23:15:09,171 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 23:15:09,171 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-05 23:15:09,177 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-05 23:15:09,178 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-05 23:15:09,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:20:03,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 23:20:03,384 WARNING core: Account 2: connect timed out after 35s
2026-09-05 23:20:03,385 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-05 23:20:03,385 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-05 23:20:03,386 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 23:20:03,387 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-05 23:20:03,388 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-05 23:20:03,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:25:10,381 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-05 23:25:10,382 WARNING core: Account 2: connect timed out after 35s
2026-09-05 23:25:10,383 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-05 23:25:10,383 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-05 23:25:10,383 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-05 23:25:10,385 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-05 23:25:10,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-05 23:25:49,454 INFO core: Event loop thread started, running loop forever
2026-09-05 23:25:49,755 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 23:25:49,758 INFO core: _init_accounts coroutine started
2026-09-05 23:25:49,758 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 23:25:49,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:30:12,061 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 23:30:12,061 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 23:30:12,063 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-05 23:30:12,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:30:12,066 INFO core: _init_accounts_inner: reloading LLM config
2026-09-05 23:35:18,394 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-05 23:35:54,098 INFO core: Event loop thread started, running loop forever
2026-09-05 23:35:54,399 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 23:35:54,402 INFO core: _init_accounts coroutine started
2026-09-05 23:35:54,405 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 23:35:54,416 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:40:13,131 INFO core: Event loop thread started, running loop forever
2026-09-05 23:40:13,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 23:40:13,435 INFO core: _init_accounts coroutine started
2026-09-05 23:40:13,437 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 23:40:13,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:41:00,219 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-05 23:41:00,220 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-05 23:41:00,241 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-05 23:45:37,268 INFO core: Event loop thread started, running loop forever
2026-09-05 23:45:37,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 23:45:37,574 INFO core: _init_accounts coroutine started
2026-09-05 23:45:37,575 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 23:45:37,578 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:50:07,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-05 23:55:48,480 INFO core: Event loop thread started, running loop forever
2026-09-05 23:55:48,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-05 23:55:48,785 INFO core: _init_accounts coroutine started
2026-09-05 23:55:48,785 INFO core: _init_accounts_inner: starting DB migrations
2026-09-05 23:55:48,800 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:00:39,193 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 00:00:39,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:05:23,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:10:24,477 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-06 00:10:24,478 INFO core: _init_accounts coroutine started
2026-09-06 00:10:24,479 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 00:10:24,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:15:34,837 INFO core: Event loop thread started, running loop forever
2026-09-06 00:15:35,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 00:15:35,144 INFO core: _init_accounts coroutine started
2026-09-06 00:15:35,144 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 00:15:35,148 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:20:26,890 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 00:20:26,890 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 00:20:26,890 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:25:28,105 INFO core: Event loop thread started, running loop forever
2026-09-06 00:25:28,406 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 00:25:28,415 INFO core: _init_accounts coroutine started
2026-09-06 00:25:28,416 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 00:25:28,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:25:33,102 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 00:25:33,118 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 00:30:28,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:35:12,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:40:19,379 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 00:40:23,779 INFO core: Event loop thread started, running loop forever
2026-09-06 00:40:24,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 00:40:24,083 INFO core: _init_accounts coroutine started
2026-09-06 00:40:24,083 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 00:40:24,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:45:30,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 00:45:44,331 INFO core: Event loop thread started, running loop forever
2026-09-06 00:45:44,632 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 00:45:44,637 INFO core: _init_accounts coroutine started
2026-09-06 00:45:44,638 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 00:45:44,645 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:50:14,777 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 00:50:14,777 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 00:50:14,779 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 00:50:14,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 00:55:20,484 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 00:55:52,551 INFO core: Event loop thread started, running loop forever
2026-09-06 00:55:52,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 00:55:52,855 INFO core: _init_accounts coroutine started
2026-09-06 00:55:52,857 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 00:55:52,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:00:19,851 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:05:25,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 01:05:33,604 INFO core: Event loop thread started, running loop forever
2026-09-06 01:05:33,906 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 01:05:33,919 INFO core: _init_accounts coroutine started
2026-09-06 01:05:33,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:05:33,932 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 01:10:37,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:15:10,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:20:17,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 01:20:36,276 INFO core: Event loop thread started, running loop forever
2026-09-06 01:20:36,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 01:20:36,581 INFO core: _init_accounts coroutine started
2026-09-06 01:20:36,583 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 01:20:36,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:25:43,399 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-06 01:25:43,612 INFO core: Event loop thread started, running loop forever
2026-09-06 01:25:43,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 01:25:43,919 INFO core: _init_accounts coroutine started
2026-09-06 01:25:43,919 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 01:25:43,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:30:36,117 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 01:30:36,118 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 01:30:36,119 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 01:30:36,120 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 01:30:36,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:35:43,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 01:35:43,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 01:35:43,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 01:35:45,648 INFO core: Event loop thread started, running loop forever
2026-09-06 01:35:45,950 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 01:35:45,956 INFO core: _init_accounts coroutine started
2026-09-06 01:35:45,956 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 01:35:45,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:40:26,796 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:45:32,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 01:45:52,281 INFO core: Event loop thread started, running loop forever
2026-09-06 01:45:52,583 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 01:45:52,588 INFO core: _init_accounts coroutine started
2026-09-06 01:45:52,589 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 01:45:52,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:50:05,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 01:50:05,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 01:50:05,104 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 01:55:27,595 INFO core: Event loop thread started, running loop forever
2026-09-06 01:55:27,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 01:55:27,902 INFO core: _init_accounts coroutine started
2026-09-06 01:55:27,903 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 01:55:27,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:00:03,372 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 02:00:45,856 INFO core: Event loop thread started, running loop forever
2026-09-06 02:00:46,157 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 02:00:46,161 INFO core: _init_accounts coroutine started
2026-09-06 02:00:46,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 02:00:46,168 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:05:36,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:10:32,796 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 02:10:32,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:15:48,893 INFO core: Event loop thread started, running loop forever
2026-09-06 02:15:49,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 02:15:49,199 INFO core: _init_accounts coroutine started
2026-09-06 02:15:49,201 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 02:15:49,205 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:20:06,228 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:25:13,373 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 02:25:13,374 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 02:25:39,192 INFO core: Event loop thread started, running loop forever
2026-09-06 02:25:39,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 02:25:39,499 INFO core: _init_accounts coroutine started
2026-09-06 02:25:39,500 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 02:25:39,506 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:30:46,252 INFO core: Event loop thread started, running loop forever
2026-09-06 02:30:46,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 02:30:46,561 INFO core: _init_accounts coroutine started
2026-09-06 02:30:46,563 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 02:30:46,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:35:51,728 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 02:35:51,728 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 02:35:51,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:40:50,065 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 02:40:50,071 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 02:40:50,071 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:45:36,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:50:20,004 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:55:19,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 02:55:19,248 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 02:55:19,248 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 03:00:13,960 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 03:00:13,962 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 03:00:13,964 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:05:19,374 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 03:05:45,104 INFO core: Event loop thread started, running loop forever
2026-09-06 03:05:45,406 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 03:05:45,409 INFO core: _init_accounts coroutine started
2026-09-06 03:05:45,411 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 03:05:45,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:10:22,572 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 03:10:22,573 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 03:10:22,574 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 03:10:22,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:15:29,403 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 03:15:52,186 INFO core: Event loop thread started, running loop forever
2026-09-06 03:15:52,487 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 03:15:52,490 INFO core: _init_accounts coroutine started
2026-09-06 03:15:52,492 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 03:15:52,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:20:48,531 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 03:20:48,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:25:29,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:30:46,403 INFO core: Event loop thread started, running loop forever
2026-09-06 03:30:46,704 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 03:30:46,708 INFO core: _init_accounts coroutine started
2026-09-06 03:30:46,709 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 03:30:46,717 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:35:06,961 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 03:35:06,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:40:42,017 INFO core: Event loop thread started, running loop forever
2026-09-06 03:40:42,320 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 03:40:42,326 INFO core: _init_accounts coroutine started
2026-09-06 03:40:42,327 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 03:40:42,332 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:45:53,160 INFO core: Event loop thread started, running loop forever
2026-09-06 03:45:53,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 03:45:53,468 INFO core: _init_accounts coroutine started
2026-09-06 03:45:53,470 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 03:45:53,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:50:15,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 03:55:22,413 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 03:55:22,414 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 03:55:22,422 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 03:55:22,428 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 03:55:37,274 INFO core: Event loop thread started, running loop forever
2026-09-06 03:55:37,575 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 03:55:37,578 INFO core: _init_accounts coroutine started
2026-09-06 03:55:37,580 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 03:55:37,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:00:35,547 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 04:00:35,547 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 04:00:35,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:05:28,846 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 04:05:28,853 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 04:05:28,854 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:10:16,780 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 04:10:16,780 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 04:10:16,786 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 04:10:16,787 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 04:10:16,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:15:02,365 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 04:15:02,366 WARNING core: Account 2: connect timed out after 35s
2026-09-06 04:15:02,368 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-06 04:15:02,368 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-06 04:15:02,369 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-06 04:15:25,401 INFO core: Event loop thread started, running loop forever
2026-09-06 04:15:25,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 04:15:25,706 INFO core: _init_accounts coroutine started
2026-09-06 04:15:25,706 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 04:15:25,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:20:30,092 INFO core: Event loop thread started, running loop forever
2026-09-06 04:20:30,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 04:20:30,396 INFO core: _init_accounts coroutine started
2026-09-06 04:20:30,399 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 04:20:30,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:20:32,087 ERROR sqlalchemy.pool.impl.QueuePool: Exception during reset or similar
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/db.py", line 68, in _conn
    yield conn
  File "/home/wovewbge/quill.nx.kg/db.py", line 542, in get_accounts
    cur.execute(
    ~~~~~~~~~~~^
        "SELECT id, name, phone, is_primary, is_authorized, status, "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        "phone_code_hash, created_at, updated_at "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        "FROM tg_accounts ORDER BY is_primary DESC, id"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 159, in execute
    result = self._query(query)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 330, in _query
    conn.query(q)
    ~~~~~~~~~~^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 582, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 847, in _read_query_result
    result.read()
    ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 1245, in read
    first_packet = self.connection._read_packet()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet_header = self._read_bytes(4)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 826, in _read_bytes
    raise err.OperationalError(
        CR.CR_SERVER_LOST, "Lost connection to MySQL server during query"
    )
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 986, in _finalize_fairy
    fairy._reset(
    ~~~~~~~~~~~~^
        pool,
        ^^^^^
    ...<2 lines>...
        asyncio_safe=can_manipulate_connection,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1441, in _reset
    pool._dialect.do_rollback(self)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 123, in do_rollback
    dbapi_connection.rollback()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 511, in rollback
    self._execute_command(COMMAND.COM_QUERY, "ROLLBACK")
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 865, in _execute_command
    raise err.InterfaceError(0, "")
pymysql.err.InterfaceError: (0, '')
2026-09-06 04:20:32,102 ERROR core: _init_accounts failed: (2013, 'Lost connection to MySQL server during query')
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 542, in get_accounts
    cur.execute(
    ~~~~~~~~~~~^
        "SELECT id, name, phone, is_primary, is_authorized, status, "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        "phone_code_hash, created_at, updated_at "
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        "FROM tg_accounts ORDER BY is_primary DESC, id"
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 159, in execute
    result = self._query(query)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/cursors.py", line 330, in _query
    conn.query(q)
    ~~~~~~~~~~^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 582, in query
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
                          ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 847, in _read_query_result
    result.read()
    ~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 1245, in read
    first_packet = self.connection._read_packet()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet_header = self._read_bytes(4)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 826, in _read_bytes
    raise err.OperationalError(
        CR.CR_SERVER_LOST, "Lost connection to MySQL server during query"
    )
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
2026-09-06 04:25:08,048 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 04:25:08,049 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 04:25:08,051 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 04:25:08,054 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 04:25:08,069 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 04:25:08,069 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 04:25:08,074 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 04:25:08,074 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 04:25:08,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:30:13,670 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 04:30:13,671 WARNING core: Account 2: connect timed out after 35s
2026-09-06 04:30:13,671 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-06 04:30:13,672 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-06 04:30:13,673 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-06 04:30:13,674 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-06 04:30:13,674 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-06 04:30:13,724 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:35:22,592 INFO core: Event loop thread started, running loop forever
2026-09-06 04:35:22,893 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 04:35:22,898 INFO core: _init_accounts coroutine started
2026-09-06 04:35:22,901 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 04:35:22,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:40:13,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:45:18,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:50:52,322 INFO core: Event loop thread started, running loop forever
2026-09-06 04:50:52,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 04:50:52,627 INFO core: _init_accounts coroutine started
2026-09-06 04:50:52,629 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 04:50:52,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 04:55:14,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:00:20,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 05:00:36,732 INFO core: Event loop thread started, running loop forever
2026-09-06 05:00:37,033 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 05:00:37,038 INFO core: _init_accounts coroutine started
2026-09-06 05:00:37,038 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 05:00:37,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:05:22,382 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 05:05:22,389 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:10:49,820 INFO core: Event loop thread started, running loop forever
2026-09-06 05:10:50,121 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 05:10:50,124 INFO core: _init_accounts coroutine started
2026-09-06 05:10:50,125 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 05:10:50,133 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:15:07,475 INFO core: Event loop thread started, running loop forever
2026-09-06 05:15:07,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 05:15:07,779 INFO core: _init_accounts coroutine started
2026-09-06 05:15:07,781 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 05:15:07,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:20:13,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 05:20:49,823 INFO core: Event loop thread started, running loop forever
2026-09-06 05:20:50,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 05:20:50,128 INFO core: _init_accounts coroutine started
2026-09-06 05:20:50,130 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 05:20:50,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:25:50,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:30:25,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:35:31,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 05:35:31,493 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 05:35:31,496 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-06 05:35:47,649 INFO core: Event loop thread started, running loop forever
2026-09-06 05:35:47,950 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 05:35:47,952 INFO core: _init_accounts coroutine started
2026-09-06 05:35:47,954 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 05:35:47,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:40:15,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:40:15,090 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 05:40:15,092 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 05:45:03,731 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 05:45:03,742 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 05:45:03,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:50:04,444 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 05:55:11,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 05:55:47,128 INFO core: Event loop thread started, running loop forever
2026-09-06 05:55:47,429 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 05:55:47,432 INFO core: _init_accounts coroutine started
2026-09-06 05:55:47,434 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 05:55:47,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:00:20,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 06:00:20,879 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 06:00:20,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:00:20,880 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 06:05:26,384 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 06:05:49,321 INFO core: Event loop thread started, running loop forever
2026-09-06 06:05:49,623 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 06:05:49,627 INFO core: _init_accounts coroutine started
2026-09-06 06:05:49,627 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 06:05:49,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:10:16,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:15:06,019 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 06:15:06,022 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 06:15:06,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:15:06,026 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 06:20:07,365 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 06:20:07,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:25:14,563 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 06:25:24,613 INFO core: Event loop thread started, running loop forever
2026-09-06 06:25:24,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 06:25:24,918 INFO core: _init_accounts coroutine started
2026-09-06 06:25:24,920 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 06:25:24,930 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:30:03,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 06:30:52,372 INFO core: Event loop thread started, running loop forever
2026-09-06 06:30:52,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 06:30:52,676 INFO core: _init_accounts coroutine started
2026-09-06 06:30:52,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 06:30:52,682 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:35:31,588 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 06:35:31,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:40:52,113 INFO core: Event loop thread started, running loop forever
2026-09-06 06:40:52,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 06:40:52,418 INFO core: _init_accounts coroutine started
2026-09-06 06:40:52,418 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 06:40:52,426 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:45:07,289 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 06:45:07,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:50:06,769 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 06:55:18,551 INFO core: Event loop thread started, running loop forever
2026-09-06 06:55:18,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 06:55:18,857 INFO core: _init_accounts coroutine started
2026-09-06 06:55:18,859 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 06:55:18,865 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:00:25,062 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-06 07:00:25,072 INFO core: Event loop thread started, running loop forever
2026-09-06 07:00:25,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 07:00:25,376 INFO core: _init_accounts coroutine started
2026-09-06 07:00:25,378 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 07:00:25,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:05:30,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 07:05:30,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 07:05:30,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:10:37,370 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 07:10:37,372 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 07:10:37,373 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 07:10:37,373 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 07:10:37,373 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 07:10:37,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 07:10:50,598 INFO core: Event loop thread started, running loop forever
2026-09-06 07:10:50,899 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 07:10:50,906 INFO core: _init_accounts coroutine started
2026-09-06 07:10:50,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 07:10:50,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:15:27,220 INFO core: Event loop thread started, running loop forever
2026-09-06 07:15:27,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 07:15:27,525 INFO core: _init_accounts coroutine started
2026-09-06 07:15:27,527 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 07:15:27,538 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 07:15:27,538 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 07:15:27,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:15:57,243 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 07:20:33,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 07:20:33,440 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 07:20:48,181 INFO core: Event loop thread started, running loop forever
2026-09-06 07:20:48,483 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 07:20:48,487 INFO core: _init_accounts coroutine started
2026-09-06 07:20:48,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 07:20:48,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:25:23,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:25:23,222 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 07:25:23,222 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 07:30:34,564 INFO core: Event loop thread started, running loop forever
2026-09-06 07:30:34,865 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 07:30:34,869 INFO core: _init_accounts coroutine started
2026-09-06 07:30:34,869 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 07:30:34,877 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:35:26,014 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 07:35:26,014 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 07:35:26,016 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 07:35:26,017 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 07:35:26,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:40:33,594 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 07:40:33,594 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 07:40:33,595 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 07:40:38,400 INFO core: Event loop thread started, running loop forever
2026-09-06 07:40:38,701 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 07:40:38,704 INFO core: _init_accounts coroutine started
2026-09-06 07:40:38,707 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 07:40:38,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:45:07,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:50:04,520 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 07:50:04,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 07:50:04,524 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 07:55:17,402 INFO core: Event loop thread started, running loop forever
2026-09-06 07:55:17,703 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 07:55:17,706 INFO core: _init_accounts coroutine started
2026-09-06 07:55:17,708 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 07:55:17,714 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:00:24,461 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-06 08:00:38,769 INFO core: Event loop thread started, running loop forever
2026-09-06 08:00:39,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 08:00:39,076 INFO core: _init_accounts coroutine started
2026-09-06 08:00:39,076 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 08:00:39,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:05:43,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:10:43,220 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 08:10:43,227 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 08:10:43,229 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 08:10:43,244 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 08:10:43,267 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:15:30,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:20:24,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:25:31,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 08:25:31,501 INFO core: _init_accounts_inner: schema/LLM steps complete
Fatal Python error: _enter_buffered_busy: could not acquire lock for <_io.BufferedWriter name='<stderr>'> at interpreter shutdown, possibly due to daemon threads
Python runtime state: finalizing (tstate=0x00007faebeb3df48)

Current thread 0x00007faebedce740 (most recent call first):
  <no Python frame>

Extension modules: psutil._psutil_linux, markupsafe._speedups, PIL._imaging, zope.interface._zope_interface_coptimizations, _cffi_backend, charset_normalizer.md, charset_normalizer.cd, requests.packages.charset_normalizer.md, requests.packages.chardet.md, requests.packages.charset_normalizer.cd, requests.packages.chardet.cd, sqlalchemy.cyextension.collections, sqlalchemy.cyextension.immutabledict, sqlalchemy.cyextension.processors, sqlalchemy.cyextension.resultproxy, sqlalchemy.cyextension.util, greenlet._greenlet (total: 17)
[UID:1957][1158234] Child process with pid: 1563336 was killed by signal: 6, core dumped: yes
2026-09-06 08:25:37,441 INFO core: Event loop thread started, running loop forever
2026-09-06 08:25:37,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 08:25:37,746 INFO core: _init_accounts coroutine started
2026-09-06 08:25:37,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 08:25:37,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:30:04,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:35:30,770 INFO core: Event loop thread started, running loop forever
2026-09-06 08:35:31,071 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 08:35:31,074 INFO core: _init_accounts coroutine started
2026-09-06 08:35:31,076 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 08:35:31,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:40:37,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 08:40:46,455 INFO core: Event loop thread started, running loop forever
2026-09-06 08:40:46,755 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 08:40:46,758 INFO core: _init_accounts coroutine started
2026-09-06 08:40:46,758 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 08:40:46,765 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:45:20,689 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 08:45:20,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:50:30,076 INFO core: Event loop thread started, running loop forever
2026-09-06 08:50:30,377 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 08:50:30,381 INFO core: _init_accounts coroutine started
2026-09-06 08:50:30,384 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 08:50:30,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 08:55:37,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 08:55:43,476 INFO core: Event loop thread started, running loop forever
2026-09-06 08:55:43,777 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 08:55:43,780 INFO core: _init_accounts coroutine started
2026-09-06 08:55:43,780 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 08:55:43,788 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:00:40,146 INFO core: Event loop thread started, running loop forever
2026-09-06 09:00:40,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 09:00:40,451 INFO core: _init_accounts coroutine started
2026-09-06 09:00:40,451 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 09:00:40,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:05:40,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:10:49,704 INFO core: Event loop thread started, running loop forever
2026-09-06 09:10:50,006 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 09:10:50,013 INFO core: _init_accounts coroutine started
2026-09-06 09:10:50,014 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 09:10:50,043 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:15:51,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:20:10,758 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 09:20:10,760 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 09:20:10,762 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 09:20:10,765 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 09:20:10,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:20:10,782 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 09:20:10,784 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 09:25:04,476 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 09:25:04,477 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 09:25:04,480 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:30:11,405 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 09:30:11,406 WARNING core: Account 2: connect timed out after 35s
2026-09-06 09:30:12,970 INFO core: Event loop thread started, running loop forever
2026-09-06 09:30:13,271 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 09:30:13,276 INFO core: _init_accounts coroutine started
2026-09-06 09:30:13,278 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 09:30:13,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:35:20,516 INFO core: Event loop thread started, running loop forever
2026-09-06 09:35:20,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 09:35:20,822 INFO core: _init_accounts coroutine started
2026-09-06 09:35:20,822 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 09:35:20,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:40:27,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 09:40:30,548 INFO core: Event loop thread started, running loop forever
2026-09-06 09:40:30,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 09:40:30,855 INFO core: _init_accounts coroutine started
2026-09-06 09:40:30,857 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 09:40:30,865 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:45:10,746 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 09:45:10,750 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:50:43,729 INFO core: Event loop thread started, running loop forever
2026-09-06 09:50:44,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 09:50:44,035 INFO core: _init_accounts coroutine started
2026-09-06 09:50:44,035 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 09:50:44,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:55:13,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 09:55:13,632 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 09:55:13,635 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 10:00:30,898 INFO core: Event loop thread started, running loop forever
2026-09-06 10:00:31,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 10:00:31,204 INFO core: _init_accounts coroutine started
2026-09-06 10:00:31,204 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 10:00:31,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:05:19,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:10:24,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:15:39,976 INFO core: Event loop thread started, running loop forever
2026-09-06 10:15:40,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 10:15:40,282 INFO core: _init_accounts coroutine started
2026-09-06 10:15:40,282 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 10:15:40,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:20:06,540 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 10:20:06,540 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 10:20:06,542 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 10:20:06,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:20:06,546 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 10:25:13,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 10:25:13,425 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 10:25:45,315 INFO core: Event loop thread started, running loop forever
2026-09-06 10:25:45,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 10:25:45,620 INFO core: _init_accounts coroutine started
2026-09-06 10:25:45,621 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 10:25:45,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:30:22,372 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 10:30:22,378 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:35:42,861 INFO core: Event loop thread started, running loop forever
2026-09-06 10:35:43,162 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 10:35:43,166 INFO core: _init_accounts coroutine started
2026-09-06 10:35:43,167 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 10:35:43,181 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:40:23,463 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:40:23,464 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 10:40:23,465 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 10:45:30,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 10:45:30,431 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 10:45:30,432 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 10:45:30,432 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 10:45:30,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 10:45:30,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 10:45:39,036 INFO core: Event loop thread started, running loop forever
2026-09-06 10:45:39,338 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 10:45:39,343 INFO core: _init_accounts coroutine started
2026-09-06 10:45:39,344 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 10:45:39,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:50:20,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 10:55:10,241 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 10:55:10,241 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 10:55:10,246 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 10:55:10,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:00:17,378 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 11:00:17,378 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 11:00:17,379 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 11:00:17,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 11:00:39,397 INFO core: Event loop thread started, running loop forever
2026-09-06 11:00:39,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 11:00:39,703 INFO core: _init_accounts coroutine started
2026-09-06 11:00:39,703 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:00:39,708 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:05:27,854 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 11:05:27,867 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:10:51,591 INFO core: Event loop thread started, running loop forever
2026-09-06 11:10:51,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 11:10:51,896 INFO core: _init_accounts coroutine started
2026-09-06 11:10:51,897 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:10:51,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:15:05,326 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 11:15:05,326 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 11:15:54,260 INFO core: Event loop thread started, running loop forever
2026-09-06 11:15:54,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 11:15:54,566 INFO core: _init_accounts coroutine started
2026-09-06 11:15:54,567 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:15:54,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:20:18,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:25:25,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 11:25:27,340 INFO core: Event loop thread started, running loop forever
2026-09-06 11:25:27,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 11:25:27,651 INFO core: _init_accounts coroutine started
2026-09-06 11:25:27,651 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:25:27,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:30:34,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 11:30:34,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 11:30:47,396 INFO core: Event loop thread started, running loop forever
2026-09-06 11:30:47,697 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 11:30:47,702 INFO core: _init_accounts coroutine started
2026-09-06 11:30:47,703 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:30:47,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:35:38,666 INFO core: Event loop thread started, running loop forever
2026-09-06 11:35:38,968 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 11:35:38,971 INFO core: _init_accounts coroutine started
2026-09-06 11:35:38,973 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:35:38,980 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:35:54,675 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 11:40:29,479 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 11:40:29,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:45:25,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:50:05,994 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-06 11:50:06,002 INFO core: _init_accounts coroutine started
2026-09-06 11:50:06,002 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:50:06,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 11:55:21,561 INFO core: Event loop thread started, running loop forever
2026-09-06 11:55:21,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 11:55:21,867 INFO core: _init_accounts coroutine started
2026-09-06 11:55:21,868 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 11:55:21,883 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 11:55:21,883 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 11:55:21,884 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 11:55:21,885 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 11:55:21,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:00:28,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 12:00:28,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 12:00:28,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 12:00:33,461 INFO core: Event loop thread started, running loop forever
2026-09-06 12:00:33,762 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 12:00:33,765 INFO core: _init_accounts coroutine started
2026-09-06 12:00:33,766 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 12:00:33,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:05:36,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:10:24,075 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 12:10:24,077 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 12:10:24,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:15:19,942 INFO core: Event loop thread started, running loop forever
2026-09-06 12:15:20,251 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 12:15:20,254 INFO core: _init_accounts coroutine started
2026-09-06 12:15:20,255 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 12:15:20,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:15:31,944 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 12:20:11,993 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 12:20:11,993 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 12:20:11,994 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 12:20:11,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:20:11,997 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 12:25:17,437 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 12:25:17,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 12:25:17,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 12:25:17,959 INFO core: Event loop thread started, running loop forever
2026-09-06 12:25:18,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 12:25:18,263 INFO core: _init_accounts coroutine started
2026-09-06 12:25:18,264 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 12:25:18,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:30:24,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 12:30:32,171 INFO core: Event loop thread started, running loop forever
2026-09-06 12:30:32,472 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 12:30:32,477 INFO core: _init_accounts coroutine started
2026-09-06 12:30:32,477 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 12:30:32,487 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 12:30:32,487 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 12:30:32,489 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 12:30:32,491 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 12:30:32,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:35:39,431 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 12:35:39,431 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 12:35:39,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 12:35:43,132 INFO core: Event loop thread started, running loop forever
2026-09-06 12:35:43,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 12:35:43,447 INFO core: _init_accounts coroutine started
2026-09-06 12:35:43,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 12:35:43,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:40:12,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:45:19,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 12:45:19,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 12:45:19,396 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 12:45:19,398 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 12:45:19,398 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 12:45:19,399 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 12:45:19,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 12:45:20,642 INFO core: Event loop thread started, running loop forever
2026-09-06 12:45:20,947 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 12:45:20,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:50:20,551 INFO core: _init_accounts coroutine started
2026-09-06 12:50:20,552 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 12:50:20,557 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 12:55:36,200 INFO core: Event loop thread started, running loop forever
2026-09-06 12:55:36,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 12:55:36,504 INFO core: _init_accounts coroutine started
2026-09-06 12:55:36,505 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 12:55:36,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:00:04,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:05:10,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 13:05:10,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 13:05:13,125 INFO core: Event loop thread started, running loop forever
2026-09-06 13:05:13,426 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 13:05:13,432 INFO core: _init_accounts coroutine started
2026-09-06 13:05:13,432 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 13:05:13,441 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:10:20,423 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 13:10:34,593 INFO core: Event loop thread started, running loop forever
2026-09-06 13:10:34,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 13:10:34,897 INFO core: _init_accounts coroutine started
2026-09-06 13:10:34,898 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 13:10:34,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:15:14,822 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 13:15:14,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:20:43,790 INFO core: Event loop thread started, running loop forever
2026-09-06 13:20:44,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 13:20:44,101 INFO core: _init_accounts coroutine started
2026-09-06 13:20:44,101 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 13:20:44,107 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:25:30,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:30:06,439 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 13:30:06,440 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 13:30:06,440 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-06 13:30:06,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 13:30:06,441 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 13:30:06,442 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 13:30:06,442 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 13:30:06,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 13:30:06,442 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 13:30:56,115 INFO core: Event loop thread started, running loop forever
2026-09-06 13:30:56,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 13:30:56,419 INFO core: _init_accounts coroutine started
2026-09-06 13:30:56,420 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 13:30:56,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:35:11,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:40:18,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 13:40:18,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 13:40:53,264 INFO core: Event loop thread started, running loop forever
2026-09-06 13:40:53,565 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 13:40:53,568 INFO core: _init_accounts coroutine started
2026-09-06 13:40:53,569 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 13:40:53,577 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:45:48,086 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 13:45:48,088 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 13:45:48,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:50:38,625 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 13:50:38,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 13:55:41,054 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 13:55:41,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:00:23,677 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 14:00:23,678 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 14:00:23,685 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 14:00:23,686 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 14:00:23,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:05:10,326 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 14:05:10,329 WARNING core: Account 2: connect timed out after 35s
2026-09-06 14:05:10,330 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-06 14:05:10,330 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-06 14:05:10,331 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-06 14:05:10,332 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-06 14:05:10,333 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-06 14:05:10,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:10:39,575 INFO core: Event loop thread started, running loop forever
2026-09-06 14:10:39,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 14:10:39,883 INFO core: _init_accounts coroutine started
2026-09-06 14:10:39,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 14:10:39,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:15:41,810 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 14:15:41,847 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:20:09,073 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:25:04,563 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-06 14:25:04,565 INFO core: _init_accounts coroutine started
2026-09-06 14:25:04,566 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 14:25:04,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 14:25:04,573 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 14:25:04,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:30:11,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 14:30:11,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 14:30:11,416 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 14:30:11,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 14:30:11,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 14:30:15,869 INFO core: Event loop thread started, running loop forever
2026-09-06 14:30:16,170 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 14:30:16,176 INFO core: _init_accounts coroutine started
2026-09-06 14:30:16,176 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 14:30:16,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:35:22,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 14:35:22,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 14:35:22,412 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-06 14:35:22,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 14:35:22,413 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 14:35:22,413 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 14:35:22,413 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 14:35:22,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 14:35:49,032 INFO core: Event loop thread started, running loop forever
2026-09-06 14:35:49,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 14:35:49,337 INFO core: _init_accounts coroutine started
2026-09-06 14:35:49,338 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 14:35:49,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:40:16,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:45:11,486 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 14:45:11,487 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 14:45:11,490 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 14:45:11,492 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 14:45:11,508 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:50:14,104 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 14:50:14,105 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 14:50:14,105 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 14:55:20,416 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 14:55:25,516 INFO core: Event loop thread started, running loop forever
2026-09-06 14:55:25,818 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 14:55:25,821 INFO core: _init_accounts coroutine started
2026-09-06 14:55:25,823 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 14:55:25,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:00:12,452 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 15:00:12,453 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 15:00:12,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:05:19,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 15:05:19,388 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 15:05:19,391 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 15:05:19,391 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 15:05:19,391 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 15:05:19,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 15:05:38,477 INFO core: Event loop thread started, running loop forever
2026-09-06 15:05:38,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 15:05:38,782 INFO core: _init_accounts coroutine started
2026-09-06 15:05:38,784 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 15:05:38,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:10:08,020 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 15:10:08,032 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:15:45,803 INFO core: Event loop thread started, running loop forever
2026-09-06 15:15:46,104 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 15:15:46,107 INFO core: _init_accounts coroutine started
2026-09-06 15:15:46,109 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 15:15:46,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:20:03,480 INFO core: Event loop thread started, running loop forever
2026-09-06 15:20:03,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 15:20:03,785 INFO core: _init_accounts coroutine started
2026-09-06 15:20:03,787 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 15:20:03,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:25:10,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 15:25:22,876 INFO core: Event loop thread started, running loop forever
2026-09-06 15:25:23,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 15:25:23,180 INFO core: _init_accounts coroutine started
2026-09-06 15:25:23,182 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 15:25:23,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:30:29,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 15:30:43,990 INFO core: Event loop thread started, running loop forever
2026-09-06 15:30:44,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 15:30:44,294 INFO core: _init_accounts coroutine started
2026-09-06 15:30:44,295 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 15:30:44,307 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 15:30:44,307 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 15:30:44,308 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 15:30:44,309 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 15:30:44,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:35:05,228 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:40:05,621 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 15:40:05,623 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 15:40:05,627 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:45:06,622 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 15:45:06,623 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 15:45:06,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:50:13,396 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 15:50:13,397 WARNING core: Account 2: connect timed out after 35s
2026-09-06 15:50:13,398 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-06 15:50:13,398 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-06 15:50:13,399 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-06 15:50:13,400 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-06 15:50:13,400 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-06 15:50:21,480 INFO core: Event loop thread started, running loop forever
2026-09-06 15:50:21,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 15:50:21,785 INFO core: _init_accounts coroutine started
2026-09-06 15:50:21,786 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 15:50:21,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:55:23,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 15:55:23,803 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 16:00:29,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 16:00:29,417 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-06 16:00:45,897 INFO core: Event loop thread started, running loop forever
2026-09-06 16:00:46,198 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 16:00:46,203 INFO core: _init_accounts coroutine started
2026-09-06 16:00:46,204 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 16:00:46,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:05:45,324 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 16:05:45,324 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 16:05:45,328 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 16:05:45,339 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 16:05:45,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:10:32,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:15:05,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:15:05,219 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 16:20:12,395 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 16:20:12,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 16:20:38,108 INFO core: Event loop thread started, running loop forever
2026-09-06 16:20:38,409 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 16:20:38,412 INFO core: _init_accounts coroutine started
2026-09-06 16:20:38,414 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 16:20:38,421 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:25:15,980 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 16:25:15,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:25:15,983 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 16:30:22,444 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 16:30:25,949 INFO core: Event loop thread started, running loop forever
2026-09-06 16:30:26,251 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 16:30:26,256 INFO core: _init_accounts coroutine started
2026-09-06 16:30:26,258 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 16:30:26,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:35:32,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 16:35:53,661 INFO core: Event loop thread started, running loop forever
2026-09-06 16:35:53,963 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 16:35:53,967 INFO core: _init_accounts coroutine started
2026-09-06 16:35:53,969 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 16:35:53,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:35:53,979 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 16:35:53,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 16:40:10,574 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 16:40:10,578 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 16:40:10,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:45:29,401 INFO core: Event loop thread started, running loop forever
2026-09-06 16:45:29,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 16:45:29,708 INFO core: _init_accounts coroutine started
2026-09-06 16:45:29,708 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 16:45:29,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:50:12,339 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 16:50:12,340 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 16:50:12,342 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 16:50:12,345 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 16:50:12,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 16:55:10,034 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:00:17,484 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 17:00:17,485 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 17:00:17,485 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 17:00:33,154 INFO core: Event loop thread started, running loop forever
2026-09-06 17:00:33,455 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 17:00:33,463 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:00:33,465 INFO core: _init_accounts coroutine started
2026-09-06 17:05:07,318 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 17:05:07,326 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:10:14,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 17:10:31,033 INFO core: Event loop thread started, running loop forever
2026-09-06 17:10:31,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 17:10:31,343 INFO core: _init_accounts coroutine started
2026-09-06 17:10:31,345 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 17:10:31,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:15:26,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:20:52,985 INFO core: Event loop thread started, running loop forever
2026-09-06 17:20:53,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 17:20:53,289 INFO core: _init_accounts coroutine started
2026-09-06 17:20:53,293 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 17:20:53,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:25:50,874 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:30:51,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:35:21,251 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 17:35:21,251 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 17:35:21,252 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 17:35:21,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:35:21,255 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 17:40:46,717 INFO core: Event loop thread started, running loop forever
2026-09-06 17:40:47,019 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 17:40:47,024 INFO core: _init_accounts coroutine started
2026-09-06 17:40:47,025 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 17:40:47,043 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 17:40:47,043 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 17:40:47,044 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 17:40:47,045 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 17:40:47,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:45:27,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:50:51,275 INFO core: Event loop thread started, running loop forever
2026-09-06 17:50:51,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 17:50:51,579 INFO core: _init_accounts coroutine started
2026-09-06 17:50:51,581 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 17:50:51,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 17:55:17,918 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 17:55:17,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:00:51,216 INFO core: Event loop thread started, running loop forever
2026-09-06 18:00:51,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 18:00:51,520 INFO core: _init_accounts coroutine started
2026-09-06 18:00:51,521 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 18:00:51,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:00:51,531 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 18:05:38,900 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 18:05:38,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:10:14,738 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 18:10:14,742 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 18:10:14,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:15:49,965 INFO core: Event loop thread started, running loop forever
2026-09-06 18:15:50,266 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 18:15:50,271 INFO core: _init_accounts coroutine started
2026-09-06 18:15:50,272 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 18:15:50,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:20:29,330 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 18:20:29,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:25:21,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:30:36,273 INFO core: Event loop thread started, running loop forever
2026-09-06 18:30:36,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 18:30:36,579 INFO core: _init_accounts coroutine started
2026-09-06 18:30:36,580 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 18:30:36,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:35:14,950 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 18:35:14,951 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 18:35:14,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:35:14,952 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 18:40:20,347 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 18:40:30,924 INFO core: Event loop thread started, running loop forever
2026-09-06 18:40:31,225 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 18:40:31,228 INFO core: _init_accounts coroutine started
2026-09-06 18:40:31,230 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 18:40:31,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:45:22,513 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 18:45:22,513 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 18:45:22,515 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 18:45:22,516 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 18:45:22,528 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 18:45:22,528 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 18:45:22,533 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 18:45:22,534 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 18:45:22,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:50:23,260 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 18:50:23,261 WARNING core: Account 2: connect timed out after 35s
2026-09-06 18:50:23,262 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-06 18:50:23,262 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-06 18:50:23,264 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-06 18:50:23,265 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-06 18:50:23,266 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-06 18:50:23,269 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 18:55:30,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 18:55:50,200 INFO core: Event loop thread started, running loop forever
2026-09-06 18:55:50,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 18:55:50,504 INFO core: _init_accounts coroutine started
2026-09-06 18:55:50,505 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 18:55:50,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:00:16,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:05:23,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 19:05:23,484 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 19:05:23,485 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-06 19:05:37,270 INFO core: Event loop thread started, running loop forever
2026-09-06 19:05:37,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 19:05:37,576 INFO core: _init_accounts coroutine started
2026-09-06 19:05:37,576 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 19:05:37,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:10:28,703 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 19:10:28,704 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 19:10:28,705 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 19:10:28,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:15:11,631 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 19:15:11,647 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:20:17,480 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 19:20:46,831 INFO core: Event loop thread started, running loop forever
2026-09-06 19:20:47,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 19:20:47,136 INFO core: _init_accounts coroutine started
2026-09-06 19:20:47,138 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 19:20:47,145 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:25:49,725 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 19:25:49,725 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 19:25:49,727 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 19:25:49,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:25:49,729 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 19:30:05,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:35:06,532 INFO core: Event loop thread started, running loop forever
2026-09-06 19:35:06,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 19:35:06,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:35:12,565 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 19:40:13,339 INFO core: _init_accounts coroutine started
2026-09-06 19:40:13,339 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 19:40:33,468 INFO core: Event loop thread started, running loop forever
2026-09-06 19:40:33,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 19:40:33,772 INFO core: _init_accounts coroutine started
2026-09-06 19:40:33,774 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 19:40:33,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:45:34,699 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 19:45:34,700 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 19:45:34,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:50:24,329 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 19:50:24,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 19:55:16,929 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 19:55:16,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:00:14,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:05:17,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:10:35,537 INFO core: Event loop thread started, running loop forever
2026-09-06 20:10:35,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 20:10:35,844 INFO core: _init_accounts coroutine started
2026-09-06 20:10:35,845 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 20:10:35,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:15:33,062 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:20:33,846 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 20:20:33,848 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 20:20:33,848 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:25:40,403 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 20:25:52,642 INFO core: Event loop thread started, running loop forever
2026-09-06 20:25:52,943 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 20:25:52,948 INFO core: _init_accounts coroutine started
2026-09-06 20:25:52,950 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 20:25:52,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:30:40,879 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 20:30:40,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:35:18,450 INFO core: Event loop thread started, running loop forever
2026-09-06 20:35:18,752 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 20:35:18,757 INFO core: _init_accounts coroutine started
2026-09-06 20:35:18,758 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 20:35:18,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:40:25,373 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 20:40:40,778 INFO core: Event loop thread started, running loop forever
2026-09-06 20:40:41,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 20:40:41,083 INFO core: _init_accounts coroutine started
2026-09-06 20:40:41,085 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 20:40:41,092 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:45:07,800 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 20:45:07,800 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 20:45:07,803 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:50:14,393 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 20:50:14,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 20:50:14,395 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 20:50:14,395 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 20:50:14,395 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 20:50:14,395 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 20:50:14,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 20:50:47,738 INFO core: Event loop thread started, running loop forever
2026-09-06 20:50:48,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 20:50:48,045 INFO core: _init_accounts coroutine started
2026-09-06 20:50:48,046 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 20:50:48,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 20:55:12,205 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:00:07,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 21:00:07,408 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 21:00:07,408 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-06 21:00:07,409 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 21:00:07,409 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 21:00:07,409 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 21:00:07,409 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 21:00:07,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 21:00:07,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 21:00:39,311 INFO core: Event loop thread started, running loop forever
2026-09-06 21:00:39,612 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 21:00:39,616 INFO core: _init_accounts coroutine started
2026-09-06 21:00:39,617 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 21:00:39,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:05:05,065 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 21:05:05,066 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 21:05:05,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:10:03,991 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 21:10:03,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:15:37,008 INFO core: Event loop thread started, running loop forever
2026-09-06 21:15:37,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 21:15:37,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:20:44,389 INFO core: _init_accounts coroutine started
2026-09-06 21:20:44,390 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 21:20:44,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 21:20:44,710 INFO core: Event loop thread started, running loop forever
2026-09-06 21:20:45,013 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 21:20:45,016 INFO core: _init_accounts coroutine started
2026-09-06 21:20:45,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 21:20:45,031 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:25:53,711 INFO core: Event loop thread started, running loop forever
2026-09-06 21:25:54,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 21:25:54,018 INFO core: _init_accounts coroutine started
2026-09-06 21:25:54,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 21:25:54,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:30:47,851 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:35:19,931 INFO core: Event loop thread started, running loop forever
2026-09-06 21:35:20,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 21:35:20,238 INFO core: _init_accounts coroutine started
2026-09-06 21:35:20,241 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 21:35:20,249 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:40:19,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:45:26,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 21:45:26,404 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 21:45:51,584 INFO core: Event loop thread started, running loop forever
2026-09-06 21:45:51,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 21:45:51,889 INFO core: _init_accounts coroutine started
2026-09-06 21:45:51,890 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 21:45:51,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:50:22,684 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 21:50:22,689 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 21:55:09,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:00:07,161 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-06 22:00:07,167 INFO core: _init_accounts coroutine started
2026-09-06 22:00:07,167 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 22:00:07,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:05:05,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:10:11,486 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 22:10:11,486 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 22:10:11,486 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-06 22:10:11,487 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 22:10:11,487 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-06 22:10:11,487 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 22:10:11,487 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-06 22:10:11,487 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 22:10:11,488 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 22:10:33,021 INFO core: Event loop thread started, running loop forever
2026-09-06 22:10:33,322 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 22:10:33,328 INFO core: _init_accounts coroutine started
2026-09-06 22:10:33,328 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 22:10:33,332 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:15:39,611 INFO core: Event loop thread started, running loop forever
2026-09-06 22:15:39,912 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 22:15:39,916 INFO core: _init_accounts coroutine started
2026-09-06 22:15:39,916 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 22:15:39,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:20:46,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-06 22:20:48,231 INFO core: Event loop thread started, running loop forever
2026-09-06 22:20:48,539 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 22:20:48,583 INFO core: _init_accounts coroutine started
2026-09-06 22:20:48,583 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 22:20:48,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:25:12,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:30:18,549 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 22:30:18,550 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 22:30:47,332 INFO core: Event loop thread started, running loop forever
2026-09-06 22:30:47,635 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 22:30:47,641 INFO core: _init_accounts coroutine started
2026-09-06 22:30:47,641 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 22:30:47,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:35:11,426 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:40:18,393 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-06 22:40:48,905 INFO core: Event loop thread started, running loop forever
2026-09-06 22:40:49,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 22:40:49,208 INFO core: _init_accounts coroutine started
2026-09-06 22:40:49,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 22:40:49,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:45:43,242 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 22:45:43,242 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 22:45:43,243 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 22:45:43,244 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 22:45:43,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:50:31,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 22:55:20,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:00:22,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:05:07,070 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-06 23:05:07,071 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-06 23:05:07,076 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-06 23:05:07,077 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-06 23:05:07,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:10:14,433 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-06 23:10:14,444 WARNING core: Account 2: connect timed out after 35s
2026-09-06 23:10:14,445 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-06 23:10:14,445 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-06 23:10:14,447 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-06 23:10:27,770 INFO core: Event loop thread started, running loop forever
2026-09-06 23:10:28,071 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 23:10:28,075 INFO core: _init_accounts coroutine started
2026-09-06 23:10:28,076 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 23:10:28,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:15:05,380 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 23:15:19,927 INFO core: Event loop thread started, running loop forever
2026-09-06 23:15:20,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 23:15:20,232 INFO core: _init_accounts coroutine started
2026-09-06 23:15:20,233 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 23:15:20,240 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:20:26,444 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 23:20:40,146 INFO core: Event loop thread started, running loop forever
2026-09-06 23:20:40,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 23:20:40,453 INFO core: _init_accounts coroutine started
2026-09-06 23:20:40,453 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 23:20:40,458 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:25:11,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:30:08,300 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 23:30:08,300 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 23:30:08,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:35:14,462 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 23:35:20,944 INFO core: Event loop thread started, running loop forever
2026-09-06 23:35:21,245 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 23:35:21,250 INFO core: _init_accounts coroutine started
2026-09-06 23:35:21,251 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 23:35:21,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:40:16,740 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:45:04,990 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-06 23:45:05,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:50:37,510 INFO core: Event loop thread started, running loop forever
2026-09-06 23:50:37,812 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-06 23:50:37,817 INFO core: _init_accounts coroutine started
2026-09-06 23:50:37,817 INFO core: _init_accounts_inner: starting DB migrations
2026-09-06 23:50:37,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-06 23:55:32,960 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-06 23:55:32,961 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-06 23:55:32,962 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-06 23:55:32,965 INFO core: _init_accounts_inner: reloading LLM config
2026-09-06 23:55:32,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:00:09,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:05:16,445 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 00:05:16,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 00:05:16,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 00:05:21,222 INFO core: Event loop thread started, running loop forever
2026-09-07 00:05:21,528 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 00:05:21,532 INFO core: _init_accounts coroutine started
2026-09-07 00:05:21,533 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 00:05:21,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:10:41,072 INFO core: Event loop thread started, running loop forever
2026-09-07 00:10:41,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 00:10:41,376 INFO core: _init_accounts coroutine started
2026-09-07 00:10:41,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 00:10:41,384 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:15:40,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:20:27,520 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 00:20:27,521 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 00:20:27,525 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 00:20:27,527 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 00:20:27,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:25:34,454 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 00:25:50,515 INFO core: Event loop thread started, running loop forever
2026-09-07 00:25:50,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 00:25:50,821 INFO core: _init_accounts coroutine started
2026-09-07 00:25:50,822 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 00:25:50,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:30:24,665 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:35:30,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 00:35:42,116 INFO core: Event loop thread started, running loop forever
2026-09-07 00:35:42,417 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 00:35:42,420 INFO core: _init_accounts coroutine started
2026-09-07 00:35:42,423 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 00:35:42,429 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:40:20,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:45:27,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 00:45:43,560 INFO core: Event loop thread started, running loop forever
2026-09-07 00:45:43,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 00:45:43,867 INFO core: _init_accounts coroutine started
2026-09-07 00:45:43,868 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 00:45:43,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:50:42,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:55:42,304 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 00:55:42,305 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 00:55:42,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 00:55:42,311 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 01:00:20,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:05:13,056 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 01:05:13,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:10:20,399 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 01:10:31,710 INFO core: Event loop thread started, running loop forever
2026-09-07 01:10:32,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 01:10:32,018 INFO core: _init_accounts coroutine started
2026-09-07 01:10:32,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 01:10:32,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:15:18,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 01:15:18,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 01:15:18,418 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 01:15:18,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:15:18,421 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 01:20:15,108 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 01:20:15,109 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 01:20:15,115 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 01:20:15,116 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 01:20:15,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:25:22,386 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 01:25:22,386 WARNING core: Account 2: connect timed out after 35s
2026-09-07 01:25:22,387 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 01:25:22,387 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 01:25:22,388 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 01:25:22,388 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 01:25:22,389 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 01:25:45,261 INFO core: Event loop thread started, running loop forever
2026-09-07 01:25:45,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 01:25:45,567 INFO core: _init_accounts coroutine started
2026-09-07 01:25:45,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 01:25:45,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:30:04,356 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 01:30:32,358 INFO core: Event loop thread started, running loop forever
2026-09-07 01:30:32,659 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 01:30:32,662 INFO core: _init_accounts coroutine started
2026-09-07 01:30:32,664 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 01:30:32,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:35:17,234 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 01:35:17,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:40:17,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:45:21,750 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-07 01:45:21,750 INFO core: _init_accounts coroutine started
2026-09-07 01:45:21,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 01:45:21,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:50:12,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 01:55:11,800 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:00:18,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 02:00:18,404 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 02:00:18,405 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-07 02:00:18,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 02:00:18,405 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 02:00:18,406 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 02:00:18,406 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 02:00:18,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 02:00:18,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 02:00:27,951 INFO core: Event loop thread started, running loop forever
2026-09-07 02:00:28,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 02:00:28,256 INFO core: _init_accounts coroutine started
2026-09-07 02:00:28,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 02:00:28,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:00:28,266 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 02:00:28,266 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 02:05:20,012 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 02:05:20,016 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 02:05:20,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:10:09,495 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:15:43,475 INFO core: Event loop thread started, running loop forever
2026-09-07 02:15:43,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 02:15:43,785 INFO core: _init_accounts coroutine started
2026-09-07 02:15:43,785 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 02:15:43,786 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:20:14,229 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 02:20:14,229 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 02:20:14,230 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 02:20:14,231 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 02:20:14,242 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 02:20:14,242 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 02:20:14,246 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 02:20:14,247 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 02:20:14,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:25:21,431 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 02:25:21,432 WARNING core: Account 2: connect timed out after 35s
2026-09-07 02:25:22,213 INFO core: Event loop thread started, running loop forever
2026-09-07 02:25:22,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 02:25:22,518 INFO core: _init_accounts coroutine started
2026-09-07 02:25:22,520 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 02:25:22,527 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:30:29,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 02:30:29,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 02:30:29,418 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-07 02:30:29,420 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 02:30:29,420 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 02:30:29,420 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 02:30:29,420 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 02:30:29,420 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 02:30:29,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 02:30:31,143 INFO core: Event loop thread started, running loop forever
2026-09-07 02:30:31,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 02:30:31,449 INFO core: _init_accounts coroutine started
2026-09-07 02:30:31,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 02:30:31,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:35:16,145 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:40:23,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 02:40:53,412 INFO core: Event loop thread started, running loop forever
2026-09-07 02:40:53,713 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 02:40:53,718 INFO core: _init_accounts coroutine started
2026-09-07 02:40:53,718 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 02:40:53,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:45:05,754 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 02:45:05,755 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 02:45:05,773 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 02:45:05,775 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 02:45:05,788 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 02:45:05,789 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 02:45:05,794 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 02:45:05,794 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 02:45:05,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:50:11,393 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 02:50:11,394 WARNING core: Account 2: connect timed out after 35s
2026-09-07 02:50:11,394 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 02:50:11,395 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 02:50:11,395 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 02:50:11,397 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 02:50:11,397 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 02:50:13,481 INFO core: Event loop thread started, running loop forever
2026-09-07 02:50:13,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 02:50:13,787 INFO core: _init_accounts coroutine started
2026-09-07 02:50:13,788 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 02:50:13,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 02:55:20,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 02:55:46,063 INFO core: Event loop thread started, running loop forever
2026-09-07 02:55:46,364 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 02:55:46,370 INFO core: _init_accounts coroutine started
2026-09-07 02:55:46,370 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 02:55:46,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 02:55:46,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 02:55:46,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 02:55:46,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:00:49,612 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 03:00:49,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:05:24,914 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:10:30,378 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 03:10:30,385 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 03:10:37,665 INFO core: Event loop thread started, running loop forever
2026-09-07 03:10:37,966 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 03:10:37,970 INFO core: _init_accounts coroutine started
2026-09-07 03:10:37,972 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 03:10:37,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:15:27,523 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 03:15:27,525 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 03:15:27,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:20:08,851 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 03:20:08,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:25:14,421 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 03:25:14,423 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 03:25:14,423 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 03:25:14,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 03:25:26,781 INFO core: Event loop thread started, running loop forever
2026-09-07 03:25:27,082 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 03:25:27,087 INFO core: _init_accounts coroutine started
2026-09-07 03:25:27,090 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 03:25:27,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:30:33,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 03:30:44,852 INFO core: Event loop thread started, running loop forever
2026-09-07 03:30:45,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 03:30:45,158 INFO core: _init_accounts coroutine started
2026-09-07 03:30:45,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 03:30:45,168 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:35:46,235 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 03:35:46,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:40:35,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:45:32,899 INFO core: Event loop thread started, running loop forever
2026-09-07 03:45:33,201 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 03:45:33,205 INFO core: _init_accounts coroutine started
2026-09-07 03:45:33,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 03:45:33,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:50:26,203 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 03:50:26,204 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 03:50:26,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 03:50:26,208 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 03:55:33,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 03:55:33,796 INFO core: Event loop thread started, running loop forever
2026-09-07 03:55:34,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 03:55:34,100 INFO core: _init_accounts coroutine started
2026-09-07 03:55:34,101 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 03:55:34,109 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:00:43,712 INFO core: Event loop thread started, running loop forever
2026-09-07 04:00:44,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 04:00:44,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:05:50,405 INFO core: _init_accounts coroutine started
2026-09-07 04:05:50,406 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 04:05:50,406 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-07 04:05:52,830 INFO core: Event loop thread started, running loop forever
2026-09-07 04:05:53,131 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 04:05:53,134 INFO core: _init_accounts coroutine started
2026-09-07 04:05:53,135 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 04:05:53,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:10:32,848 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 04:10:32,848 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 04:10:32,851 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:10:32,851 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 04:15:52,145 INFO core: Event loop thread started, running loop forever
2026-09-07 04:15:52,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 04:15:52,453 INFO core: _init_accounts coroutine started
2026-09-07 04:15:52,454 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 04:15:52,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:20:51,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:25:33,525 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 04:25:33,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:25:33,526 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 04:30:40,365 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 04:30:40,365 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 04:30:40,366 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 04:30:40,366 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 04:30:40,366 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 04:30:40,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 04:30:43,336 INFO core: Event loop thread started, running loop forever
2026-09-07 04:30:43,637 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 04:30:43,644 INFO core: _init_accounts coroutine started
2026-09-07 04:30:43,644 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 04:30:43,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:35:31,672 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 04:35:31,678 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:35:31,687 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 04:40:37,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 04:40:39,420 INFO core: Event loop thread started, running loop forever
2026-09-07 04:40:39,722 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 04:40:39,730 INFO core: _init_accounts coroutine started
2026-09-07 04:40:39,730 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 04:40:39,743 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:45:38,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:45:38,599 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 04:45:38,599 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 04:45:38,601 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 04:50:45,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 04:50:45,446 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 04:50:45,447 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 04:50:49,463 INFO core: Event loop thread started, running loop forever
2026-09-07 04:50:49,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 04:50:49,779 INFO core: _init_accounts coroutine started
2026-09-07 04:50:49,779 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 04:50:49,801 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 04:55:19,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:00:15,391 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 05:00:15,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:05:09,798 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:10:40,862 INFO core: Event loop thread started, running loop forever
2026-09-07 05:10:41,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 05:10:41,181 INFO core: _init_accounts coroutine started
2026-09-07 05:10:41,181 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 05:10:41,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:15:45,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:20:22,577 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 05:20:22,578 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 05:20:22,585 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 05:20:22,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:20:22,587 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 05:25:09,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:30:47,608 INFO core: Event loop thread started, running loop forever
2026-09-07 05:30:47,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 05:30:47,912 INFO core: _init_accounts coroutine started
2026-09-07 05:30:47,914 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 05:30:47,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:35:04,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:35:04,343 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 05:40:10,426 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 05:40:10,428 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-07 05:40:21,934 INFO core: Event loop thread started, running loop forever
2026-09-07 05:40:22,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 05:40:22,239 INFO core: _init_accounts coroutine started
2026-09-07 05:40:22,241 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 05:40:22,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:45:18,748 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 05:45:18,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:50:27,317 INFO core: Event loop thread started, running loop forever
2026-09-07 05:50:27,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 05:50:27,624 INFO core: _init_accounts coroutine started
2026-09-07 05:50:27,625 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 05:50:27,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 05:55:34,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 05:55:50,908 INFO core: Event loop thread started, running loop forever
2026-09-07 05:55:51,209 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 05:55:51,214 INFO core: _init_accounts coroutine started
2026-09-07 05:55:51,214 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 05:55:51,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:00:45,823 INFO core: Event loop thread started, running loop forever
2026-09-07 06:00:46,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 06:00:46,129 INFO core: _init_accounts coroutine started
2026-09-07 06:00:46,130 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 06:00:46,135 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:05:41,848 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 06:05:41,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:10:17,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:15:27,372 INFO core: Event loop thread started, running loop forever
2026-09-07 06:15:27,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 06:15:27,679 INFO core: _init_accounts coroutine started
2026-09-07 06:15:27,680 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 06:15:27,691 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 06:15:27,692 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 06:15:27,693 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 06:15:27,695 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 06:15:27,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:16:04,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:16:04,606 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 06:16:04,606 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 06:16:04,628 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 06:16:04,632 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 06:20:53,568 WARNING core: Account 2: connect timed out after 35s
2026-09-07 06:20:53,570 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 06:20:53,570 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 06:20:53,570 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 06:20:53,571 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 06:20:53,572 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 06:20:53,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:25:36,485 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 06:25:36,486 WARNING core: Account 2: connect timed out after 35s
2026-09-07 06:25:36,486 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-07 06:25:36,486 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-07 06:25:36,487 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 06:25:36,490 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-07 06:25:36,490 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-07 06:25:36,496 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:30:22,039 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 06:30:22,039 WARNING core: Account 2: connect timed out after 35s
2026-09-07 06:30:22,040 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-07 06:30:22,040 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-07 06:30:22,040 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 06:30:22,041 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-07 06:30:22,041 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-07 06:30:22,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:35:28,472 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 06:35:42,213 INFO core: Event loop thread started, running loop forever
2026-09-07 06:35:42,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 06:35:42,523 INFO core: _init_accounts coroutine started
2026-09-07 06:35:42,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:35:42,524 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 06:40:14,799 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 06:40:14,799 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 06:40:14,803 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 06:40:14,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:40:14,805 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 06:45:14,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:50:21,466 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 06:50:21,469 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 06:50:21,470 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 06:50:26,975 INFO core: Event loop thread started, running loop forever
2026-09-07 06:50:27,276 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 06:50:27,279 INFO core: _init_accounts coroutine started
2026-09-07 06:50:27,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 06:50:27,292 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 06:50:27,292 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 06:50:27,293 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 06:50:27,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 06:55:09,935 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 06:55:09,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:00:27,243 INFO core: Event loop thread started, running loop forever
2026-09-07 07:00:27,546 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 07:00:27,549 INFO core: _init_accounts coroutine started
2026-09-07 07:00:27,549 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 07:00:27,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:05:23,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:10:21,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:15:28,432 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 07:15:28,433 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 07:15:28,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 07:15:28,437 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 07:15:28,438 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 07:15:28,438 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 07:15:28,438 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 07:15:28,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 07:15:33,792 INFO core: Event loop thread started, running loop forever
2026-09-07 07:15:34,094 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 07:15:34,100 INFO core: _init_accounts coroutine started
2026-09-07 07:15:34,100 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 07:15:34,108 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:20:40,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 07:20:40,786 INFO core: Event loop thread started, running loop forever
2026-09-07 07:20:41,087 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 07:20:41,090 INFO core: _init_accounts coroutine started
2026-09-07 07:20:41,091 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 07:20:41,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:25:45,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:30:26,195 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 07:30:26,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:35:38,051 INFO core: Event loop thread started, running loop forever
2026-09-07 07:35:38,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 07:35:38,363 INFO core: _init_accounts coroutine started
2026-09-07 07:35:38,363 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 07:35:38,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:40:45,442 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 07:40:45,680 INFO core: Event loop thread started, running loop forever
2026-09-07 07:40:45,983 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 07:40:45,987 INFO core: _init_accounts coroutine started
2026-09-07 07:40:45,988 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 07:40:45,993 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:45:38,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:50:04,884 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 07:50:04,885 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 07:50:04,891 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 07:50:04,894 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 07:50:04,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 07:55:10,453 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 07:55:45,392 INFO core: Event loop thread started, running loop forever
2026-09-07 07:55:45,692 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 07:55:45,699 INFO core: _init_accounts coroutine started
2026-09-07 07:55:45,703 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 07:55:45,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:00:05,813 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:05:11,399 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 08:05:25,403 INFO core: Event loop thread started, running loop forever
2026-09-07 08:05:25,704 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 08:05:25,714 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:10:24,821 INFO core: _init_accounts coroutine started
2026-09-07 08:10:24,824 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 08:10:24,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:15:03,383 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 08:15:27,728 INFO core: Event loop thread started, running loop forever
2026-09-07 08:15:28,029 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 08:15:28,035 INFO core: _init_accounts coroutine started
2026-09-07 08:15:28,036 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 08:15:28,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:20:25,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:25:44,231 INFO core: Event loop thread started, running loop forever
2026-09-07 08:25:44,532 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 08:25:44,538 INFO core: _init_accounts coroutine started
2026-09-07 08:25:44,539 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 08:25:44,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:30:18,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:35:25,447 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 08:35:25,447 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 08:35:25,447 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-07 08:35:25,448 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 08:35:25,448 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 08:35:25,448 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 08:35:25,448 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 08:35:25,449 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 08:35:25,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 08:35:28,235 INFO core: Event loop thread started, running loop forever
2026-09-07 08:35:28,536 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 08:35:28,542 INFO core: _init_accounts coroutine started
2026-09-07 08:35:28,542 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 08:35:28,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:40:35,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 08:40:43,620 INFO core: Event loop thread started, running loop forever
2026-09-07 08:40:43,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 08:40:43,924 INFO core: _init_accounts coroutine started
2026-09-07 08:40:43,926 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 08:40:43,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:45:52,215 INFO core: Event loop thread started, running loop forever
2026-09-07 08:45:52,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 08:45:52,521 INFO core: _init_accounts coroutine started
2026-09-07 08:45:52,523 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 08:45:52,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:50:28,446 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:55:30,380 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 08:55:30,380 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 08:55:30,383 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 08:55:30,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 08:55:30,386 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 09:00:51,450 INFO core: Event loop thread started, running loop forever
2026-09-07 09:00:51,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 09:00:51,757 INFO core: _init_accounts coroutine started
2026-09-07 09:00:51,757 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 09:00:51,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:05:36,885 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:05:36,886 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 09:10:11,482 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 09:10:11,485 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 09:10:11,487 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 09:10:11,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:15:26,397 INFO core: Event loop thread started, running loop forever
2026-09-07 09:15:26,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 09:15:26,702 INFO core: _init_accounts coroutine started
2026-09-07 09:15:26,704 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 09:15:26,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:20:43,635 INFO core: Event loop thread started, running loop forever
2026-09-07 09:20:43,936 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 09:20:43,944 INFO core: _init_accounts coroutine started
2026-09-07 09:20:43,945 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 09:20:43,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:25:40,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:30:35,345 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 09:30:35,346 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 09:30:35,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:35:39,933 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 09:35:39,938 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 09:35:39,939 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:40:04,228 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:45:03,908 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 09:45:03,912 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 09:45:03,919 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 09:45:03,921 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 09:45:03,924 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:50:09,410 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 09:50:09,411 WARNING core: Account 2: connect timed out after 35s
2026-09-07 09:50:09,411 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 09:50:09,411 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 09:50:09,413 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 09:50:44,347 INFO core: Event loop thread started, running loop forever
2026-09-07 09:50:44,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 09:50:44,660 INFO core: _init_accounts coroutine started
2026-09-07 09:50:44,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 09:50:44,674 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 09:55:25,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:00:32,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 10:00:59,311 INFO core: Event loop thread started, running loop forever
2026-09-07 10:00:59,612 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 10:00:59,622 INFO core: _init_accounts coroutine started
2026-09-07 10:00:59,622 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 10:00:59,635 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 10:00:59,635 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 10:00:59,636 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 10:00:59,637 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 10:00:59,649 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 10:00:59,649 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 10:00:59,650 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:05:30,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:05:30,971 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 10:10:36,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 10:10:47,033 INFO core: Event loop thread started, running loop forever
2026-09-07 10:10:47,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 10:10:47,342 INFO core: _init_accounts coroutine started
2026-09-07 10:10:47,343 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 10:10:47,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:15:53,194 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 10:15:53,194 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 10:15:53,209 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 10:15:53,210 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 10:15:53,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:20:49,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:25:29,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:30:03,357 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 10:30:03,365 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 10:30:26,890 INFO core: Event loop thread started, running loop forever
2026-09-07 10:30:27,191 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 10:30:27,194 INFO core: _init_accounts coroutine started
2026-09-07 10:30:27,195 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 10:30:27,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:35:03,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:40:09,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 10:40:09,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 10:40:09,382 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-07 10:40:09,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 10:40:09,383 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 10:40:09,383 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 10:40:09,383 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 10:40:09,383 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 10:40:09,384 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 10:40:53,000 INFO core: Event loop thread started, running loop forever
2026-09-07 10:40:53,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 10:40:53,307 INFO core: _init_accounts coroutine started
2026-09-07 10:40:53,308 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 10:40:53,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:45:09,920 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:45:09,921 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 10:45:09,921 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 10:50:05,115 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 10:50:05,126 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 10:50:05,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 10:55:11,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 10:55:11,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 10:55:11,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 10:55:27,065 INFO core: Event loop thread started, running loop forever
2026-09-07 10:55:27,368 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 10:55:27,370 INFO core: _init_accounts coroutine started
2026-09-07 10:55:27,373 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 10:55:27,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:00:28,497 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 11:00:28,498 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 11:00:28,503 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 11:00:28,506 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:05:19,718 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 11:05:19,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:10:25,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 11:10:34,696 INFO core: Event loop thread started, running loop forever
2026-09-07 11:10:34,998 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 11:10:35,002 INFO core: _init_accounts coroutine started
2026-09-07 11:10:35,004 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 11:10:35,017 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:11:24,152 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 11:11:24,152 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 11:11:24,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:11:24,155 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 11:11:24,172 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 11:15:34,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:20:27,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:25:22,647 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:30:46,451 INFO core: Event loop thread started, running loop forever
2026-09-07 11:30:46,752 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 11:30:46,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:35:26,341 INFO core: _init_accounts coroutine started
2026-09-07 11:35:26,342 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 11:35:26,366 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:40:35,868 INFO core: Event loop thread started, running loop forever
2026-09-07 11:40:36,169 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 11:40:36,174 INFO core: _init_accounts coroutine started
2026-09-07 11:40:36,175 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 11:40:36,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:45:25,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:50:32,518 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 11:50:32,518 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 11:50:32,518 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-07 11:50:32,519 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 11:50:32,519 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 11:50:32,520 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 11:50:32,520 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 11:50:32,520 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 11:50:32,520 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 11:50:41,518 INFO core: Event loop thread started, running loop forever
2026-09-07 11:50:41,820 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 11:50:41,825 INFO core: _init_accounts coroutine started
2026-09-07 11:50:41,827 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 11:50:41,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 11:55:52,686 INFO core: Event loop thread started, running loop forever
2026-09-07 11:55:52,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 11:55:52,992 INFO core: _init_accounts coroutine started
2026-09-07 11:55:52,993 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 11:55:53,002 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:00:19,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 12:00:19,474 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 12:00:19,477 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 12:00:19,478 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 12:00:19,489 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 12:00:19,489 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 12:00:19,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:05:26,426 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 12:05:48,800 INFO core: Event loop thread started, running loop forever
2026-09-07 12:05:49,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 12:05:49,107 INFO core: _init_accounts coroutine started
2026-09-07 12:05:49,109 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 12:05:49,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:10:19,220 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 12:10:19,220 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 12:10:19,226 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 12:10:19,228 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 12:10:19,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:15:04,211 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 12:15:04,212 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 12:15:04,213 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:20:41,469 INFO core: Event loop thread started, running loop forever
2026-09-07 12:20:41,771 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 12:20:41,777 INFO core: _init_accounts coroutine started
2026-09-07 12:20:41,777 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 12:20:41,785 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:25:43,543 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 12:25:43,545 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 12:25:43,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:30:48,826 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 12:30:48,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:35:55,341 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 12:35:55,344 INFO core: Event loop thread started, running loop forever
2026-09-07 12:35:55,345 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-07 12:35:55,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 12:35:55,651 INFO core: _init_accounts coroutine started
2026-09-07 12:35:55,651 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 12:35:55,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:40:25,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:45:03,350 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 12:45:03,350 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 12:45:42,554 INFO core: Event loop thread started, running loop forever
2026-09-07 12:45:42,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 12:45:42,857 INFO core: _init_accounts coroutine started
2026-09-07 12:45:42,858 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 12:45:42,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:50:10,799 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 12:50:10,801 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 12:50:10,804 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 12:50:10,806 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 12:50:10,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 12:55:27,406 INFO core: Event loop thread started, running loop forever
2026-09-07 12:55:27,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 12:55:27,710 INFO core: _init_accounts coroutine started
2026-09-07 12:55:27,711 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 12:55:27,718 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:00:36,083 INFO core: Event loop thread started, running loop forever
2026-09-07 13:00:36,384 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 13:00:36,388 INFO core: _init_accounts coroutine started
2026-09-07 13:00:36,389 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 13:00:36,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:05:12,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:10:42,134 INFO core: Event loop thread started, running loop forever
2026-09-07 13:10:42,434 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 13:10:42,437 INFO core: _init_accounts coroutine started
2026-09-07 13:10:42,438 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 13:10:42,451 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:15:33,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:20:25,309 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 13:20:25,310 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 13:20:25,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:25:16,181 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 13:25:16,185 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:25:16,185 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 13:30:42,876 INFO core: Event loop thread started, running loop forever
2026-09-07 13:30:43,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 13:30:43,181 INFO core: _init_accounts coroutine started
2026-09-07 13:30:43,182 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 13:30:43,191 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 13:30:43,191 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 13:30:43,192 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:35:48,203 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 13:35:48,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:35:48,207 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 13:40:07,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:45:44,353 INFO core: Event loop thread started, running loop forever
2026-09-07 13:45:44,654 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 13:45:44,657 INFO core: _init_accounts coroutine started
2026-09-07 13:45:44,660 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 13:45:44,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:50:37,089 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 13:50:37,089 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 13:50:37,092 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 13:50:37,094 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 13:50:37,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 13:55:04,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:00:08,233 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 14:00:08,233 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 14:00:08,240 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 14:00:08,241 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 14:00:08,249 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:05:15,407 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 14:05:15,407 WARNING core: Account 2: connect timed out after 35s
2026-09-07 14:05:15,408 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 14:05:15,408 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 14:05:15,409 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 14:05:15,410 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 14:05:15,411 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 14:05:36,530 INFO core: Event loop thread started, running loop forever
2026-09-07 14:05:36,831 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 14:05:36,843 INFO core: _init_accounts coroutine started
2026-09-07 14:05:36,844 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 14:05:36,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:10:08,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:15:16,156 INFO core: Event loop thread started, running loop forever
2026-09-07 14:15:16,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 14:15:16,461 INFO core: _init_accounts coroutine started
2026-09-07 14:15:16,462 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 14:15:16,469 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:20:15,760 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:25:07,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:30:50,051 INFO core: Event loop thread started, running loop forever
2026-09-07 14:30:50,352 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 14:30:50,359 INFO core: _init_accounts coroutine started
2026-09-07 14:30:50,359 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 14:30:50,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:35:37,849 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 14:35:37,850 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 14:35:37,851 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 14:35:37,852 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 14:35:37,861 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 14:35:37,862 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 14:35:37,866 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 14:35:37,867 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 14:35:37,870 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:40:11,519 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 14:40:11,520 WARNING core: Account 2: connect timed out after 35s
2026-09-07 14:40:11,521 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 14:40:11,521 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 14:40:11,523 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 14:40:11,525 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 14:40:11,526 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 14:40:11,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:45:18,380 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 14:45:18,381 WARNING core: Account 2: connect timed out after 35s
2026-09-07 14:45:18,382 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-07 14:45:18,382 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-07 14:45:18,382 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 14:45:18,383 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-07 14:45:18,384 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-07 14:45:38,056 INFO core: Event loop thread started, running loop forever
2026-09-07 14:45:38,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 14:45:38,362 INFO core: _init_accounts coroutine started
2026-09-07 14:45:38,363 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 14:45:38,372 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:50:17,716 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 14:55:34,137 INFO core: Event loop thread started, running loop forever
2026-09-07 14:55:34,437 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 14:55:34,442 INFO core: _init_accounts coroutine started
2026-09-07 14:55:34,442 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 14:55:34,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:00:04,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 15:00:14,948 INFO core: Event loop thread started, running loop forever
2026-09-07 15:00:15,249 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 15:00:15,253 INFO core: _init_accounts coroutine started
2026-09-07 15:00:15,254 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 15:00:15,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:05:21,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 15:05:41,178 INFO core: Event loop thread started, running loop forever
2026-09-07 15:05:41,479 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 15:05:41,484 INFO core: _init_accounts coroutine started
2026-09-07 15:05:41,485 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 15:05:41,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 15:05:41,493 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 15:05:41,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:05:41,494 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 15:10:04,157 INFO core: Event loop thread started, running loop forever
2026-09-07 15:10:04,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 15:10:04,471 INFO core: _init_accounts coroutine started
2026-09-07 15:10:04,473 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 15:10:04,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:10:04,484 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-07 15:10:48,218 INFO core: _init_accounts_inner: reloading LLM config
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-07 15:15:04,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:20:36,240 INFO core: Event loop thread started, running loop forever
2026-09-07 15:20:36,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 15:20:36,547 INFO core: _init_accounts coroutine started
2026-09-07 15:20:36,547 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 15:20:36,553 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:25:09,580 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 15:25:09,580 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 15:25:09,581 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 15:25:09,582 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 15:25:09,593 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 15:25:09,593 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 15:25:09,598 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 15:25:09,599 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 15:25:09,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:30:15,431 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 15:30:15,432 WARNING core: Account 2: connect timed out after 35s
2026-09-07 15:30:15,433 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 15:30:15,433 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 15:30:15,435 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 15:30:15,437 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 15:30:15,437 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 15:30:30,036 INFO core: Event loop thread started, running loop forever
2026-09-07 15:30:30,337 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 15:30:30,343 INFO core: _init_accounts coroutine started
2026-09-07 15:30:30,343 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 15:30:30,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:35:31,820 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 15:35:31,820 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 15:35:31,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:40:35,187 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 15:40:35,204 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 15:40:35,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:45:42,404 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 15:45:45,690 INFO core: Event loop thread started, running loop forever
2026-09-07 15:45:45,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 15:45:45,995 INFO core: _init_accounts coroutine started
2026-09-07 15:45:45,997 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 15:45:46,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:50:52,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 15:50:52,417 INFO core: Event loop thread started, running loop forever
2026-09-07 15:50:52,718 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 15:50:52,724 INFO core: _init_accounts coroutine started
2026-09-07 15:50:52,724 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 15:50:52,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 15:55:22,381 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 15:55:22,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:00:45,981 INFO core: Event loop thread started, running loop forever
2026-09-07 16:00:46,283 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 16:00:46,287 INFO core: _init_accounts coroutine started
2026-09-07 16:00:46,290 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 16:00:46,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:05:57,409 INFO core: Event loop thread started, running loop forever
2026-09-07 16:05:57,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 16:05:57,713 INFO core: _init_accounts coroutine started
2026-09-07 16:05:57,714 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 16:05:57,728 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 16:05:57,728 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 16:05:57,729 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 16:05:57,731 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 16:05:57,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:10:49,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:15:15,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:15:15,347 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 16:15:15,350 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 16:15:15,355 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 16:15:15,356 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 16:20:22,429 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 16:20:42,691 INFO core: Event loop thread started, running loop forever
2026-09-07 16:20:42,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 16:20:42,999 INFO core: _init_accounts coroutine started
2026-09-07 16:20:43,000 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 16:20:43,002 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:25:18,690 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 16:25:18,690 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 16:25:18,692 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 16:25:18,693 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 16:25:18,698 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:30:23,749 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:35:21,243 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 16:35:21,244 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 16:35:21,251 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 16:35:21,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:35:21,255 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 16:40:24,709 WARNING core: Account 2: connect timed out after 35s
2026-09-07 16:40:24,710 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 16:40:24,710 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 16:40:24,711 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 16:40:24,712 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 16:40:24,712 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 16:40:24,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:45:08,514 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 16:45:08,515 WARNING core: Account 2: connect timed out after 35s
2026-09-07 16:45:08,516 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-07 16:45:08,516 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-07 16:45:08,517 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 16:45:08,518 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-07 16:45:08,518 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-07 16:45:08,521 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:50:15,381 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 16:50:15,382 WARNING core: Account 2: connect timed out after 35s
2026-09-07 16:50:15,382 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-07 16:50:15,383 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-07 16:50:15,383 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 16:50:15,385 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-07 16:50:15,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-07 16:50:22,381 INFO core: Event loop thread started, running loop forever
2026-09-07 16:50:22,682 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 16:50:22,687 INFO core: _init_accounts coroutine started
2026-09-07 16:50:22,688 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 16:50:22,693 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 16:55:05,690 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 16:55:05,690 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 16:55:05,691 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 16:55:05,692 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 16:55:05,705 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:00:06,049 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 17:00:06,049 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 17:00:06,057 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 17:00:06,058 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 17:00:06,087 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:05:13,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 17:05:20,339 INFO core: Event loop thread started, running loop forever
2026-09-07 17:05:20,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 17:05:20,648 INFO core: _init_accounts coroutine started
2026-09-07 17:05:20,648 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 17:05:20,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:10:27,392 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-07 17:10:32,491 INFO core: Event loop thread started, running loop forever
2026-09-07 17:10:32,794 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 17:10:32,797 INFO core: _init_accounts coroutine started
2026-09-07 17:10:32,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 17:10:32,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:15:42,564 INFO core: Event loop thread started, running loop forever
2026-09-07 17:15:42,865 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 17:15:42,871 INFO core: _init_accounts coroutine started
2026-09-07 17:15:42,872 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 17:15:42,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:20:10,655 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 17:20:10,655 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 17:20:10,671 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 17:20:10,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:25:34,520 INFO core: Event loop thread started, running loop forever
2026-09-07 17:25:34,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 17:25:34,827 INFO core: _init_accounts coroutine started
2026-09-07 17:25:34,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:25:34,833 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 17:30:41,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 17:30:41,408 INFO core: Event loop thread started, running loop forever
2026-09-07 17:30:41,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 17:30:41,712 INFO core: _init_accounts coroutine started
2026-09-07 17:30:41,714 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 17:30:41,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:35:38,269 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 17:35:38,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:40:20,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:45:44,172 INFO core: Event loop thread started, running loop forever
2026-09-07 17:45:44,475 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 17:45:44,480 INFO core: _init_accounts coroutine started
2026-09-07 17:45:44,482 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 17:45:44,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:50:18,190 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 17:55:10,758 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 17:55:10,758 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 17:55:10,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:00:16,990 INFO core: Event loop thread started, running loop forever
2026-09-07 18:00:17,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 18:00:17,297 INFO core: _init_accounts coroutine started
2026-09-07 18:00:17,297 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 18:00:17,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:05:23,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 18:05:32,145 INFO core: Event loop thread started, running loop forever
2026-09-07 18:05:32,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 18:05:32,455 INFO core: _init_accounts coroutine started
2026-09-07 18:05:32,456 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 18:05:32,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:10:39,125 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 18:10:39,134 INFO core: Event loop thread started, running loop forever
2026-09-07 18:10:39,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 18:10:39,440 INFO core: _init_accounts coroutine started
2026-09-07 18:10:39,441 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 18:10:39,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:15:33,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:20:29,323 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 18:20:29,324 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 18:20:29,326 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:25:41,134 INFO core: Event loop thread started, running loop forever
2026-09-07 18:25:41,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 18:25:41,439 INFO core: _init_accounts coroutine started
2026-09-07 18:25:41,439 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 18:25:41,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:25:41,451 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 18:25:41,451 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 18:30:37,214 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 18:30:37,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:35:05,753 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 18:35:05,754 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 18:35:05,771 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:40:12,386 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 18:40:28,075 INFO core: Event loop thread started, running loop forever
2026-09-07 18:40:28,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 18:40:28,383 INFO core: _init_accounts coroutine started
2026-09-07 18:40:28,383 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 18:40:28,389 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:45:14,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:50:48,952 INFO core: Event loop thread started, running loop forever
2026-09-07 18:50:49,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 18:50:49,256 INFO core: _init_accounts coroutine started
2026-09-07 18:50:49,257 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 18:50:49,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 18:55:48,986 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 18:55:48,987 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 18:55:48,990 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 18:55:48,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:00:29,321 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 19:00:29,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:05:17,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:10:36,345 INFO core: Event loop thread started, running loop forever
2026-09-07 19:10:36,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 19:10:36,650 INFO core: _init_accounts coroutine started
2026-09-07 19:10:36,652 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 19:10:36,657 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:15:36,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:20:13,338 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 19:20:13,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:20:13,341 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 19:20:13,347 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 19:20:13,348 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 19:25:10,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:30:44,193 INFO core: Event loop thread started, running loop forever
2026-09-07 19:30:44,495 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 19:30:44,499 INFO core: _init_accounts coroutine started
2026-09-07 19:30:44,500 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 19:30:44,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:30:44,510 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 19:30:44,510 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 19:30:44,511 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 19:30:44,513 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 19:35:22,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 19:35:22,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:35:22,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 19:40:28,474 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 19:40:38,062 INFO core: Event loop thread started, running loop forever
2026-09-07 19:40:38,367 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 19:40:38,372 INFO core: _init_accounts coroutine started
2026-09-07 19:40:38,373 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 19:40:38,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:45:49,047 INFO core: Event loop thread started, running loop forever
2026-09-07 19:45:49,349 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 19:45:49,352 INFO core: _init_accounts coroutine started
2026-09-07 19:45:49,354 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 19:45:49,359 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:50:49,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 19:55:27,618 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 19:55:27,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:00:52,439 INFO core: Event loop thread started, running loop forever
2026-09-07 20:00:52,740 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 20:00:52,744 INFO core: _init_accounts coroutine started
2026-09-07 20:00:52,745 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 20:00:52,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:05:25,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:10:03,638 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 20:10:03,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:15:20,737 INFO core: Event loop thread started, running loop forever
2026-09-07 20:15:21,038 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 20:15:21,044 INFO core: _init_accounts coroutine started
2026-09-07 20:15:21,047 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 20:15:21,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:20:05,655 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 20:20:05,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:25:30,684 INFO core: Event loop thread started, running loop forever
2026-09-07 20:25:30,986 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 20:25:30,991 INFO core: _init_accounts coroutine started
2026-09-07 20:25:30,992 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 20:25:30,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:30:37,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 20:30:46,334 INFO core: Event loop thread started, running loop forever
2026-09-07 20:30:46,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 20:30:46,642 INFO core: _init_accounts coroutine started
2026-09-07 20:30:46,642 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 20:30:46,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:35:21,416 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:40:48,621 INFO core: Event loop thread started, running loop forever
2026-09-07 20:40:48,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 20:40:48,925 INFO core: _init_accounts coroutine started
2026-09-07 20:40:48,925 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 20:40:48,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:45:07,946 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:50:41,893 INFO core: Event loop thread started, running loop forever
2026-09-07 20:50:42,198 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 20:50:42,203 INFO core: _init_accounts coroutine started
2026-09-07 20:50:42,204 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 20:50:42,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 20:55:23,499 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 20:55:23,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:00:06,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:05:51,849 INFO core: Event loop thread started, running loop forever
2026-09-07 21:05:52,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 21:05:52,155 INFO core: _init_accounts coroutine started
2026-09-07 21:05:52,155 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 21:05:52,161 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:10:22,442 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 21:10:22,458 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:15:04,436 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:20:20,868 INFO core: Event loop thread started, running loop forever
2026-09-07 21:20:21,169 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 21:20:21,173 INFO core: _init_accounts coroutine started
2026-09-07 21:20:21,174 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 21:20:21,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:25:23,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:30:05,407 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 21:30:05,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:35:22,499 INFO core: Event loop thread started, running loop forever
2026-09-07 21:35:22,801 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 21:35:22,808 INFO core: _init_accounts coroutine started
2026-09-07 21:35:22,809 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 21:35:22,827 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 21:35:22,827 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 21:35:22,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:40:09,918 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 21:40:09,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:45:37,157 INFO core: Event loop thread started, running loop forever
2026-09-07 21:45:37,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 21:45:37,465 INFO core: _init_accounts coroutine started
2026-09-07 21:45:37,465 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 21:45:37,472 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:50:13,536 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 21:50:13,537 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 21:50:13,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 21:50:13,539 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 21:55:40,749 INFO core: Event loop thread started, running loop forever
2026-09-07 21:55:41,050 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 21:55:41,060 INFO core: _init_accounts coroutine started
2026-09-07 21:55:41,060 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 21:55:41,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:00:42,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:05:39,873 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 22:05:39,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:10:07,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:15:34,719 INFO core: Event loop thread started, running loop forever
2026-09-07 22:15:35,021 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 22:15:35,025 INFO core: _init_accounts coroutine started
2026-09-07 22:15:35,026 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 22:15:35,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:20:32,212 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 22:20:32,212 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 22:20:32,214 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 22:20:32,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:25:30,005 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 22:25:30,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:30:04,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:35:26,868 INFO core: Event loop thread started, running loop forever
2026-09-07 22:35:27,169 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 22:35:27,173 INFO core: _init_accounts coroutine started
2026-09-07 22:35:27,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 22:35:27,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:40:18,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:45:25,395 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-07 22:45:29,486 INFO core: Event loop thread started, running loop forever
2026-09-07 22:45:29,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 22:45:29,800 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:50:36,246 INFO core: _init_accounts coroutine started
2026-09-07 22:50:36,246 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 22:50:36,249 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 22:50:36,255 INFO core: Event loop thread started, running loop forever
2026-09-07 22:50:36,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 22:50:36,562 INFO core: _init_accounts coroutine started
2026-09-07 22:50:36,562 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 22:50:36,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 22:55:42,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 22:55:42,411 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 22:55:42,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 22:55:42,420 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 22:55:49,152 INFO core: Event loop thread started, running loop forever
2026-09-07 22:55:49,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 22:55:49,457 INFO core: _init_accounts coroutine started
2026-09-07 22:55:49,459 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 22:55:49,480 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:00:46,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:05:24,411 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-07 23:05:24,433 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:10:19,004 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:15:43,011 INFO core: Event loop thread started, running loop forever
2026-09-07 23:15:43,313 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 23:15:43,317 INFO core: _init_accounts coroutine started
2026-09-07 23:15:43,318 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 23:15:43,327 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 23:15:43,328 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 23:15:43,329 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 23:15:43,330 INFO core: _init_accounts_inner: reloading LLM config
2026-09-07 23:15:43,338 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-07 23:15:43,338 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-07 23:15:43,341 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-07 23:15:43,342 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-07 23:15:43,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:20:26,432 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 23:20:26,432 WARNING core: Account 2: connect timed out after 35s
2026-09-07 23:20:26,432 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-07 23:20:26,433 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-07 23:20:26,433 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 23:20:26,434 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-07 23:20:26,434 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-07 23:20:26,440 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:25:22,927 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 23:25:22,929 WARNING core: Account 2: connect timed out after 35s
2026-09-07 23:25:22,930 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-07 23:25:22,930 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-07 23:25:22,931 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 23:25:22,932 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-07 23:25:22,932 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-07 23:25:22,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:30:28,483 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-07 23:30:28,483 WARNING core: Account 2: connect timed out after 35s
2026-09-07 23:30:28,484 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-07 23:30:28,484 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-07 23:30:28,485 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-07 23:30:28,486 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-07 23:30:28,486 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-07 23:30:44,667 INFO core: Event loop thread started, running loop forever
2026-09-07 23:30:44,969 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 23:30:44,974 INFO core: _init_accounts coroutine started
2026-09-07 23:30:44,975 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 23:30:44,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:35:21,181 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:40:19,477 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-07 23:40:19,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:40:19,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-07 23:45:25,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-07 23:45:25,399 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-07 23:45:27,019 INFO core: Event loop thread started, running loop forever
2026-09-07 23:45:27,320 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 23:45:27,325 INFO core: _init_accounts coroutine started
2026-09-07 23:45:27,327 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 23:45:27,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:50:33,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-07 23:50:49,571 INFO core: Event loop thread started, running loop forever
2026-09-07 23:50:49,872 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-07 23:50:49,879 INFO core: _init_accounts coroutine started
2026-09-07 23:50:49,880 INFO core: _init_accounts_inner: starting DB migrations
2026-09-07 23:50:49,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-07 23:55:30,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:00:05,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 00:00:56,513 INFO core: Event loop thread started, running loop forever
2026-09-08 00:00:56,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 00:00:56,818 INFO core: _init_accounts coroutine started
2026-09-08 00:00:56,819 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 00:00:56,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:05:31,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:10:27,983 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 00:10:27,984 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 00:10:27,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:15:33,414 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 00:15:33,415 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 00:15:33,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 00:15:33,416 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 00:15:33,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 00:15:33,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 00:15:51,985 INFO core: Event loop thread started, running loop forever
2026-09-08 00:15:52,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 00:15:52,290 INFO core: _init_accounts coroutine started
2026-09-08 00:15:52,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 00:15:52,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:20:08,472 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:25:26,207 INFO core: Event loop thread started, running loop forever
2026-09-08 00:25:26,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 00:25:26,511 INFO core: _init_accounts coroutine started
2026-09-08 00:25:26,513 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 00:25:26,519 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 00:25:26,519 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 00:25:26,520 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 00:25:26,521 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 00:25:26,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:30:19,625 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 00:30:19,625 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 00:30:19,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:35:21,505 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 00:35:21,506 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 00:35:21,511 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:40:28,402 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 00:40:28,403 WARNING core: Account 2: connect timed out after 35s
2026-09-08 00:40:28,404 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 00:40:28,404 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-08 00:40:51,265 INFO core: Event loop thread started, running loop forever
2026-09-08 00:40:51,575 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 00:40:51,579 INFO core: _init_accounts coroutine started
2026-09-08 00:40:51,580 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 00:40:51,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:45:36,044 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 00:45:36,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:50:46,188 INFO core: Event loop thread started, running loop forever
2026-09-08 00:50:46,490 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 00:50:46,493 INFO core: _init_accounts coroutine started
2026-09-08 00:50:46,496 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 00:50:46,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:55:42,583 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 00:55:42,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 00:55:42,586 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 00:55:42,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 00:55:42,589 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 01:00:41,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:01:14,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:05:43,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:10:28,295 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 01:10:28,295 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 01:10:28,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:15:29,848 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 01:15:29,849 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 01:15:29,856 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:20:12,271 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 01:20:12,272 WARNING core: Account 2: connect timed out after 35s
2026-09-08 01:20:12,273 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 01:20:12,273 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-08 01:20:12,274 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 01:20:12,275 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-08 01:20:12,275 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-08 01:20:12,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:25:08,105 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 01:25:08,106 WARNING core: Account 2: connect timed out after 35s
2026-09-08 01:25:08,107 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-08 01:25:08,108 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-08 01:25:08,109 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 01:25:08,110 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-08 01:25:08,111 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-08 01:25:08,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:30:15,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 01:30:15,415 WARNING core: Account 2: connect timed out after 35s
2026-09-08 01:30:15,416 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-08 01:30:15,416 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-08 01:30:15,416 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 01:30:15,417 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-08 01:30:15,417 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-08 01:30:34,990 INFO core: Event loop thread started, running loop forever
2026-09-08 01:30:35,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 01:30:35,296 INFO core: _init_accounts coroutine started
2026-09-08 01:30:35,298 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 01:30:35,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:35:11,734 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 01:35:11,735 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 01:35:11,737 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 01:35:11,738 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 01:35:11,741 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:40:17,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 01:40:23,865 INFO core: Event loop thread started, running loop forever
2026-09-08 01:40:24,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 01:40:24,170 INFO core: _init_accounts coroutine started
2026-09-08 01:40:24,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 01:40:24,185 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:45:16,075 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 01:45:16,075 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 01:45:16,081 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 01:45:16,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:45:16,084 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 01:50:23,478 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 01:50:23,479 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 01:50:31,890 INFO core: Event loop thread started, running loop forever
2026-09-08 01:50:32,191 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 01:50:32,205 INFO core: _init_accounts coroutine started
2026-09-08 01:50:32,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 01:50:32,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 01:55:04,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:00:11,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 02:00:11,730 INFO core: Event loop thread started, running loop forever
2026-09-08 02:00:12,035 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 02:00:12,039 INFO core: _init_accounts coroutine started
2026-09-08 02:00:12,040 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 02:00:12,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:05:17,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:10:24,419 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 02:10:24,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 02:10:41,287 INFO core: Event loop thread started, running loop forever
2026-09-08 02:10:41,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 02:10:41,595 INFO core: _init_accounts coroutine started
2026-09-08 02:10:41,595 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 02:10:41,615 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:10:41,618 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 02:10:41,619 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 02:10:41,620 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 02:10:41,622 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 02:15:34,380 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:20:23,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:25:08,778 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 02:25:08,780 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 02:25:08,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:30:09,439 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 02:30:34,546 INFO core: Event loop thread started, running loop forever
2026-09-08 02:30:34,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 02:30:34,849 INFO core: _init_accounts coroutine started
2026-09-08 02:30:34,850 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 02:30:34,854 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:35:14,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:40:20,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 02:40:20,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 02:40:20,383 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 02:40:20,384 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 02:40:20,384 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 02:40:20,384 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 02:40:20,384 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 02:40:20,384 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 02:40:20,384 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 02:40:21,361 INFO core: Event loop thread started, running loop forever
2026-09-08 02:40:21,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 02:40:21,668 INFO core: _init_accounts coroutine started
2026-09-08 02:40:21,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 02:40:21,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:45:12,263 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 02:45:12,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:45:12,264 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 02:50:48,201 INFO core: Event loop thread started, running loop forever
2026-09-08 02:50:48,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 02:50:48,507 INFO core: _init_accounts coroutine started
2026-09-08 02:50:48,508 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 02:50:48,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 02:55:43,884 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 02:55:43,885 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 02:55:43,886 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 02:55:43,887 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 02:55:43,901 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 02:55:43,901 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 02:55:43,906 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 02:55:43,907 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 02:55:43,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:00:44,823 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 03:00:44,827 WARNING core: Account 2: connect timed out after 35s
2026-09-08 03:00:44,827 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 03:00:44,828 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-08 03:00:44,828 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 03:00:44,829 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-08 03:00:44,830 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-08 03:00:44,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:05:44,632 INFO core: Event loop thread started, running loop forever
2026-09-08 03:05:44,933 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 03:05:44,936 INFO core: _init_accounts coroutine started
2026-09-08 03:05:44,939 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 03:05:44,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:05:51,632 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 03:05:51,632 WARNING core: Account 2: connect timed out after 35s
2026-09-08 03:05:51,633 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-08 03:05:51,633 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-08 03:05:51,634 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 03:05:51,635 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-08 03:05:51,635 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-08 03:10:05,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:10:05,923 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 03:15:11,357 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 03:15:11,358 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 03:15:11,358 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 03:15:11,358 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 03:15:11,358 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 03:15:11,359 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 03:15:11,359 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 03:15:11,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 03:15:44,091 INFO core: Event loop thread started, running loop forever
2026-09-08 03:15:44,392 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 03:15:44,398 INFO core: _init_accounts coroutine started
2026-09-08 03:15:44,399 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 03:15:44,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:20:14,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:25:10,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:30:16,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 03:30:50,161 INFO core: Event loop thread started, running loop forever
2026-09-08 03:30:50,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 03:30:50,465 INFO core: _init_accounts coroutine started
2026-09-08 03:30:50,466 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 03:30:50,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:35:52,702 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 03:35:52,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:40:34,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:45:32,158 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-08 03:45:32,159 INFO core: _init_accounts coroutine started
2026-09-08 03:45:32,159 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 03:45:32,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:50:29,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 03:55:36,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 03:55:52,318 INFO core: Event loop thread started, running loop forever
2026-09-08 03:55:52,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 03:55:52,623 INFO core: _init_accounts coroutine started
2026-09-08 03:55:52,623 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 03:55:52,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:00:22,268 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:05:10,271 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 04:05:10,271 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 04:05:10,281 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 04:05:10,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:10:17,463 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 04:10:17,464 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 04:10:17,466 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 04:10:17,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 04:10:33,815 INFO core: Event loop thread started, running loop forever
2026-09-08 04:10:34,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 04:10:34,123 INFO core: _init_accounts coroutine started
2026-09-08 04:10:34,125 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 04:10:34,131 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:15:28,972 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 04:15:28,975 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 04:15:28,982 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 04:15:28,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:15:28,985 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 04:20:35,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 04:20:35,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 04:20:35,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 04:20:42,923 INFO core: Event loop thread started, running loop forever
2026-09-08 04:20:43,224 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 04:20:43,227 INFO core: _init_accounts coroutine started
2026-09-08 04:20:43,229 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 04:20:43,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:25:04,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:30:11,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 04:30:11,430 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 04:30:11,430 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 04:30:11,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 04:30:11,431 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 04:30:11,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 04:30:11,431 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 04:30:11,431 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 04:30:11,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 04:30:53,035 INFO core: Event loop thread started, running loop forever
2026-09-08 04:30:53,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 04:30:53,340 INFO core: _init_accounts coroutine started
2026-09-08 04:30:53,341 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 04:30:53,347 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:35:09,130 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 04:35:09,130 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 04:35:09,136 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 04:35:09,140 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 04:35:09,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:40:16,458 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 04:40:16,459 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 04:40:16,459 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 04:40:52,535 INFO core: Event loop thread started, running loop forever
2026-09-08 04:40:52,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 04:40:52,840 INFO core: _init_accounts coroutine started
2026-09-08 04:40:52,844 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 04:40:52,858 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:45:05,321 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 04:45:35,890 INFO core: Event loop thread started, running loop forever
2026-09-08 04:45:36,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 04:45:36,195 INFO core: _init_accounts coroutine started
2026-09-08 04:45:36,197 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 04:45:36,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:50:42,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 04:50:53,815 INFO core: Event loop thread started, running loop forever
2026-09-08 04:50:54,116 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 04:50:54,122 INFO core: _init_accounts coroutine started
2026-09-08 04:50:54,122 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 04:50:54,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 04:55:07,119 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 04:55:07,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:00:28,869 INFO core: Event loop thread started, running loop forever
2026-09-08 05:00:29,173 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 05:00:29,190 INFO core: _init_accounts coroutine started
2026-09-08 05:00:29,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:00:29,191 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 05:05:16,699 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 05:05:16,699 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 05:05:16,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:10:22,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 05:10:22,455 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 05:10:22,456 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 05:10:22,456 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 05:10:22,456 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 05:10:22,457 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 05:10:23,346 INFO core: Event loop thread started, running loop forever
2026-09-08 05:10:23,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 05:10:23,661 INFO core: _init_accounts coroutine started
2026-09-08 05:10:23,661 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 05:10:23,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:15:30,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 05:15:49,566 INFO core: Event loop thread started, running loop forever
2026-09-08 05:15:49,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 05:15:49,871 INFO core: _init_accounts coroutine started
2026-09-08 05:15:49,872 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 05:15:49,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:20:31,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:25:13,376 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 05:25:13,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 05:25:13,380 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:30:24,727 INFO core: Event loop thread started, running loop forever
2026-09-08 05:30:25,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 05:30:25,030 INFO core: _init_accounts coroutine started
2026-09-08 05:30:25,032 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 05:30:25,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:35:31,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 05:35:50,638 INFO core: Event loop thread started, running loop forever
2026-09-08 05:35:50,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 05:35:50,949 INFO core: _init_accounts coroutine started
2026-09-08 05:35:50,950 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 05:35:50,960 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:40:17,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:45:05,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:50:12,451 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 05:50:12,452 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 05:50:12,453 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 05:50:12,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 05:50:12,454 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 05:50:12,454 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 05:50:12,454 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 05:50:12,454 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 05:50:12,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 05:50:48,276 INFO core: Event loop thread started, running loop forever
2026-09-08 05:50:48,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 05:50:48,584 INFO core: _init_accounts coroutine started
2026-09-08 05:50:48,586 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 05:50:48,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 05:55:41,335 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 05:55:41,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:00:40,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:05:06,806 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-08 06:05:06,807 INFO core: _init_accounts coroutine started
2026-09-08 06:05:06,807 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 06:05:06,818 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 06:05:06,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 06:05:06,820 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 06:05:06,821 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 06:05:06,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:10:13,391 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 06:10:32,791 INFO core: Event loop thread started, running loop forever
2026-09-08 06:10:33,093 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 06:10:33,097 INFO core: _init_accounts coroutine started
2026-09-08 06:10:33,099 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 06:10:33,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:15:20,366 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 06:15:20,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:20:51,987 INFO core: Event loop thread started, running loop forever
2026-09-08 06:20:52,288 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 06:20:52,291 INFO core: _init_accounts coroutine started
2026-09-08 06:20:52,291 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 06:20:52,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:21:11,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:25:14,075 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 06:25:14,077 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 06:25:14,078 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:25:14,079 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 06:30:21,390 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 06:30:42,939 INFO core: Event loop thread started, running loop forever
2026-09-08 06:30:43,239 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 06:30:43,243 INFO core: _init_accounts coroutine started
2026-09-08 06:30:43,245 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 06:30:43,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:35:47,941 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 06:35:47,944 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:35:47,944 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 06:40:49,097 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 06:40:49,103 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 06:40:49,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:45:20,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:50:20,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 06:55:14,622 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 06:55:14,623 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 06:55:14,628 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 06:55:14,629 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 06:55:14,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:00:06,366 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 07:00:06,367 WARNING core: Account 2: connect timed out after 35s
2026-09-08 07:00:06,368 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 07:00:06,368 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-08 07:00:06,369 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 07:00:06,370 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-08 07:00:06,370 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-08 07:00:31,074 INFO core: Event loop thread started, running loop forever
2026-09-08 07:00:31,379 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 07:00:31,388 INFO core: _init_accounts coroutine started
2026-09-08 07:00:31,388 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 07:00:31,389 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:05:33,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:10:27,845 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 07:10:27,845 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 07:10:27,860 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 07:10:27,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:10:27,880 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 07:15:21,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:20:09,267 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 07:20:09,267 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 07:20:09,271 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 07:20:09,272 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 07:20:09,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:25:16,345 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 07:25:16,356 WARNING core: Account 2: connect timed out after 35s
2026-09-08 07:25:16,357 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 07:25:22,278 INFO core: Event loop thread started, running loop forever
2026-09-08 07:25:22,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 07:25:22,584 INFO core: _init_accounts coroutine started
2026-09-08 07:25:22,587 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 07:25:22,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:30:43,430 INFO core: Event loop thread started, running loop forever
2026-09-08 07:30:43,731 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 07:30:43,734 INFO core: _init_accounts coroutine started
2026-09-08 07:30:43,735 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 07:30:43,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:35:22,599 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 07:35:22,602 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:35:22,603 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 07:40:17,570 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 07:40:17,572 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:45:16,216 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 07:45:16,217 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 07:45:16,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:50:46,163 INFO core: Event loop thread started, running loop forever
2026-09-08 07:50:46,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 07:50:46,471 INFO core: _init_accounts coroutine started
2026-09-08 07:50:46,472 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 07:50:46,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 07:55:10,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:00:42,940 INFO core: Event loop thread started, running loop forever
2026-09-08 08:00:43,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 08:00:43,247 INFO core: _init_accounts coroutine started
2026-09-08 08:00:43,249 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 08:00:43,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:05:28,166 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:10:47,138 INFO core: Event loop thread started, running loop forever
2026-09-08 08:10:47,439 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 08:10:47,446 INFO core: _init_accounts coroutine started
2026-09-08 08:10:47,447 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 08:10:47,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:15:29,778 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 08:15:29,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:20:18,156 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:25:17,290 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-08 08:25:17,291 INFO core: _init_accounts coroutine started
2026-09-08 08:25:17,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 08:25:17,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:30:48,779 INFO core: Event loop thread started, running loop forever
2026-09-08 08:30:49,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 08:30:49,086 INFO core: _init_accounts coroutine started
2026-09-08 08:30:49,086 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 08:30:49,097 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:35:35,810 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:40:10,113 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 08:40:10,114 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 08:40:10,118 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 08:40:10,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:45:11,442 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 08:45:11,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:50:09,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 08:55:15,400 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 08:55:18,959 INFO core: Event loop thread started, running loop forever
2026-09-08 08:55:19,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 08:55:19,268 INFO core: _init_accounts coroutine started
2026-09-08 08:55:19,269 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 08:55:19,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:00:30,202 INFO core: Event loop thread started, running loop forever
2026-09-08 09:00:30,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 09:00:30,505 INFO core: _init_accounts coroutine started
2026-09-08 09:00:30,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 09:00:30,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:05:08,138 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 09:05:08,156 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 09:05:08,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:10:03,745 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 09:10:03,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:15:03,369 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 09:15:03,369 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 09:15:03,371 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 09:15:50,931 INFO core: Event loop thread started, running loop forever
2026-09-08 09:15:51,237 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 09:15:51,240 INFO core: _init_accounts coroutine started
2026-09-08 09:15:51,241 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 09:15:51,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:20:46,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 09:20:46,620 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 09:20:46,621 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 09:20:46,622 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 09:20:46,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:25:36,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:30:15,798 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:35:22,378 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 09:35:41,925 INFO core: Event loop thread started, running loop forever
2026-09-08 09:35:42,226 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 09:35:42,232 INFO core: _init_accounts coroutine started
2026-09-08 09:35:42,232 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 09:35:42,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:40:53,211 INFO core: Event loop thread started, running loop forever
2026-09-08 09:40:53,512 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 09:40:53,515 INFO core: _init_accounts coroutine started
2026-09-08 09:40:53,518 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 09:40:53,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:45:41,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:50:22,813 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 09:50:22,813 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 09:50:22,851 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 09:55:28,398 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 09:55:28,398 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 09:55:28,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 09:55:28,400 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 09:55:28,400 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 09:55:28,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 09:55:39,061 INFO core: Event loop thread started, running loop forever
2026-09-08 09:55:39,365 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 09:55:39,369 INFO core: _init_accounts coroutine started
2026-09-08 09:55:39,371 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 09:55:39,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:00:38,414 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:05:29,768 INFO core: Event loop thread started, running loop forever
2026-09-08 10:05:30,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 10:05:30,073 INFO core: _init_accounts coroutine started
2026-09-08 10:05:30,074 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 10:05:30,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:05:45,787 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-08 10:05:30,101 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 10:10:15,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 10:10:15,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:15:22,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 10:15:22,466 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-08 10:15:22,467 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 10:15:22,467 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-08 10:15:22,468 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 10:15:22,468 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-08 10:15:50,903 INFO core: Event loop thread started, running loop forever
2026-09-08 10:15:51,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 10:15:51,208 INFO core: _init_accounts coroutine started
2026-09-08 10:15:51,210 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 10:15:51,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:20:40,644 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 10:20:40,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:25:30,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:30:45,326 INFO core: Event loop thread started, running loop forever
2026-09-08 10:30:45,627 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 10:30:45,632 INFO core: _init_accounts coroutine started
2026-09-08 10:30:45,633 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 10:30:45,639 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:35:52,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 10:35:54,120 INFO core: Event loop thread started, running loop forever
2026-09-08 10:35:54,420 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 10:35:54,426 INFO core: _init_accounts coroutine started
2026-09-08 10:35:54,426 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 10:35:54,430 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:40:21,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:45:08,981 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:50:15,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 10:50:15,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 10:50:15,392 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 10:50:15,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 10:50:15,393 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 10:50:15,394 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 10:50:15,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 10:50:15,394 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 10:50:15,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 10:50:42,299 INFO core: Event loop thread started, running loop forever
2026-09-08 10:50:42,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 10:50:42,604 INFO core: _init_accounts coroutine started
2026-09-08 10:50:42,605 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 10:50:42,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 10:55:36,073 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 10:55:36,073 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 10:55:36,077 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 10:55:36,093 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 10:55:36,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:00:36,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:05:43,470 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 11:05:43,471 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 11:05:43,471 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 11:05:48,844 INFO core: Event loop thread started, running loop forever
2026-09-08 11:05:49,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 11:05:49,154 INFO core: _init_accounts coroutine started
2026-09-08 11:05:49,154 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 11:05:49,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:10:45,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:10:45,336 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 11:10:45,547 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 11:15:25,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:20:21,681 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 11:20:21,685 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 11:20:21,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:25:09,134 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 11:25:09,135 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 11:25:09,141 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 11:25:09,143 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 11:25:09,148 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:30:04,432 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 11:30:04,433 WARNING core: Account 2: connect timed out after 35s
2026-09-08 11:30:04,433 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 11:30:04,434 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-08 11:30:04,434 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 11:30:04,435 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-08 11:30:04,436 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-08 11:30:42,884 INFO core: Event loop thread started, running loop forever
2026-09-08 11:30:43,185 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 11:30:43,192 INFO core: _init_accounts coroutine started
2026-09-08 11:30:43,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 11:30:43,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:35:52,764 INFO core: Event loop thread started, running loop forever
2026-09-08 11:35:53,065 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 11:35:53,070 INFO core: _init_accounts coroutine started
2026-09-08 11:35:53,070 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 11:35:53,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:40:38,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:45:25,709 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 11:45:25,710 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 11:45:25,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:50:32,491 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 11:50:50,427 INFO core: Event loop thread started, running loop forever
2026-09-08 11:50:50,728 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 11:50:50,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 11:55:23,685 INFO core: _init_accounts coroutine started
2026-09-08 11:55:23,688 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 11:55:23,692 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:00:44,233 INFO core: Event loop thread started, running loop forever
2026-09-08 12:00:44,535 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 12:00:44,542 INFO core: _init_accounts coroutine started
2026-09-08 12:00:44,543 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 12:00:44,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:05:13,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:10:46,701 INFO core: Event loop thread started, running loop forever
2026-09-08 12:10:47,002 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 12:10:47,012 INFO core: _init_accounts coroutine started
2026-09-08 12:10:47,012 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 12:10:47,020 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:15:33,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:20:13,709 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 12:20:13,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:20:13,712 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 12:25:44,627 INFO core: Event loop thread started, running loop forever
2026-09-08 12:25:44,928 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 12:25:44,933 INFO core: _init_accounts coroutine started
2026-09-08 12:25:44,934 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 12:25:44,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:30:34,382 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 12:30:34,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:35:29,716 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:40:23,041 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-08 12:40:23,044 INFO core: _init_accounts coroutine started
2026-09-08 12:40:23,044 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 12:40:23,050 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 12:40:23,050 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 12:40:23,052 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 12:40:23,053 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 12:40:23,090 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:45:35,219 INFO core: Event loop thread started, running loop forever
2026-09-08 12:45:35,520 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 12:45:35,524 INFO core: _init_accounts coroutine started
2026-09-08 12:45:35,526 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 12:45:35,536 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:50:52,749 INFO core: Event loop thread started, running loop forever
2026-09-08 12:50:53,050 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 12:50:53,053 INFO core: _init_accounts coroutine started
2026-09-08 12:50:53,054 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 12:50:53,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 12:55:30,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:00:12,474 INFO core: Event loop thread started, running loop forever
2026-09-08 13:00:12,775 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 13:00:12,779 INFO core: _init_accounts coroutine started
2026-09-08 13:00:12,780 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 13:00:12,859 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-08 13:00:12,871 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-08 13:00:37,514 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 13:00:37,515 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 13:05:13,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:10:07,922 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-08 13:10:07,923 INFO core: _init_accounts coroutine started
2026-09-08 13:10:07,923 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 13:10:07,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:15:09,215 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 13:15:09,216 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 13:15:09,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:15:09,220 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 13:20:16,434 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 13:20:16,437 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 13:20:16,438 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 13:20:16,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 13:20:48,694 INFO core: Event loop thread started, running loop forever
2026-09-08 13:20:48,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 13:20:49,003 INFO core: _init_accounts coroutine started
2026-09-08 13:20:49,004 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 13:20:49,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:25:45,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:30:23,689 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 13:30:23,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:35:23,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:40:55,505 INFO core: Event loop thread started, running loop forever
2026-09-08 13:40:55,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 13:40:55,810 INFO core: _init_accounts coroutine started
2026-09-08 13:40:55,812 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 13:40:55,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:45:03,319 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 13:45:23,986 INFO core: Event loop thread started, running loop forever
2026-09-08 13:45:24,287 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 13:45:24,290 INFO core: _init_accounts coroutine started
2026-09-08 13:45:24,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:45:24,293 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 13:50:18,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 13:55:24,902 INFO core: Event loop thread started, running loop forever
2026-09-08 13:55:24,922 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 13:55:25,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 13:55:25,207 INFO core: _init_accounts coroutine started
2026-09-08 13:55:25,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 13:55:25,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:00:33,292 INFO core: Event loop thread started, running loop forever
2026-09-08 14:00:33,593 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 14:00:33,597 INFO core: _init_accounts coroutine started
2026-09-08 14:00:33,600 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 14:00:33,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:05:40,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 14:05:48,799 INFO core: Event loop thread started, running loop forever
2026-09-08 14:05:49,100 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 14:05:49,104 INFO core: _init_accounts coroutine started
2026-09-08 14:05:49,105 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 14:05:49,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:10:06,570 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:15:21,982 INFO core: Event loop thread started, running loop forever
2026-09-08 14:15:22,284 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 14:15:22,289 INFO core: _init_accounts coroutine started
2026-09-08 14:15:22,290 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 14:15:22,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:20:41,940 INFO core: Event loop thread started, running loop forever
2026-09-08 14:20:42,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 14:20:42,247 INFO core: _init_accounts coroutine started
2026-09-08 14:20:42,247 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 14:20:42,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:25:28,500 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 14:25:28,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:30:11,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:35:38,572 INFO core: Event loop thread started, running loop forever
2026-09-08 14:35:38,874 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 14:35:38,878 INFO core: _init_accounts coroutine started
2026-09-08 14:35:38,879 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 14:35:38,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:40:04,392 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:45:30,280 INFO core: Event loop thread started, running loop forever
2026-09-08 14:45:30,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 14:45:30,586 INFO core: _init_accounts coroutine started
2026-09-08 14:45:30,586 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 14:45:30,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:50:25,693 INFO core: Event loop thread started, running loop forever
2026-09-08 14:50:25,994 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 14:50:25,998 INFO core: _init_accounts coroutine started
2026-09-08 14:50:25,999 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 14:50:26,004 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 14:50:36,699 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 14:50:36,700 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 14:50:36,701 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 14:55:27,219 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 14:55:27,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:00:34,534 INFO core: Event loop thread started, running loop forever
2026-09-08 15:00:34,840 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 15:00:34,848 INFO core: _init_accounts coroutine started
2026-09-08 15:00:34,848 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 15:00:34,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:05:50,629 INFO core: Event loop thread started, running loop forever
2026-09-08 15:05:50,939 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 15:05:50,944 INFO core: _init_accounts coroutine started
2026-09-08 15:05:50,945 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 15:05:50,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:10:36,091 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 15:10:36,092 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 15:10:36,093 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 15:10:36,095 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 15:10:36,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:15:12,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:20:19,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 15:20:19,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 15:20:19,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 15:20:19,504 INFO core: Event loop thread started, running loop forever
2026-09-08 15:20:19,805 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 15:20:19,811 INFO core: _init_accounts coroutine started
2026-09-08 15:20:19,811 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 15:20:19,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:25:47,727 INFO core: Event loop thread started, running loop forever
2026-09-08 15:25:48,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 15:25:48,031 INFO core: _init_accounts coroutine started
2026-09-08 15:25:48,034 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 15:25:48,048 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:30:28,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:35:15,105 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 15:35:15,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 15:35:15,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 15:35:15,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:35:15,111 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 15:40:49,300 INFO core: Event loop thread started, running loop forever
2026-09-08 15:40:49,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 15:40:49,605 INFO core: _init_accounts coroutine started
2026-09-08 15:40:49,606 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 15:40:49,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:45:47,596 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 15:45:47,596 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 15:45:47,602 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 15:45:47,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:45:47,604 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 15:50:21,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 15:55:28,385 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 15:55:50,713 INFO core: Event loop thread started, running loop forever
2026-09-08 15:55:51,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 15:55:51,017 INFO core: _init_accounts coroutine started
2026-09-08 15:55:51,020 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 15:55:51,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:00:04,360 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 16:00:38,174 INFO core: Event loop thread started, running loop forever
2026-09-08 16:00:38,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 16:00:38,479 INFO core: _init_accounts coroutine started
2026-09-08 16:00:38,480 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 16:00:38,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:05:45,442 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 16:05:46,778 INFO core: Event loop thread started, running loop forever
2026-09-08 16:05:47,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 16:05:47,085 INFO core: _init_accounts coroutine started
2026-09-08 16:05:47,085 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 16:05:47,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:10:08,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:15:15,544 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 16:15:18,155 INFO core: Event loop thread started, running loop forever
2026-09-08 16:15:18,456 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 16:15:18,460 INFO core: _init_accounts coroutine started
2026-09-08 16:15:18,462 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 16:15:18,468 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:20:12,686 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:25:19,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 16:25:19,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 16:25:19,396 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 16:25:19,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 16:25:19,397 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 16:25:19,397 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 16:25:19,397 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 16:25:19,397 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 16:25:19,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 16:25:32,134 INFO core: Event loop thread started, running loop forever
2026-09-08 16:25:32,436 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 16:25:32,439 INFO core: _init_accounts coroutine started
2026-09-08 16:25:32,440 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 16:25:32,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:30:39,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 16:30:39,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 16:30:39,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 16:30:39,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 16:30:39,401 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 16:30:39,401 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 16:30:39,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 16:30:39,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 16:30:51,199 INFO core: Event loop thread started, running loop forever
2026-09-08 16:30:51,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 16:30:51,505 INFO core: _init_accounts coroutine started
2026-09-08 16:30:51,506 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 16:30:51,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:35:15,074 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 16:35:15,074 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 16:35:15,076 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 16:35:15,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:40:06,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 16:40:06,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:45:06,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:50:52,030 INFO core: Event loop thread started, running loop forever
2026-09-08 16:50:52,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 16:50:52,334 INFO core: _init_accounts coroutine started
2026-09-08 16:50:52,336 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 16:50:52,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 16:55:03,831 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 16:55:03,831 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 16:55:03,833 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 16:55:03,834 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 16:55:03,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:00:04,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:05:24,380 INFO core: Event loop thread started, running loop forever
2026-09-08 17:05:24,681 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 17:05:24,685 INFO core: _init_accounts coroutine started
2026-09-08 17:05:24,686 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 17:05:24,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:10:29,884 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 17:10:29,885 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 17:10:29,888 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 17:10:29,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:15:05,198 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 17:15:05,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:20:35,159 INFO core: Event loop thread started, running loop forever
2026-09-08 17:20:35,460 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 17:20:35,464 INFO core: _init_accounts coroutine started
2026-09-08 17:20:35,465 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 17:20:35,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:25:43,714 INFO core: Event loop thread started, running loop forever
2026-09-08 17:25:44,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 17:25:44,021 INFO core: _init_accounts coroutine started
2026-09-08 17:25:44,022 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 17:25:44,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:30:16,824 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 17:30:16,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:35:30,207 INFO core: Event loop thread started, running loop forever
2026-09-08 17:35:30,509 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 17:35:30,513 INFO core: _init_accounts coroutine started
2026-09-08 17:35:30,515 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 17:35:30,527 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:40:37,409 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 17:40:45,663 INFO core: Event loop thread started, running loop forever
2026-09-08 17:40:45,964 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 17:40:45,969 INFO core: _init_accounts coroutine started
2026-09-08 17:40:45,969 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 17:40:45,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:45:32,648 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 17:45:32,650 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 17:45:32,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:50:05,650 INFO core: Event loop thread started, running loop forever
2026-09-08 17:50:05,951 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 17:50:05,957 INFO core: _init_accounts coroutine started
2026-09-08 17:50:05,957 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 17:50:05,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 17:55:12,393 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 17:55:12,393 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 17:55:12,393 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 17:55:12,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 17:55:12,394 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 17:55:12,394 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 17:55:12,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 17:55:12,395 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 17:55:12,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 17:55:24,746 INFO core: Event loop thread started, running loop forever
2026-09-08 17:55:25,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 17:55:25,053 INFO core: _init_accounts coroutine started
2026-09-08 17:55:25,054 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 17:55:25,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:00:49,778 INFO core: Event loop thread started, running loop forever
2026-09-08 18:00:50,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 18:00:50,082 INFO core: _init_accounts coroutine started
2026-09-08 18:00:50,083 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 18:00:50,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:05:23,302 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 18:05:23,302 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 18:05:23,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:10:27,470 INFO core: Event loop thread started, running loop forever
2026-09-08 18:10:27,771 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 18:10:27,774 INFO core: _init_accounts coroutine started
2026-09-08 18:10:27,775 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 18:10:27,784 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:10:30,469 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 18:15:04,374 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 18:15:51,671 INFO core: Event loop thread started, running loop forever
2026-09-08 18:15:51,972 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 18:15:51,975 INFO core: _init_accounts coroutine started
2026-09-08 18:15:51,976 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 18:15:51,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:20:48,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:20:48,659 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 18:20:48,660 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 18:25:52,645 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 18:25:52,657 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 18:25:52,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:30:42,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:35:48,359 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 18:35:48,360 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 18:35:48,360 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 18:35:50,108 INFO core: Event loop thread started, running loop forever
2026-09-08 18:35:50,411 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 18:35:50,415 INFO core: _init_accounts coroutine started
2026-09-08 18:35:50,416 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 18:35:50,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:40:56,600 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 18:40:57,505 INFO core: Event loop thread started, running loop forever
2026-09-08 18:40:57,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 18:40:57,811 INFO core: _init_accounts coroutine started
2026-09-08 18:40:57,811 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 18:40:57,816 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:45:23,262 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:50:29,384 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 18:50:38,382 INFO core: Event loop thread started, running loop forever
2026-09-08 18:50:38,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 18:50:38,686 INFO core: _init_accounts coroutine started
2026-09-08 18:50:38,689 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 18:50:38,693 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 18:55:33,451 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:00:16,067 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 19:00:16,068 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 19:00:16,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:00:16,078 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 19:05:23,451 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 19:05:23,452 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 19:05:23,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 19:05:23,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 19:05:34,050 INFO core: Event loop thread started, running loop forever
2026-09-08 19:05:34,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 19:05:34,355 INFO core: _init_accounts coroutine started
2026-09-08 19:05:34,356 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 19:05:34,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:10:16,760 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:15:22,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 19:15:31,569 INFO core: Event loop thread started, running loop forever
2026-09-08 19:15:31,870 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 19:15:31,874 INFO core: _init_accounts coroutine started
2026-09-08 19:15:31,874 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 19:15:31,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:20:27,188 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 19:20:27,204 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:25:48,944 INFO core: Event loop thread started, running loop forever
2026-09-08 19:25:49,251 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 19:25:49,255 INFO core: _init_accounts coroutine started
2026-09-08 19:25:49,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 19:25:49,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:30:25,436 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 19:30:25,437 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 19:30:25,438 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:35:17,672 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 19:35:17,675 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 19:35:17,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:40:16,558 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 19:40:16,558 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 19:40:16,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:40:16,564 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 19:40:16,565 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 19:45:23,422 WARNING core: Account 2: connect timed out after 35s
2026-09-08 19:45:30,851 INFO core: Event loop thread started, running loop forever
2026-09-08 19:45:31,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 19:45:31,160 INFO core: _init_accounts coroutine started
2026-09-08 19:45:31,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:45:31,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 19:50:37,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 19:50:47,288 INFO core: Event loop thread started, running loop forever
2026-09-08 19:50:47,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 19:50:47,592 INFO core: _init_accounts coroutine started
2026-09-08 19:50:47,592 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 19:50:47,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 19:55:20,299 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 19:55:20,300 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 19:55:20,303 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 19:55:20,306 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 19:55:20,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:00:14,541 INFO core: Event loop thread started, running loop forever
2026-09-08 20:00:14,842 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 20:00:14,847 INFO core: _init_accounts coroutine started
2026-09-08 20:00:14,851 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 20:00:14,856 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:05:22,139 INFO core: Event loop thread started, running loop forever
2026-09-08 20:05:22,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 20:05:22,444 INFO core: _init_accounts coroutine started
2026-09-08 20:05:22,445 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 20:05:22,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:10:18,071 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 20:10:18,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:15:19,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:20:04,993 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-08 20:20:04,994 INFO core: _init_accounts coroutine started
2026-09-08 20:20:04,994 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 20:20:04,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:25:10,463 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 20:25:16,875 INFO core: Event loop thread started, running loop forever
2026-09-08 20:25:17,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 20:25:17,182 INFO core: _init_accounts coroutine started
2026-09-08 20:25:17,184 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 20:25:17,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:30:03,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 20:30:03,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 20:30:03,382 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-08 20:30:03,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 20:30:03,382 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-08 20:30:03,383 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 20:30:03,383 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 20:30:03,383 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 20:30:03,383 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 20:30:31,742 INFO core: Event loop thread started, running loop forever
2026-09-08 20:30:32,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 20:30:32,050 INFO core: _init_accounts coroutine started
2026-09-08 20:30:32,050 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 20:30:32,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:35:10,408 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:40:51,423 INFO core: Event loop thread started, running loop forever
2026-09-08 20:40:51,726 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 20:40:51,733 INFO core: _init_accounts coroutine started
2026-09-08 20:40:51,733 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 20:40:51,742 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:45:36,404 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 20:45:36,435 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:50:47,463 INFO core: Event loop thread started, running loop forever
2026-09-08 20:50:47,763 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 20:50:47,766 INFO core: _init_accounts coroutine started
2026-09-08 20:50:47,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 20:50:47,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:55:20,162 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 20:55:20,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 20:55:20,162 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 21:00:27,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 21:00:36,886 INFO core: Event loop thread started, running loop forever
2026-09-08 21:00:37,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 21:00:37,194 INFO core: _init_accounts coroutine started
2026-09-08 21:00:37,194 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 21:00:37,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:05:13,598 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 21:05:13,598 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 21:05:13,601 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 21:05:13,602 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 21:05:13,611 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 21:05:13,612 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 21:05:13,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:10:22,992 INFO core: Event loop thread started, running loop forever
2026-09-08 21:10:23,293 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 21:10:23,298 INFO core: _init_accounts coroutine started
2026-09-08 21:10:23,299 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 21:10:23,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:15:25,453 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:15:25,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 21:15:25,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 21:15:25,456 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 21:20:43,623 INFO core: Event loop thread started, running loop forever
2026-09-08 21:20:43,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 21:20:43,929 INFO core: _init_accounts coroutine started
2026-09-08 21:20:43,929 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 21:20:43,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:25:30,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:25:30,056 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 21:30:11,028 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 21:30:11,031 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 21:30:11,033 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:35:39,429 INFO core: Event loop thread started, running loop forever
2026-09-08 21:35:39,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 21:35:39,737 INFO core: _init_accounts coroutine started
2026-09-08 21:35:39,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 21:35:39,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:40:05,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:45:12,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 21:45:31,633 INFO core: Event loop thread started, running loop forever
2026-09-08 21:45:31,934 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 21:45:31,938 INFO core: _init_accounts coroutine started
2026-09-08 21:45:31,939 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 21:45:31,953 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 21:45:31,953 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 21:45:31,954 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 21:45:31,955 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 21:45:31,963 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 21:45:31,964 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 21:45:31,968 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 21:45:31,969 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 21:45:31,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:50:34,462 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 21:50:34,463 WARNING core: Account 2: connect timed out after 35s
2026-09-08 21:50:34,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 21:50:34,466 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 21:55:05,135 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-08 21:55:05,137 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 21:55:05,138 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-08 21:55:05,138 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-08 21:55:05,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:00:23,314 INFO core: Event loop thread started, running loop forever
2026-09-08 22:00:23,616 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 22:00:23,620 INFO core: _init_accounts coroutine started
2026-09-08 22:00:23,620 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 22:00:23,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:05:23,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:10:18,537 INFO core: Event loop thread started, running loop forever
2026-09-08 22:10:18,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 22:10:18,843 INFO core: _init_accounts coroutine started
2026-09-08 22:10:18,844 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 22:10:18,853 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:10:30,540 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 22:15:07,431 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 22:15:07,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:20:08,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:25:42,104 INFO core: Event loop thread started, running loop forever
2026-09-08 22:25:42,405 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 22:25:42,409 INFO core: _init_accounts coroutine started
2026-09-08 22:25:42,411 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 22:25:42,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:30:16,577 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 22:30:16,577 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 22:30:16,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:35:23,410 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 22:35:49,593 INFO core: Event loop thread started, running loop forever
2026-09-08 22:35:49,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 22:35:49,897 INFO core: _init_accounts coroutine started
2026-09-08 22:35:49,899 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 22:35:49,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:40:06,410 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 22:40:06,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 22:40:06,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 22:40:06,413 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:45:44,283 INFO core: Event loop thread started, running loop forever
2026-09-08 22:45:44,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 22:45:44,589 INFO core: _init_accounts coroutine started
2026-09-08 22:45:44,590 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 22:45:44,594 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:50:35,903 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 22:55:50,315 INFO core: Event loop thread started, running loop forever
2026-09-08 22:55:50,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 22:55:50,623 INFO core: _init_accounts coroutine started
2026-09-08 22:55:50,623 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 22:55:50,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:00:31,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:00:31,807 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 23:00:31,808 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 23:00:31,810 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 23:05:31,955 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 23:05:31,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:10:13,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:15:22,551 INFO core: Event loop thread started, running loop forever
2026-09-08 23:15:22,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 23:15:22,874 INFO core: _init_accounts coroutine started
2026-09-08 23:15:22,875 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 23:15:22,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:20:06,908 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 23:20:06,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:20:06,908 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 23:25:12,416 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 23:25:12,428 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 23:25:12,428 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-08 23:25:12,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 23:25:12,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-08 23:25:41,265 INFO core: Event loop thread started, running loop forever
2026-09-08 23:25:41,566 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 23:25:41,570 INFO core: _init_accounts coroutine started
2026-09-08 23:25:41,571 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 23:25:41,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:30:06,691 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-08 23:30:06,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:35:22,369 INFO core: Event loop thread started, running loop forever
2026-09-08 23:35:22,674 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 23:35:22,678 INFO core: _init_accounts coroutine started
2026-09-08 23:35:22,678 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 23:35:22,704 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 23:35:22,704 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 23:35:22,705 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 23:35:22,711 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 23:35:22,721 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 23:35:22,721 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-08 23:35:22,726 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-08 23:35:22,727 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-08 23:35:22,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:40:24,922 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 23:40:24,923 WARNING core: Account 2: connect timed out after 35s
2026-09-08 23:40:24,923 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-08 23:40:24,923 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-08 23:40:24,924 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-08 23:40:24,924 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-08 23:40:24,925 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-08 23:40:24,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:45:30,431 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-08 23:45:41,408 INFO core: Event loop thread started, running loop forever
2026-09-08 23:45:41,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 23:45:41,714 INFO core: _init_accounts coroutine started
2026-09-08 23:45:41,714 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 23:45:41,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:50:19,640 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-08 23:50:19,641 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-08 23:50:19,646 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-08 23:50:19,650 INFO core: _init_accounts_inner: reloading LLM config
2026-09-08 23:50:19,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-08 23:55:25,421 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-08 23:55:51,729 INFO core: Event loop thread started, running loop forever
2026-09-08 23:55:52,030 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-08 23:55:52,033 INFO core: _init_accounts coroutine started
2026-09-08 23:55:52,034 INFO core: _init_accounts_inner: starting DB migrations
2026-09-08 23:55:52,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:00:39,699 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 00:00:39,699 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 00:00:39,701 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 00:00:39,702 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 00:00:39,705 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:05:45,506 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 00:05:45,506 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 00:05:45,507 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 00:05:52,909 INFO core: Event loop thread started, running loop forever
2026-09-09 00:05:53,210 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 00:05:53,214 INFO core: _init_accounts coroutine started
2026-09-09 00:05:53,216 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 00:05:53,223 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:10:47,012 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 00:10:47,012 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 00:10:47,017 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 00:10:47,018 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 00:10:47,029 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 00:10:47,029 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 00:10:47,034 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 00:10:47,034 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 00:10:47,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:15:28,864 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 00:15:28,864 WARNING core: Account 2: connect timed out after 35s
2026-09-09 00:15:28,865 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 00:15:28,865 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 00:15:28,866 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 00:15:28,867 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 00:15:28,867 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 00:15:28,870 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:20:37,133 INFO core: Event loop thread started, running loop forever
2026-09-09 00:20:37,434 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 00:20:37,439 INFO core: _init_accounts coroutine started
2026-09-09 00:20:37,440 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 00:20:37,451 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:25:24,896 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 00:25:24,907 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 00:25:24,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:30:31,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 00:30:31,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-09 00:30:31,402 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 00:30:31,402 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 00:30:31,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 00:30:31,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 00:30:40,441 INFO core: Event loop thread started, running loop forever
2026-09-09 00:30:40,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 00:30:40,749 INFO core: _init_accounts coroutine started
2026-09-09 00:30:40,750 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 00:30:40,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:35:22,740 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:40:28,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 00:40:33,086 INFO core: Event loop thread started, running loop forever
2026-09-09 00:40:33,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 00:40:33,390 INFO core: _init_accounts coroutine started
2026-09-09 00:40:33,392 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 00:40:33,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:45:10,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 00:45:10,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 00:45:10,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 00:45:10,475 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 00:45:10,488 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 00:45:10,488 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 00:45:10,492 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 00:45:10,492 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 00:45:10,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:50:37,437 INFO core: Event loop thread started, running loop forever
2026-09-09 00:50:37,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 00:50:37,751 INFO core: _init_accounts coroutine started
2026-09-09 00:50:37,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 00:50:37,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 00:50:37,775 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 00:50:37,775 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 00:55:25,770 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 00:55:25,773 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 00:55:25,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:00:35,943 INFO core: Event loop thread started, running loop forever
2026-09-09 01:00:36,244 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 01:00:36,247 INFO core: _init_accounts coroutine started
2026-09-09 01:00:36,248 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 01:00:36,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:05:04,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:10:21,530 INFO core: Event loop thread started, running loop forever
2026-09-09 01:10:21,831 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 01:10:21,835 INFO core: _init_accounts coroutine started
2026-09-09 01:10:21,836 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 01:10:21,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:15:28,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 01:15:41,199 INFO core: Event loop thread started, running loop forever
2026-09-09 01:15:41,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 01:15:41,503 INFO core: _init_accounts coroutine started
2026-09-09 01:15:41,505 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 01:15:41,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:20:16,474 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 01:20:16,475 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 01:20:16,478 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:20:16,478 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 01:20:16,481 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 01:25:23,450 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 01:25:23,451 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 01:25:23,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 01:25:39,981 INFO core: Event loop thread started, running loop forever
2026-09-09 01:25:40,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 01:25:40,286 INFO core: _init_accounts coroutine started
2026-09-09 01:25:40,289 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 01:25:40,301 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:30:24,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:30:24,716 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 01:30:24,716 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 01:35:10,340 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 01:35:10,353 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:40:08,927 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 01:40:08,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:45:50,038 INFO core: Event loop thread started, running loop forever
2026-09-09 01:45:50,340 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 01:45:50,343 INFO core: _init_accounts coroutine started
2026-09-09 01:45:50,345 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 01:45:50,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:50:46,161 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:55:33,107 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 01:55:33,108 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 01:55:33,108 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 02:00:25,201 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 02:00:25,202 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 02:00:25,216 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 02:00:25,216 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 02:00:25,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:05:28,414 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 02:05:28,415 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 02:05:28,469 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:10:21,081 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 02:10:21,082 WARNING core: Account 2: connect timed out after 35s
2026-09-09 02:10:21,084 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 02:10:21,084 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 02:10:21,086 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 02:10:21,087 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 02:10:21,087 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 02:10:21,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:15:04,738 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 02:15:04,739 WARNING core: Account 2: connect timed out after 35s
2026-09-09 02:15:04,740 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-09 02:15:04,740 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-09 02:15:04,741 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 02:15:04,742 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-09 02:15:04,742 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-09 02:15:04,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:20:11,471 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 02:20:11,473 WARNING core: Account 2: connect timed out after 35s
2026-09-09 02:20:11,474 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-09 02:20:11,474 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-09 02:20:11,474 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 02:20:11,474 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-09 02:20:11,475 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-09 02:20:35,612 INFO core: Event loop thread started, running loop forever
2026-09-09 02:20:35,917 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 02:20:35,926 INFO core: _init_accounts coroutine started
2026-09-09 02:20:35,927 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 02:20:35,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:25:50,268 INFO core: Event loop thread started, running loop forever
2026-09-09 02:25:50,569 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 02:25:50,575 INFO core: _init_accounts coroutine started
2026-09-09 02:25:50,575 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 02:25:50,588 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:30:35,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:35:41,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 02:35:41,468 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 02:35:41,468 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-09 02:35:41,469 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 02:35:41,470 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-09 02:35:48,896 INFO core: Event loop thread started, running loop forever
2026-09-09 02:35:49,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 02:35:49,204 INFO core: _init_accounts coroutine started
2026-09-09 02:35:49,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 02:35:49,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:40:40,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 02:40:40,104 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 02:40:40,105 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:45:42,191 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 02:45:42,202 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 02:45:42,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:50:20,960 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 02:55:47,181 INFO core: Event loop thread started, running loop forever
2026-09-09 02:55:47,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 02:55:47,485 INFO core: _init_accounts coroutine started
2026-09-09 02:55:47,486 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 02:55:47,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:00:13,520 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 03:00:13,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:05:46,174 INFO core: Event loop thread started, running loop forever
2026-09-09 03:05:46,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 03:05:46,484 INFO core: _init_accounts coroutine started
2026-09-09 03:05:46,484 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 03:05:46,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:05:46,510 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 03:05:46,510 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 03:10:25,834 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 03:10:25,845 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:15:03,375 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 03:15:03,436 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 03:15:03,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 03:15:03,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 03:15:40,800 INFO core: Event loop thread started, running loop forever
2026-09-09 03:15:41,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 03:15:41,106 INFO core: _init_accounts coroutine started
2026-09-09 03:15:41,106 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 03:15:41,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:20:23,037 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 03:20:23,038 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 03:20:23,039 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 03:20:23,039 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 03:20:23,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:25:16,086 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 03:25:16,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:25:16,090 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 03:30:23,403 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 03:30:23,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 03:30:27,889 INFO core: Event loop thread started, running loop forever
2026-09-09 03:30:28,190 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 03:30:28,193 INFO core: _init_accounts coroutine started
2026-09-09 03:30:28,194 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 03:30:28,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:35:45,524 INFO core: Event loop thread started, running loop forever
2026-09-09 03:35:45,826 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 03:35:45,829 INFO core: _init_accounts coroutine started
2026-09-09 03:35:45,832 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 03:35:45,846 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 03:35:45,847 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 03:35:45,848 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 03:35:45,850 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 03:35:45,854 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:40:38,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:45:44,425 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 03:45:53,156 INFO core: Event loop thread started, running loop forever
2026-09-09 03:45:53,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 03:45:53,463 INFO core: _init_accounts coroutine started
2026-09-09 03:45:53,464 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 03:45:53,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:50:33,189 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 03:50:33,189 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 03:50:33,192 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 03:50:33,193 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 03:55:20,243 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 03:55:20,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:00:27,464 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 04:00:27,465 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 04:00:27,465 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 04:00:40,285 INFO core: Event loop thread started, running loop forever
2026-09-09 04:00:40,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 04:00:40,589 INFO core: _init_accounts coroutine started
2026-09-09 04:00:40,590 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 04:00:40,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:05:14,390 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 04:05:14,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:10:48,441 INFO core: Event loop thread started, running loop forever
2026-09-09 04:10:48,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 04:10:48,747 INFO core: _init_accounts coroutine started
2026-09-09 04:10:48,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 04:10:48,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:15:19,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:20:18,517 INFO core: Event loop thread started, running loop forever
2026-09-09 04:20:18,818 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 04:20:18,824 INFO core: _init_accounts coroutine started
2026-09-09 04:20:18,825 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 04:20:18,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:20:26,527 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 04:20:26,528 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 04:20:26,528 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-09 04:20:26,529 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 04:20:26,529 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-09 04:20:26,529 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 04:20:26,529 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 04:20:26,529 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 04:20:26,529 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 04:25:08,843 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 04:25:08,843 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 04:25:08,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:30:14,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 04:30:14,397 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-09 04:30:14,398 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 04:30:14,398 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 04:30:14,398 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 04:30:14,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 04:30:29,451 INFO core: Event loop thread started, running loop forever
2026-09-09 04:30:29,752 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 04:30:29,757 INFO core: _init_accounts coroutine started
2026-09-09 04:30:29,759 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 04:30:29,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:35:48,429 INFO core: Event loop thread started, running loop forever
2026-09-09 04:35:48,730 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 04:35:48,738 INFO core: _init_accounts coroutine started
2026-09-09 04:35:48,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 04:35:48,742 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:40:37,395 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:45:38,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:50:34,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:55:40,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 04:55:50,465 INFO core: Event loop thread started, running loop forever
2026-09-09 04:55:50,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 04:55:50,771 INFO core: _init_accounts coroutine started
2026-09-09 04:55:50,772 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 04:55:50,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 04:55:50,783 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 04:55:50,783 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 05:00:43,022 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 05:00:43,028 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:05:26,282 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 05:05:26,307 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 05:05:26,307 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 05:05:26,316 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 05:05:26,317 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 05:05:26,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:10:33,408 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 05:10:33,409 WARNING core: Account 2: connect timed out after 35s
2026-09-09 05:10:33,409 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 05:10:33,410 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 05:10:33,410 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 05:10:33,411 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 05:10:33,412 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 05:10:41,696 INFO core: Event loop thread started, running loop forever
2026-09-09 05:10:41,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 05:10:42,000 INFO core: _init_accounts coroutine started
2026-09-09 05:10:42,002 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 05:10:42,010 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:15:22,903 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 05:15:22,904 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 05:15:22,905 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 05:15:22,908 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 05:15:22,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:20:29,873 INFO core: Event loop thread started, running loop forever
2026-09-09 05:20:30,178 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 05:20:30,182 INFO core: _init_accounts coroutine started
2026-09-09 05:20:30,184 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 05:20:30,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:25:24,382 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 05:25:24,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:30:10,949 INFO core: Event loop thread started, running loop forever
2026-09-09 05:30:11,251 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 05:30:11,256 INFO core: _init_accounts coroutine started
2026-09-09 05:30:11,257 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 05:30:11,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:35:17,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 05:35:26,180 INFO core: Event loop thread started, running loop forever
2026-09-09 05:35:26,481 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 05:35:26,486 INFO core: _init_accounts coroutine started
2026-09-09 05:35:26,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 05:35:26,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:40:33,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 05:40:50,842 INFO core: Event loop thread started, running loop forever
2026-09-09 05:40:51,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 05:40:51,146 INFO core: _init_accounts coroutine started
2026-09-09 05:40:51,148 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 05:40:51,157 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:45:22,395 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 05:45:22,410 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:50:49,084 INFO core: Event loop thread started, running loop forever
2026-09-09 05:50:49,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 05:50:49,388 INFO core: _init_accounts coroutine started
2026-09-09 05:50:49,389 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 05:50:49,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:55:39,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 05:55:39,120 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 05:55:39,125 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 06:00:06,902 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 06:00:06,959 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 06:00:06,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:05:19,490 INFO core: Event loop thread started, running loop forever
2026-09-09 06:05:19,792 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 06:05:19,796 INFO core: _init_accounts coroutine started
2026-09-09 06:05:19,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 06:05:19,812 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 06:05:19,812 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 06:05:19,814 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 06:05:19,815 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 06:05:19,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:05:19,833 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 06:05:19,834 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 06:10:50,748 INFO core: Event loop thread started, running loop forever
2026-09-09 06:10:51,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 06:10:51,053 INFO core: _init_accounts coroutine started
2026-09-09 06:10:51,053 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 06:10:51,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:15:25,246 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 06:15:25,260 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:20:29,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:25:38,867 INFO core: Event loop thread started, running loop forever
2026-09-09 06:25:39,168 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 06:25:39,171 INFO core: _init_accounts coroutine started
2026-09-09 06:25:39,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 06:25:39,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:30:22,225 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 06:30:22,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:35:23,105 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:40:40,641 INFO core: Event loop thread started, running loop forever
2026-09-09 06:40:40,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 06:40:40,946 INFO core: _init_accounts coroutine started
2026-09-09 06:40:40,946 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 06:40:40,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:45:36,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:50:04,986 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 06:50:04,987 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 06:50:04,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 06:55:11,370 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 06:55:40,747 INFO core: Event loop thread started, running loop forever
2026-09-09 06:55:41,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 06:55:41,054 INFO core: _init_accounts coroutine started
2026-09-09 06:55:41,054 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 06:55:41,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:00:26,848 INFO core: Event loop thread started, running loop forever
2026-09-09 07:00:27,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 07:00:27,163 INFO core: _init_accounts coroutine started
2026-09-09 07:00:27,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 07:00:27,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:05:34,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 07:05:38,996 INFO core: Event loop thread started, running loop forever
2026-09-09 07:05:39,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 07:05:39,301 INFO core: _init_accounts coroutine started
2026-09-09 07:05:39,303 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 07:05:39,308 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:10:15,841 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 07:10:15,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:10:15,841 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 07:15:21,389 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 07:15:25,998 INFO core: Event loop thread started, running loop forever
2026-09-09 07:15:26,299 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 07:15:26,302 INFO core: _init_accounts coroutine started
2026-09-09 07:15:26,305 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 07:15:26,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:20:09,444 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:20:09,445 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 07:25:08,759 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 07:25:08,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:25:08,779 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 07:30:48,217 INFO core: Event loop thread started, running loop forever
2026-09-09 07:30:48,518 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 07:30:48,522 INFO core: _init_accounts coroutine started
2026-09-09 07:30:48,524 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 07:30:48,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:35:16,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:40:22,428 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 07:40:31,415 INFO core: Event loop thread started, running loop forever
2026-09-09 07:40:31,716 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 07:40:31,720 INFO core: _init_accounts coroutine started
2026-09-09 07:40:31,721 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 07:40:31,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:45:02,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 07:45:29,587 INFO core: Event loop thread started, running loop forever
2026-09-09 07:45:29,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 07:45:29,894 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:50:36,192 INFO core: _init_accounts coroutine started
2026-09-09 07:50:36,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 07:50:36,193 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 07:50:36,204 INFO core: Event loop thread started, running loop forever
2026-09-09 07:50:36,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 07:50:36,509 INFO core: _init_accounts coroutine started
2026-09-09 07:50:36,510 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 07:50:36,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 07:55:06,023 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 07:55:06,023 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 07:55:06,032 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 07:55:06,038 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 07:55:06,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:00:26,008 INFO core: Event loop thread started, running loop forever
2026-09-09 08:00:26,310 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 08:00:26,313 INFO core: _init_accounts coroutine started
2026-09-09 08:00:26,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 08:00:26,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:05:18,776 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 08:05:18,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:05:18,777 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 08:10:05,242 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 08:10:05,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:15:12,407 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 08:15:12,408 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 08:15:12,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 08:15:12,428 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 08:15:12,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 08:15:38,985 INFO core: Event loop thread started, running loop forever
2026-09-09 08:15:39,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 08:15:39,290 INFO core: _init_accounts coroutine started
2026-09-09 08:15:39,291 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 08:15:39,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:20:38,370 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:25:18,958 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 08:25:18,958 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 08:25:18,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:25:18,963 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 08:30:25,440 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 08:30:25,440 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 08:30:25,441 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 08:30:25,441 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 08:30:39,371 INFO core: Event loop thread started, running loop forever
2026-09-09 08:30:39,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 08:30:39,678 INFO core: _init_accounts coroutine started
2026-09-09 08:30:39,678 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 08:30:39,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:35:12,622 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:40:18,430 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 08:40:47,657 INFO core: Event loop thread started, running loop forever
2026-09-09 08:40:47,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 08:40:47,962 INFO core: _init_accounts coroutine started
2026-09-09 08:40:47,963 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 08:40:47,972 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:45:29,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:45:29,907 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 08:45:29,907 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 08:50:25,274 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 08:50:25,279 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 08:50:25,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 08:55:32,431 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 08:55:50,472 INFO core: Event loop thread started, running loop forever
2026-09-09 08:55:50,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 08:55:50,776 INFO core: _init_accounts coroutine started
2026-09-09 08:55:50,779 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 08:55:50,786 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:00:42,308 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 09:00:42,308 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 09:00:42,308 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:00:42,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 09:05:05,762 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 09:05:05,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:10:05,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:15:31,440 INFO core: Event loop thread started, running loop forever
2026-09-09 09:15:31,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 09:15:31,745 INFO core: _init_accounts coroutine started
2026-09-09 09:15:31,747 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 09:15:31,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:20:44,152 INFO core: Event loop thread started, running loop forever
2026-09-09 09:20:44,453 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 09:20:44,456 INFO core: _init_accounts coroutine started
2026-09-09 09:20:44,459 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 09:20:44,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:25:06,347 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 09:25:06,350 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 09:25:06,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:30:18,502 INFO core: Event loop thread started, running loop forever
2026-09-09 09:30:18,803 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 09:30:18,806 INFO core: _init_accounts coroutine started
2026-09-09 09:30:18,807 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 09:30:18,814 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:35:49,061 INFO core: Event loop thread started, running loop forever
2026-09-09 09:35:49,368 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 09:35:49,373 INFO core: _init_accounts coroutine started
2026-09-09 09:35:49,376 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 09:35:49,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:40:26,310 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 09:40:26,310 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 09:40:26,311 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 09:40:26,312 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 09:40:26,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:45:33,388 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 09:45:42,185 INFO core: Event loop thread started, running loop forever
2026-09-09 09:45:42,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 09:45:42,489 INFO core: _init_accounts coroutine started
2026-09-09 09:45:42,491 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 09:45:42,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:50:12,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 09:50:12,096 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 09:50:12,097 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 09:55:19,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 09:55:19,404 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 09:55:19,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 09:55:19,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 09:55:19,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 09:55:28,941 INFO core: Event loop thread started, running loop forever
2026-09-09 09:55:29,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 09:55:29,245 INFO core: _init_accounts coroutine started
2026-09-09 09:55:29,247 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 09:55:29,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:00:03,357 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 10:00:21,910 INFO core: Event loop thread started, running loop forever
2026-09-09 10:00:22,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 10:00:22,214 INFO core: _init_accounts coroutine started
2026-09-09 10:00:22,215 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 10:00:22,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:00:22,226 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 10:00:22,226 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 10:00:22,227 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 10:00:22,229 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 10:05:35,106 INFO core: Event loop thread started, running loop forever
2026-09-09 10:05:35,407 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 10:05:35,411 INFO core: _init_accounts coroutine started
2026-09-09 10:05:35,411 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 10:05:35,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:10:30,100 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 10:10:30,100 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 10:10:30,104 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 10:10:30,106 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 10:10:30,116 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 10:10:30,116 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 10:10:30,119 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 10:10:30,120 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 10:10:30,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:15:14,874 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 10:15:14,875 WARNING core: Account 2: connect timed out after 35s
2026-09-09 10:15:14,876 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 10:15:14,876 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 10:15:14,877 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 10:15:14,878 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 10:15:14,879 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 10:15:14,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:20:20,399 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 10:20:20,400 WARNING core: Account 2: connect timed out after 35s
2026-09-09 10:20:51,942 INFO core: Event loop thread started, running loop forever
2026-09-09 10:20:52,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 10:20:52,246 INFO core: _init_accounts coroutine started
2026-09-09 10:20:52,247 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 10:20:52,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:25:45,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:30:40,820 INFO core: Event loop thread started, running loop forever
2026-09-09 10:30:41,121 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 10:30:41,125 INFO core: _init_accounts coroutine started
2026-09-09 10:30:41,129 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 10:30:41,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:35:40,248 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-09 10:35:40,252 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-09 10:40:32,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:45:44,053 INFO core: Event loop thread started, running loop forever
2026-09-09 10:45:44,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 10:45:44,359 INFO core: _init_accounts coroutine started
2026-09-09 10:45:44,361 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 10:45:44,368 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:50:21,929 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 10:50:21,930 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 10:50:21,931 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 10:50:21,932 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 10:50:21,938 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 10:55:23,905 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 10:55:23,906 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 10:55:23,909 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 10:55:23,910 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 10:55:23,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:00:04,666 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 11:00:04,667 WARNING core: Account 2: connect timed out after 35s
2026-09-09 11:00:04,668 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 11:00:04,669 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 11:00:04,670 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 11:00:04,671 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 11:00:04,672 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 11:00:04,865 INFO telethon.network.mtprotosender: Connection to 91.108.56.181:443/TcpAbridged complete!
2026-09-09 11:00:04,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:05:11,414 WARNING core: Account 2: connect timed out after 35s
2026-09-09 11:05:52,158 INFO core: Event loop thread started, running loop forever
2026-09-09 11:05:52,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 11:05:52,462 INFO core: _init_accounts coroutine started
2026-09-09 11:05:52,464 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 11:05:52,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:10:30,122 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 11:10:30,123 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 11:10:30,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:15:12,024 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 11:15:12,032 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 11:15:12,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:15:12,051 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 11:15:12,052 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 11:20:06,624 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 11:20:06,626 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 11:20:06,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:25:12,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 11:25:12,379 WARNING core: Account 2: connect timed out after 35s
2026-09-09 11:25:12,380 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 11:25:12,381 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 11:25:12,382 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 11:25:12,384 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 11:25:12,384 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 11:25:33,305 INFO core: Event loop thread started, running loop forever
2026-09-09 11:25:33,606 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 11:25:33,610 INFO core: _init_accounts coroutine started
2026-09-09 11:25:33,612 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 11:25:33,616 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:30:13,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:35:20,295 INFO core: Event loop thread started, running loop forever
2026-09-09 11:35:20,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 11:35:20,602 INFO core: _init_accounts coroutine started
2026-09-09 11:35:20,602 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 11:35:20,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:40:07,211 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 11:40:07,211 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 11:40:07,215 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 11:40:07,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:45:14,366 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 11:45:14,366 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 11:45:14,367 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 11:45:14,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 11:45:49,951 INFO core: Event loop thread started, running loop forever
2026-09-09 11:45:50,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 11:45:50,255 INFO core: _init_accounts coroutine started
2026-09-09 11:45:50,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 11:45:50,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:50:16,663 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 11:55:22,456 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 11:55:22,456 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 11:55:22,457 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-09 11:55:22,458 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 11:55:22,458 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-09 11:55:30,890 INFO core: Event loop thread started, running loop forever
2026-09-09 11:55:31,191 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 11:55:31,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:00:48,368 INFO core: Event loop thread started, running loop forever
2026-09-09 12:00:48,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 12:00:48,672 INFO core: _init_accounts coroutine started
2026-09-09 12:00:48,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 12:00:48,683 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 12:00:48,683 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 12:00:48,684 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 12:00:48,686 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 12:00:48,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:05:13,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:10:04,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:15:10,471 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 12:15:37,823 INFO core: Event loop thread started, running loop forever
2026-09-09 12:15:38,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 12:15:38,128 INFO core: _init_accounts coroutine started
2026-09-09 12:15:38,131 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 12:15:38,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:20:50,793 INFO core: Event loop thread started, running loop forever
2026-09-09 12:20:51,094 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 12:20:51,104 INFO core: _init_accounts coroutine started
2026-09-09 12:20:51,104 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 12:20:51,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:25:51,651 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 12:25:51,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:25:51,652 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 12:25:51,654 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 12:30:46,852 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 12:30:46,854 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:35:41,901 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:40:37,975 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:45:29,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:50:08,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 12:55:15,399 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 12:55:38,932 INFO core: Event loop thread started, running loop forever
2026-09-09 12:55:39,233 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 12:55:39,240 INFO core: _init_accounts coroutine started
2026-09-09 12:55:39,241 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 12:55:39,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:00:14,792 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 13:00:14,792 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 13:00:14,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:05:08,930 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 13:05:08,933 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 13:05:08,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:10:49,812 INFO core: Event loop thread started, running loop forever
2026-09-09 13:10:50,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 13:10:50,117 INFO core: _init_accounts coroutine started
2026-09-09 13:10:50,117 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 13:10:50,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:15:41,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:20:48,434 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 13:20:51,455 INFO core: Event loop thread started, running loop forever
2026-09-09 13:20:51,756 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 13:20:51,762 INFO core: _init_accounts coroutine started
2026-09-09 13:20:51,762 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 13:20:51,768 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:20:51,770 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 13:20:51,771 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 13:20:51,774 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 13:25:37,529 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 13:25:37,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:30:43,390 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 13:30:52,929 INFO core: Event loop thread started, running loop forever
2026-09-09 13:30:53,231 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 13:30:53,234 INFO core: _init_accounts coroutine started
2026-09-09 13:30:53,236 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 13:30:53,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:35:33,078 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 13:35:33,078 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 13:35:33,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:35:33,083 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 13:40:36,696 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 13:40:36,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:45:43,434 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 13:45:43,434 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 13:45:43,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 13:45:50,926 INFO core: Event loop thread started, running loop forever
2026-09-09 13:45:51,227 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 13:45:51,232 INFO core: _init_accounts coroutine started
2026-09-09 13:45:51,233 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 13:45:51,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:50:11,676 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 13:50:11,676 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 13:50:11,679 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 13:50:11,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 13:55:15,110 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 13:55:15,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:00:25,274 INFO core: Event loop thread started, running loop forever
2026-09-09 14:00:25,575 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:00:25,577 INFO core: _init_accounts coroutine started
2026-09-09 14:00:25,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:00:25,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:05:36,587 INFO core: Event loop thread started, running loop forever
2026-09-09 14:05:36,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:05:36,891 INFO core: _init_accounts coroutine started
2026-09-09 14:05:36,891 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:05:36,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:10:43,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 14:10:47,226 INFO core: Event loop thread started, running loop forever
2026-09-09 14:10:47,527 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:10:47,530 INFO core: _init_accounts coroutine started
2026-09-09 14:10:47,532 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:10:47,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:15:45,836 INFO core: Event loop thread started, running loop forever
2026-09-09 14:15:46,137 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:15:46,141 INFO core: _init_accounts coroutine started
2026-09-09 14:15:46,143 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:15:46,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:20:43,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:25:16,557 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 14:25:16,557 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 14:25:16,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:30:23,393 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 14:30:40,834 INFO core: Event loop thread started, running loop forever
2026-09-09 14:30:41,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:30:41,140 INFO core: _init_accounts coroutine started
2026-09-09 14:30:41,141 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:30:41,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:35:47,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 14:35:50,519 INFO core: Event loop thread started, running loop forever
2026-09-09 14:35:50,820 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:35:50,823 INFO core: _init_accounts coroutine started
2026-09-09 14:35:50,826 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:35:50,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:40:08,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:40:08,284 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 14:40:08,288 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 14:45:23,862 INFO core: Event loop thread started, running loop forever
2026-09-09 14:45:24,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:45:24,166 INFO core: _init_accounts coroutine started
2026-09-09 14:45:24,168 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:45:24,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:50:09,722 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 14:50:09,722 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 14:50:09,725 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 14:50:09,726 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 14:50:09,738 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 14:50:09,738 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 14:50:09,743 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 14:50:09,744 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 14:50:09,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 14:55:15,376 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 14:55:15,376 WARNING core: Account 2: connect timed out after 35s
2026-09-09 14:55:15,377 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 14:55:15,377 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 14:55:15,377 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 14:55:15,378 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 14:55:15,378 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 14:55:30,706 INFO core: Event loop thread started, running loop forever
2026-09-09 14:55:31,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 14:55:31,017 INFO core: _init_accounts coroutine started
2026-09-09 14:55:31,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 14:55:31,032 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 14:55:31,033 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 14:55:31,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:00:23,569 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 15:00:23,579 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 15:00:23,593 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:00:23,596 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 15:00:23,596 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 15:05:30,450 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 15:05:30,451 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 15:05:52,801 INFO core: Event loop thread started, running loop forever
2026-09-09 15:05:53,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 15:05:53,106 INFO core: _init_accounts coroutine started
2026-09-09 15:05:53,107 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 15:05:53,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:10:48,532 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 15:10:48,532 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 15:10:48,534 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 15:10:48,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:15:23,685 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 15:15:23,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:20:29,405 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 15:20:31,001 INFO core: Event loop thread started, running loop forever
2026-09-09 15:20:31,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 15:20:31,306 INFO core: _init_accounts coroutine started
2026-09-09 15:20:31,307 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 15:20:31,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:25:29,903 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 15:25:29,904 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 15:25:29,906 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 15:25:29,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:30:35,401 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 15:30:35,402 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 15:30:35,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 15:30:35,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 15:30:49,492 INFO core: Event loop thread started, running loop forever
2026-09-09 15:30:49,793 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 15:30:49,798 INFO core: _init_accounts coroutine started
2026-09-09 15:30:49,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 15:30:49,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:35:49,131 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:40:30,604 INFO core: Event loop thread started, running loop forever
2026-09-09 15:40:30,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 15:40:30,908 INFO core: _init_accounts coroutine started
2026-09-09 15:40:30,910 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 15:40:30,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:40:55,634 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 15:45:04,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:50:11,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 15:50:11,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 15:50:11,446 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-09 15:50:11,447 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 15:50:53,435 INFO core: Event loop thread started, running loop forever
2026-09-09 15:50:53,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 15:50:53,741 INFO core: _init_accounts coroutine started
2026-09-09 15:50:53,744 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 15:50:53,750 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 15:55:46,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:00:45,855 INFO core: Event loop thread started, running loop forever
2026-09-09 16:00:46,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 16:00:46,163 INFO core: _init_accounts coroutine started
2026-09-09 16:00:46,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 16:00:46,173 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-09 16:00:46,176 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-09 16:00:53,858 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 16:00:53,858 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 16:00:53,861 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 16:05:50,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:10:26,337 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-09 16:10:26,338 INFO core: _init_accounts coroutine started
2026-09-09 16:10:26,338 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 16:10:26,344 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 16:10:26,345 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 16:10:26,345 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 16:10:26,347 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 16:10:26,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:15:33,397 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 16:15:36,006 INFO core: Event loop thread started, running loop forever
2026-09-09 16:15:36,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 16:15:36,311 INFO core: _init_accounts coroutine started
2026-09-09 16:15:36,312 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 16:15:36,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:20:43,382 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 16:20:47,300 INFO core: Event loop thread started, running loop forever
2026-09-09 16:20:47,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 16:20:47,606 INFO core: _init_accounts coroutine started
2026-09-09 16:20:47,607 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 16:20:47,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:20:47,619 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 16:20:47,620 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 16:25:19,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:25:19,836 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 16:30:06,377 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 16:30:53,419 INFO core: Event loop thread started, running loop forever
2026-09-09 16:30:53,720 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 16:30:53,724 INFO core: _init_accounts coroutine started
2026-09-09 16:30:53,725 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 16:30:53,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:35:26,829 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 16:35:26,830 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 16:35:26,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:35:26,831 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 16:35:26,833 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 16:40:06,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:45:13,392 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 16:45:38,536 INFO core: Event loop thread started, running loop forever
2026-09-09 16:45:38,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 16:45:38,841 INFO core: _init_accounts coroutine started
2026-09-09 16:45:38,843 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 16:45:38,847 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:50:06,031 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 16:55:28,214 INFO core: Event loop thread started, running loop forever
2026-09-09 16:55:28,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 16:55:28,519 INFO core: _init_accounts coroutine started
2026-09-09 16:55:28,520 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 16:55:28,527 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:00:35,369 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 17:00:47,514 INFO core: Event loop thread started, running loop forever
2026-09-09 17:00:47,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 17:00:47,817 INFO core: _init_accounts coroutine started
2026-09-09 17:00:47,818 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 17:00:47,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:05:03,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 17:05:03,393 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 17:05:03,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:10:10,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 17:10:36,981 INFO core: Event loop thread started, running loop forever
2026-09-09 17:10:37,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 17:10:37,286 INFO core: _init_accounts coroutine started
2026-09-09 17:10:37,288 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 17:10:37,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:15:39,641 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 17:15:39,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:20:16,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:25:03,310 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-09 17:25:03,312 INFO core: _init_accounts coroutine started
2026-09-09 17:25:03,313 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 17:25:03,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:30:10,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 17:30:11,144 INFO core: Event loop thread started, running loop forever
2026-09-09 17:30:11,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 17:30:11,448 INFO core: _init_accounts coroutine started
2026-09-09 17:30:11,449 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 17:30:11,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:35:18,455 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 17:35:20,852 INFO core: Event loop thread started, running loop forever
2026-09-09 17:35:21,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 17:35:21,156 INFO core: _init_accounts coroutine started
2026-09-09 17:35:21,158 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 17:35:21,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:40:12,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:40:12,444 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 17:40:12,447 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 17:45:11,641 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 17:45:11,645 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:50:21,212 INFO core: Event loop thread started, running loop forever
2026-09-09 17:50:21,513 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 17:50:21,516 INFO core: _init_accounts coroutine started
2026-09-09 17:50:21,518 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 17:50:21,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 17:55:03,928 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 17:55:03,929 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 17:55:03,930 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:00:10,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 18:00:10,420 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-09 18:00:10,420 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 18:00:10,420 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-09 18:00:10,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 18:00:10,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 18:00:39,235 INFO core: Event loop thread started, running loop forever
2026-09-09 18:00:39,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 18:00:39,543 INFO core: _init_accounts coroutine started
2026-09-09 18:00:39,544 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 18:00:39,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:05:23,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:05:23,582 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 18:10:19,765 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:15:08,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:20:44,248 INFO core: Event loop thread started, running loop forever
2026-09-09 18:20:44,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 18:20:44,555 INFO core: _init_accounts coroutine started
2026-09-09 18:20:44,557 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 18:20:44,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:25:10,816 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 18:25:10,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:30:06,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:35:24,395 INFO core: Event loop thread started, running loop forever
2026-09-09 18:35:24,696 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 18:35:24,700 INFO core: _init_accounts coroutine started
2026-09-09 18:35:24,702 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 18:35:24,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:40:31,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 18:40:37,423 INFO core: Event loop thread started, running loop forever
2026-09-09 18:40:37,724 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 18:40:37,728 INFO core: _init_accounts coroutine started
2026-09-09 18:40:37,730 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 18:40:37,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:45:51,383 INFO core: Event loop thread started, running loop forever
2026-09-09 18:45:51,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 18:45:51,688 INFO core: _init_accounts coroutine started
2026-09-09 18:45:51,690 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 18:45:51,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:50:49,259 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 18:50:49,259 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 18:50:49,260 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 18:50:49,261 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 18:50:49,270 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 18:50:49,270 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 18:50:49,274 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 18:50:49,274 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 18:50:49,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 18:55:43,591 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 18:55:43,592 WARNING core: Account 2: connect timed out after 35s
2026-09-09 18:55:43,592 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 18:55:43,593 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 18:55:43,593 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 18:55:43,594 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 18:55:43,595 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 18:55:43,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:00:43,676 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 19:00:43,677 WARNING core: Account 2: connect timed out after 35s
2026-09-09 19:00:43,678 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-09 19:00:43,678 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-09 19:00:43,679 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 19:00:43,680 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-09 19:00:43,681 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-09 19:00:43,683 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:05:29,465 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 19:05:29,466 WARNING core: Account 2: connect timed out after 35s
2026-09-09 19:05:29,466 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-09 19:05:29,466 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-09 19:05:29,466 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 19:05:29,467 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-09 19:05:29,468 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-09 19:05:29,496 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:10:36,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 19:10:36,418 WARNING core: Account 2: connect timed out after 35s
2026-09-09 19:10:36,418 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-09 19:10:36,418 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-09 19:10:36,419 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 19:10:36,419 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-09-09 19:10:36,420 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-09-09 19:10:44,077 INFO core: Event loop thread started, running loop forever
2026-09-09 19:10:44,378 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 19:10:44,381 INFO core: _init_accounts coroutine started
2026-09-09 19:10:44,382 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 19:10:44,389 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:15:47,559 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:20:27,298 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 19:20:27,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:25:19,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:30:21,505 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-09 19:30:21,506 INFO core: _init_accounts coroutine started
2026-09-09 19:30:21,506 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 19:30:21,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:35:44,420 INFO core: Event loop thread started, running loop forever
2026-09-09 19:35:44,721 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 19:35:44,726 INFO core: _init_accounts coroutine started
2026-09-09 19:35:44,727 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 19:35:44,736 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:40:34,197 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:45:40,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 19:45:47,121 INFO core: Event loop thread started, running loop forever
2026-09-09 19:45:47,422 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 19:45:47,426 INFO core: _init_accounts coroutine started
2026-09-09 19:45:47,428 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 19:45:47,433 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:50:33,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:55:19,545 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 19:55:19,546 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 19:55:19,549 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 19:55:19,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 19:55:19,552 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 20:00:25,407 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-09 20:00:25,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 20:00:25,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 20:00:46,690 INFO core: Event loop thread started, running loop forever
2026-09-09 20:00:46,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 20:00:46,996 INFO core: _init_accounts coroutine started
2026-09-09 20:00:46,996 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 20:00:47,021 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 20:00:47,021 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 20:00:47,022 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 20:00:47,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:00:47,028 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 20:05:41,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:10:44,999 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 20:10:44,999 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 20:10:45,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:10:45,007 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 20:10:45,008 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 20:15:09,648 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 20:15:09,648 WARNING core: Account 2: connect timed out after 35s
2026-09-09 20:15:09,649 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 20:15:09,649 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 20:15:09,651 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 20:15:09,652 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 20:15:09,652 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 20:15:09,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:20:14,681 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 20:20:14,681 WARNING core: Account 2: connect timed out after 35s
2026-09-09 20:20:14,682 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-09 20:20:14,682 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-09 20:20:14,683 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 20:20:14,683 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-09 20:20:14,684 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-09 20:20:14,686 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:25:11,868 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 20:25:11,871 WARNING core: Account 2: connect timed out after 35s
2026-09-09 20:25:11,872 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-09 20:25:11,872 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-09 20:25:11,873 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 20:25:11,875 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-09 20:25:11,875 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-09 20:25:11,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:30:07,797 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 20:30:07,798 WARNING core: Account 2: connect timed out after 35s
2026-09-09 20:30:07,798 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-09 20:30:07,798 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-09 20:30:07,799 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 20:30:07,800 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-09-09 20:30:07,800 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-09-09 20:30:07,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:35:07,969 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 20:35:07,970 WARNING core: Account 2: connect timed out after 35s
2026-09-09 20:35:07,970 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.187:443/TcpAbridged...
2026-09-09 20:35:07,970 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.187:443/TcpAbridged complete!
2026-09-09 20:35:07,971 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 20:35:07,971 WARNING core: Account 2: exhausted all Telegram server candidates
2026-09-09 20:35:07,975 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-09-09 20:35:07,975 INFO core: Signal processor started
2026-09-09 20:35:07,975 INFO core: Initialized 0 account(s), 1 pair(s)
2026-09-09 20:35:07,976 INFO core: Memory RSS: 90.78 MB
2026-09-09 20:35:07,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:40:03,957 INFO core: Memory RSS: 90.78 MB
2026-09-09 20:40:03,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:45:03,048 INFO core: Watchdog: connecting missing account 2
2026-09-09 20:45:03,053 INFO core: Memory RSS: 90.89 MB
2026-09-09 20:45:03,055 INFO core: Loaded 1 enabled pair(s) across 1 account(s)
2026-09-09 20:45:03,061 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 20:45:03,061 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 20:45:03,077 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-09 20:45:03,078 INFO core: _init_accounts coroutine started
2026-09-09 20:45:03,078 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 20:45:03,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:50:09,400 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 20:50:09,401 ERROR core: pairs sync error: cannot schedule new futures after shutdown
2026-09-09 20:50:09,403 WARNING core: Account 2: connect timed out after 35s
2026-09-09 20:50:09,403 INFO core: Memory RSS: 90.95 MB
2026-09-09 20:50:09,404 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 20:50:09,404 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 20:50:09,404 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 20:50:09,405 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 20:50:09,405 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 20:50:46,850 INFO core: Event loop thread started, running loop forever
2026-09-09 20:50:47,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 20:50:47,154 INFO core: _init_accounts coroutine started
2026-09-09 20:50:47,157 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 20:50:47,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 20:55:22,798 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 20:55:22,798 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 20:55:22,804 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 20:55:22,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:00:29,393 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 21:00:34,641 INFO core: Event loop thread started, running loop forever
2026-09-09 21:00:34,942 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 21:00:34,946 INFO core: _init_accounts coroutine started
2026-09-09 21:00:34,947 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 21:00:34,956 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 21:00:34,957 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 21:00:34,958 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 21:00:34,959 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 21:00:34,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:05:41,748 INFO core: Event loop thread started, running loop forever
2026-09-09 21:05:42,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 21:05:42,052 INFO core: _init_accounts coroutine started
2026-09-09 21:05:42,053 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 21:05:42,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:10:17,472 INFO core: Event loop thread started, running loop forever
2026-09-09 21:10:17,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 21:10:17,779 INFO core: _init_accounts coroutine started
2026-09-09 21:10:17,779 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 21:10:17,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:15:34,686 INFO core: Event loop thread started, running loop forever
2026-09-09 21:15:34,986 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 21:15:34,991 INFO core: _init_accounts coroutine started
2026-09-09 21:15:34,991 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 21:15:34,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:20:23,339 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 21:20:23,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:25:28,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:30:26,180 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-09 21:30:26,181 INFO core: _init_accounts coroutine started
2026-09-09 21:30:26,182 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 21:30:26,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:35:07,160 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 21:35:07,162 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 21:35:07,165 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 21:35:07,167 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 21:35:07,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:40:14,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 21:40:16,373 INFO core: Event loop thread started, running loop forever
2026-09-09 21:40:16,674 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 21:40:16,678 INFO core: _init_accounts coroutine started
2026-09-09 21:40:16,678 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 21:40:16,688 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 21:40:16,688 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 21:40:16,689 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 21:40:16,691 INFO core: _init_accounts_inner: reloading LLM config
2026-09-09 21:40:16,702 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-09 21:40:16,702 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-09 21:40:16,706 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-09 21:40:16,707 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-09 21:40:16,716 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:45:10,406 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 21:45:10,406 WARNING core: Account 2: connect timed out after 35s
2026-09-09 21:45:10,407 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-09 21:45:10,407 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-09 21:45:10,408 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 21:45:10,408 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-09 21:45:10,409 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-09 21:45:10,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:50:17,351 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-09 21:50:17,352 WARNING core: Account 2: connect timed out after 35s
2026-09-09 21:50:17,353 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-09 21:50:17,353 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-09 21:50:17,353 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-09 21:50:17,356 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-09 21:50:17,357 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-09 21:50:46,457 INFO core: Event loop thread started, running loop forever
2026-09-09 21:50:46,758 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 21:50:46,761 INFO core: _init_accounts coroutine started
2026-09-09 21:50:46,763 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 21:50:46,771 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 21:55:04,294 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 21:55:04,295 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 21:55:04,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:00:11,399 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 22:00:21,753 INFO core: Event loop thread started, running loop forever
2026-09-09 22:00:22,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:00:22,058 INFO core: _init_accounts coroutine started
2026-09-09 22:00:22,059 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:00:22,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:05:21,587 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 22:05:21,602 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:10:28,301 INFO core: Event loop thread started, running loop forever
2026-09-09 22:10:28,602 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:10:28,606 INFO core: _init_accounts coroutine started
2026-09-09 22:10:28,607 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:10:28,615 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:15:07,206 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 22:15:45,584 INFO core: Event loop thread started, running loop forever
2026-09-09 22:15:45,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:15:45,888 INFO core: _init_accounts coroutine started
2026-09-09 22:15:45,889 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:15:45,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:20:45,975 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:25:09,270 INFO core: Event loop thread started, running loop forever
2026-09-09 22:25:09,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:25:09,579 INFO core: _init_accounts coroutine started
2026-09-09 22:25:09,580 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:25:09,588 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:25:52,314 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-09 22:30:05,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:35:11,952 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 22:35:11,959 INFO core: Event loop thread started, running loop forever
2026-09-09 22:35:12,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:35:12,264 INFO core: _init_accounts coroutine started
2026-09-09 22:35:12,266 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:35:12,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:40:19,384 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 22:40:22,642 INFO core: Event loop thread started, running loop forever
2026-09-09 22:40:22,945 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:40:22,948 INFO core: _init_accounts coroutine started
2026-09-09 22:40:22,949 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:40:22,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:45:06,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:50:12,413 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 22:50:20,801 INFO core: Event loop thread started, running loop forever
2026-09-09 22:50:21,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:50:21,117 INFO core: _init_accounts coroutine started
2026-09-09 22:50:21,118 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:50:21,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 22:55:48,800 INFO core: Event loop thread started, running loop forever
2026-09-09 22:55:49,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 22:55:49,111 INFO core: _init_accounts coroutine started
2026-09-09 22:55:49,111 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 22:55:49,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:00:53,068 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 23:00:53,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:05:49,930 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:10:10,440 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-09 23:10:10,441 INFO core: _init_accounts coroutine started
2026-09-09 23:10:10,441 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 23:10:10,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:15:24,501 INFO core: Event loop thread started, running loop forever
2026-09-09 23:15:24,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 23:15:24,808 INFO core: _init_accounts coroutine started
2026-09-09 23:15:24,809 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 23:15:24,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:20:31,360 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 23:20:48,782 INFO core: Event loop thread started, running loop forever
2026-09-09 23:20:49,083 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 23:20:49,089 INFO core: _init_accounts coroutine started
2026-09-09 23:20:49,090 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 23:20:49,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:25:20,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:30:27,417 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-09 23:30:46,505 INFO core: Event loop thread started, running loop forever
2026-09-09 23:30:46,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 23:30:46,811 INFO core: _init_accounts coroutine started
2026-09-09 23:30:46,812 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 23:30:46,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:35:33,498 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-09 23:35:33,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-09 23:35:33,500 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-09 23:35:33,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:40:04,615 INFO core: Event loop thread started, running loop forever
2026-09-09 23:40:04,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 23:40:04,921 INFO core: _init_accounts coroutine started
2026-09-09 23:40:04,923 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 23:40:04,942 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:45:11,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-09 23:45:49,157 INFO core: Event loop thread started, running loop forever
2026-09-09 23:45:49,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 23:45:49,464 INFO core: _init_accounts coroutine started
2026-09-09 23:45:49,465 INFO core: _init_accounts_inner: starting DB migrations
2026-09-09 23:45:49,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:50:22,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-09 23:55:48,472 INFO core: Event loop thread started, running loop forever
2026-09-09 23:55:48,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-09 23:55:48,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:00:19,756 INFO core: _init_accounts coroutine started
2026-09-10 00:00:19,756 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 00:00:19,768 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:05:06,653 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 00:05:06,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:10:46,562 INFO core: Event loop thread started, running loop forever
2026-09-10 00:10:46,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 00:10:46,869 INFO core: _init_accounts coroutine started
2026-09-10 00:10:46,869 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 00:10:46,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:15:49,359 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 00:15:49,359 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 00:15:49,360 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 00:15:49,361 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 00:15:49,369 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 00:15:49,369 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 00:15:49,373 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 00:15:49,374 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 00:15:49,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:20:37,201 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 00:20:37,203 WARNING core: Account 2: connect timed out after 35s
2026-09-10 00:20:37,204 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 00:20:37,204 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 00:20:37,205 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 00:20:37,206 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 00:20:37,206 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 00:20:37,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:25:14,960 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 00:25:14,961 WARNING core: Account 2: connect timed out after 35s
2026-09-10 00:25:14,962 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-10 00:25:14,962 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-10 00:25:14,963 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 00:25:14,965 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-10 00:25:14,965 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-10 00:25:14,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:30:20,439 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 00:30:20,439 WARNING core: Account 2: connect timed out after 35s
2026-09-10 00:30:34,413 INFO core: Event loop thread started, running loop forever
2026-09-10 00:30:34,714 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 00:30:34,718 INFO core: _init_accounts coroutine started
2026-09-10 00:30:34,720 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 00:30:34,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:35:11,442 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 00:35:11,442 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 00:35:11,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 00:35:11,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:35:11,446 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 00:40:10,517 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:45:17,411 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 00:45:17,411 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 00:45:17,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 00:45:19,043 INFO core: Event loop thread started, running loop forever
2026-09-10 00:45:19,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 00:45:19,350 INFO core: _init_accounts coroutine started
2026-09-10 00:45:19,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 00:45:19,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:50:16,829 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 00:50:16,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:55:49,708 INFO core: Event loop thread started, running loop forever
2026-09-10 00:55:50,009 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 00:55:50,013 INFO core: _init_accounts coroutine started
2026-09-10 00:55:50,015 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 00:55:50,028 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 00:55:50,029 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 00:55:50,031 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 01:00:09,162 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 01:00:09,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:05:05,606 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 01:05:05,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:10:38,682 INFO core: Event loop thread started, running loop forever
2026-09-10 01:10:38,984 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 01:10:38,999 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:15:18,524 INFO core: _init_accounts coroutine started
2026-09-10 01:15:18,524 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 01:15:18,534 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 01:15:18,534 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 01:15:18,535 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 01:15:18,537 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 01:15:18,546 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 01:15:18,547 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 01:15:18,551 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:15:18,554 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 01:20:08,299 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 01:20:08,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:25:15,422 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 01:25:15,422 WARNING core: Account 2: connect timed out after 35s
2026-09-10 01:25:15,423 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 01:25:15,423 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 01:25:15,424 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 01:25:15,425 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 01:25:15,425 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 01:25:35,981 INFO core: Event loop thread started, running loop forever
2026-09-10 01:25:36,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 01:25:36,286 INFO core: _init_accounts coroutine started
2026-09-10 01:25:36,288 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 01:25:36,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:30:13,505 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 01:30:13,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:35:36,281 INFO core: Event loop thread started, running loop forever
2026-09-10 01:35:36,583 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 01:35:36,587 INFO core: _init_accounts coroutine started
2026-09-10 01:35:36,588 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 01:35:36,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:40:38,713 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 01:40:38,718 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:45:47,302 INFO core: Event loop thread started, running loop forever
2026-09-10 01:45:47,603 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 01:45:47,607 INFO core: _init_accounts coroutine started
2026-09-10 01:45:47,608 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 01:45:47,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:50:38,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 01:55:10,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:00:10,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 02:00:10,485 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 02:00:10,489 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 02:00:10,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:00:10,491 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 02:05:29,098 INFO core: Event loop thread started, running loop forever
2026-09-10 02:05:29,401 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 02:05:29,407 INFO core: _init_accounts coroutine started
2026-09-10 02:05:29,407 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 02:05:29,413 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:10:30,266 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 02:10:30,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:15:38,730 INFO core: Event loop thread started, running loop forever
2026-09-10 02:15:39,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 02:15:39,036 INFO core: _init_accounts coroutine started
2026-09-10 02:15:39,043 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 02:15:39,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:20:35,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:20:35,304 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 02:20:35,305 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 02:25:04,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:30:11,743 INFO core: Event loop thread started, running loop forever
2026-09-10 02:30:12,044 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 02:30:12,054 INFO core: _init_accounts coroutine started
2026-09-10 02:30:12,055 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 02:30:12,061 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:35:51,075 INFO core: Event loop thread started, running loop forever
2026-09-10 02:35:51,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 02:35:51,380 INFO core: _init_accounts coroutine started
2026-09-10 02:35:51,382 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 02:35:51,390 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:40:18,358 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 02:40:18,358 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 02:40:18,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 02:40:18,367 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 02:40:18,370 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:45:25,441 INFO core: Event loop thread started, running loop forever
2026-09-10 02:45:25,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 02:45:25,749 INFO core: _init_accounts coroutine started
2026-09-10 02:45:25,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 02:45:25,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 02:45:25,759 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-10 02:50:07,454 INFO core: Event loop thread started, running loop forever
2026-09-10 02:50:07,755 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 02:50:07,758 INFO core: _init_accounts coroutine started
2026-09-10 02:50:07,759 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 02:50:07,768 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-10 02:55:08,517 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:00:25,245 INFO core: Event loop thread started, running loop forever
2026-09-10 03:00:25,545 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 03:00:25,549 INFO core: _init_accounts coroutine started
2026-09-10 03:00:25,551 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 03:00:25,559 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 03:00:25,559 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 03:00:25,560 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 03:00:25,561 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 03:00:25,572 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 03:00:25,572 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 03:00:25,577 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 03:00:25,577 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 03:00:25,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:05:33,966 INFO core: Event loop thread started, running loop forever
2026-09-10 03:05:34,267 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 03:05:34,270 INFO core: _init_accounts coroutine started
2026-09-10 03:05:34,272 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 03:05:34,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:10:38,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 03:10:38,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 03:10:38,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 03:10:38,441 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 03:10:38,451 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 03:10:38,451 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 03:10:38,456 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 03:10:38,457 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 03:10:38,460 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:15:39,791 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 03:15:39,793 WARNING core: Account 2: connect timed out after 35s
2026-09-10 03:15:39,793 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 03:15:39,794 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 03:15:39,795 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 03:15:39,797 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 03:15:39,797 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 03:15:39,816 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:20:11,819 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 03:20:11,821 WARNING core: Account 2: connect timed out after 35s
2026-09-10 03:20:11,822 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-10 03:20:11,822 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-10 03:20:11,823 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 03:20:11,824 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-10 03:20:11,825 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-10 03:20:11,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:25:09,060 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 03:25:09,060 WARNING core: Account 2: connect timed out after 35s
2026-09-10 03:25:09,061 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-10 03:25:09,061 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-10 03:25:09,062 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 03:25:09,063 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-10 03:25:09,063 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-10 03:25:09,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:30:16,498 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 03:30:22,339 INFO core: Event loop thread started, running loop forever
2026-09-10 03:30:22,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 03:30:22,648 INFO core: _init_accounts coroutine started
2026-09-10 03:30:22,649 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 03:30:22,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:35:20,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:40:45,382 INFO core: Event loop thread started, running loop forever
2026-09-10 03:40:45,683 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 03:40:45,689 INFO core: _init_accounts coroutine started
2026-09-10 03:40:45,691 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 03:40:45,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:45:03,357 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 03:45:46,351 INFO core: Event loop thread started, running loop forever
2026-09-10 03:45:46,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 03:45:46,656 INFO core: _init_accounts coroutine started
2026-09-10 03:45:46,656 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 03:45:46,661 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:50:41,672 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 03:50:41,673 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 03:50:41,675 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 03:50:41,677 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 03:50:41,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:55:31,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 03:55:31,610 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 03:55:31,610 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 03:55:31,615 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 03:55:31,616 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 04:00:08,330 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 04:00:08,332 WARNING core: Account 2: connect timed out after 35s
2026-09-10 04:00:08,333 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 04:00:08,333 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 04:00:08,334 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 04:00:08,335 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 04:00:08,336 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 04:00:08,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:05:13,439 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 04:05:13,443 WARNING core: Account 2: connect timed out after 35s
2026-09-10 04:05:13,443 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-10 04:05:13,443 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-10 04:05:13,444 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 04:05:13,445 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-10 04:05:13,445 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-10 04:05:13,453 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:10:20,379 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 04:10:20,380 WARNING core: Account 2: connect timed out after 35s
2026-09-10 04:10:20,381 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-10 04:10:20,381 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-10 04:10:20,382 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 04:10:20,383 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-10 04:10:20,383 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-10 04:10:36,043 INFO core: Event loop thread started, running loop forever
2026-09-10 04:10:36,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 04:10:36,348 INFO core: _init_accounts coroutine started
2026-09-10 04:10:36,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 04:10:36,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:15:19,316 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:20:06,638 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 04:20:06,639 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 04:20:06,643 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 04:20:06,644 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 04:20:06,660 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 04:20:06,660 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 04:20:06,665 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 04:20:06,665 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 04:20:06,675 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:25:12,403 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 04:25:14,236 INFO core: Event loop thread started, running loop forever
2026-09-10 04:25:14,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 04:25:14,545 INFO core: _init_accounts coroutine started
2026-09-10 04:25:14,546 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 04:25:14,555 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:25:14,563 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 04:25:14,563 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 04:30:21,383 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 04:30:21,384 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-10 04:30:49,756 INFO core: Event loop thread started, running loop forever
2026-09-10 04:30:50,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 04:30:50,068 INFO core: _init_accounts coroutine started
2026-09-10 04:30:50,069 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 04:30:50,076 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:35:51,232 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:40:16,724 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 04:40:16,724 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 04:40:16,729 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 04:40:16,731 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 04:40:16,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:45:22,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 04:45:41,892 INFO core: Event loop thread started, running loop forever
2026-09-10 04:45:42,193 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 04:45:42,197 INFO core: _init_accounts coroutine started
2026-09-10 04:45:42,199 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 04:45:42,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:50:35,200 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 04:50:35,201 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 04:50:35,203 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 04:50:35,204 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 04:55:24,533 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 04:55:24,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:00:31,425 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 05:00:31,425 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 05:00:31,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 05:00:52,788 INFO core: Event loop thread started, running loop forever
2026-09-10 05:00:53,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 05:00:53,093 INFO core: _init_accounts coroutine started
2026-09-10 05:00:53,096 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 05:00:53,105 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 05:00:53,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 05:00:53,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 05:00:53,108 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 05:00:53,119 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 05:00:53,119 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 05:00:53,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:05:12,275 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 05:05:12,276 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 05:05:12,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:10:26,425 INFO core: Event loop thread started, running loop forever
2026-09-10 05:10:26,726 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 05:10:26,732 INFO core: _init_accounts coroutine started
2026-09-10 05:10:26,732 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 05:10:26,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:15:43,746 INFO core: Event loop thread started, running loop forever
2026-09-10 05:15:44,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 05:15:44,052 INFO core: _init_accounts coroutine started
2026-09-10 05:15:44,054 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 05:15:44,062 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 05:15:44,062 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 05:15:44,064 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 05:15:44,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:15:44,067 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 05:20:48,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:25:21,145 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:30:37,426 INFO core: Event loop thread started, running loop forever
2026-09-10 05:30:37,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 05:30:37,731 INFO core: _init_accounts coroutine started
2026-09-10 05:30:37,733 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 05:30:37,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:35:36,395 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:40:19,683 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 05:40:19,684 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 05:40:19,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:45:26,408 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 05:45:46,641 INFO core: Event loop thread started, running loop forever
2026-09-10 05:45:46,943 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 05:45:46,952 INFO core: _init_accounts coroutine started
2026-09-10 05:45:46,953 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 05:45:46,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:50:36,606 INFO core: Event loop thread started, running loop forever
2026-09-10 05:50:36,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 05:50:36,910 INFO core: _init_accounts coroutine started
2026-09-10 05:50:36,912 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 05:50:36,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:55:06,287 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 05:55:06,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 05:55:06,292 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 06:00:04,410 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 06:00:04,423 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-10 06:00:14,855 INFO core: Event loop thread started, running loop forever
2026-09-10 06:00:15,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 06:00:15,159 INFO core: _init_accounts coroutine started
2026-09-10 06:00:15,160 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 06:00:15,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:05:21,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 06:05:45,276 INFO core: Event loop thread started, running loop forever
2026-09-10 06:05:45,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 06:05:45,588 INFO core: _init_accounts coroutine started
2026-09-10 06:05:45,590 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 06:05:45,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:10:25,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:15:31,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 06:15:37,959 INFO core: Event loop thread started, running loop forever
2026-09-10 06:15:38,261 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 06:15:38,267 INFO core: _init_accounts coroutine started
2026-09-10 06:15:38,267 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 06:15:38,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:20:15,192 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:25:22,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 06:25:28,906 INFO core: Event loop thread started, running loop forever
2026-09-10 06:25:29,207 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 06:25:29,211 INFO core: _init_accounts coroutine started
2026-09-10 06:25:29,212 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 06:25:29,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:30:45,465 INFO core: Event loop thread started, running loop forever
2026-09-10 06:30:45,766 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 06:30:45,770 INFO core: _init_accounts coroutine started
2026-09-10 06:30:45,771 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 06:30:45,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:35:27,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:40:18,550 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 06:40:18,551 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 06:40:18,552 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 06:40:18,554 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 06:40:18,565 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 06:40:18,566 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 06:40:18,570 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 06:40:18,571 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 06:40:18,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:45:07,594 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 06:45:07,595 WARNING core: Account 2: connect timed out after 35s
2026-09-10 06:45:07,596 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 06:45:07,596 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 06:45:07,597 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 06:45:07,598 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 06:45:07,599 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 06:45:07,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 06:50:14,014 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 06:50:14,016 WARNING core: Account 2: connect timed out after 35s
2026-09-10 06:50:14,016 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-10 06:50:14,017 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-10 06:50:14,017 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 06:50:14,018 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-10 06:50:14,018 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-10 06:50:14,024 INFO core: Event loop thread started, running loop forever
2026-09-10 06:50:14,325 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 06:50:14,328 INFO core: _init_accounts coroutine started
2026-09-10 06:50:14,329 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 06:50:14,339 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-10 06:50:14,339 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-10 06:55:12,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:00:15,216 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-10 07:00:15,217 INFO core: _init_accounts coroutine started
2026-09-10 07:00:15,217 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 07:00:15,223 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 07:00:15,223 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 07:00:15,224 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 07:00:15,226 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 07:00:15,235 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 07:00:15,235 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 07:00:15,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:05:04,921 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 07:05:04,922 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 07:05:04,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:10:10,445 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 07:10:10,446 WARNING core: Account 2: connect timed out after 35s
2026-09-10 07:10:13,969 INFO core: Event loop thread started, running loop forever
2026-09-10 07:10:14,270 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 07:10:14,276 INFO core: _init_accounts coroutine started
2026-09-10 07:10:14,277 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 07:10:14,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:15:09,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:20:12,255 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 07:20:12,256 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 07:20:12,257 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:25:18,460 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 07:25:18,460 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-10 07:25:18,461 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 07:25:18,461 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-10 07:25:18,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 07:25:18,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 07:25:51,845 INFO core: Event loop thread started, running loop forever
2026-09-10 07:25:52,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 07:25:52,149 INFO core: _init_accounts coroutine started
2026-09-10 07:25:52,151 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 07:25:52,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:30:53,861 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 07:30:53,861 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 07:30:53,862 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 07:30:53,863 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 07:30:53,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:35:45,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:40:36,377 INFO core: Event loop thread started, running loop forever
2026-09-10 07:40:36,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 07:40:36,683 INFO core: _init_accounts coroutine started
2026-09-10 07:40:36,685 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 07:40:36,691 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-10 07:40:36,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:45:50,869 INFO core: Event loop thread started, running loop forever
2026-09-10 07:45:51,170 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 07:45:51,174 INFO core: _init_accounts coroutine started
2026-09-10 07:45:51,176 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 07:45:51,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:45:51,184 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 07:50:04,399 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 07:50:04,406 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 07:50:04,407 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 07:50:04,418 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 07:50:04,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 07:50:04,422 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 07:50:04,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 07:50:04,425 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 07:55:11,370 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 07:55:11,373 WARNING core: Account 2: connect timed out after 35s
2026-09-10 07:55:24,623 INFO core: Event loop thread started, running loop forever
2026-09-10 07:55:24,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 07:55:24,927 INFO core: _init_accounts coroutine started
2026-09-10 07:55:24,929 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 07:55:24,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:00:17,183 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 08:00:17,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:05:25,629 INFO core: Event loop thread started, running loop forever
2026-09-10 08:05:25,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 08:05:25,935 INFO core: _init_accounts coroutine started
2026-09-10 08:05:25,936 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 08:05:25,944 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:10:18,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:15:03,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 08:15:03,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 08:15:03,412 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-10 08:15:03,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 08:15:03,414 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-10 08:15:40,216 INFO core: Event loop thread started, running loop forever
2026-09-10 08:15:40,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 08:15:40,520 INFO core: _init_accounts coroutine started
2026-09-10 08:15:40,521 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 08:15:40,527 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:20:25,988 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 08:20:25,990 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 08:20:25,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:25:17,925 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 08:25:17,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:25:17,930 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 08:30:23,466 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 08:30:23,467 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 08:30:23,467 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 08:30:46,854 INFO core: Event loop thread started, running loop forever
2026-09-10 08:30:47,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 08:30:47,159 INFO core: _init_accounts coroutine started
2026-09-10 08:30:47,160 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 08:30:47,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:35:43,973 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 08:35:43,973 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 08:35:43,977 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 08:35:43,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:40:31,351 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 08:40:31,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:45:29,962 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 08:45:29,962 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 08:45:29,967 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 08:45:29,967 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 08:45:29,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:50:26,476 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 08:50:26,477 WARNING core: Account 2: connect timed out after 35s
2026-09-10 08:50:26,478 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 08:50:26,478 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 08:50:26,480 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 08:50:26,481 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 08:50:26,482 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 08:50:26,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 08:55:26,814 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 08:55:26,815 WARNING core: Account 2: connect timed out after 35s
2026-09-10 08:55:26,817 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-10 08:55:26,817 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-10 08:55:26,818 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 08:55:26,819 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-10 08:55:26,820 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-10 08:55:26,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:00:22,834 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 09:00:22,835 WARNING core: Account 2: connect timed out after 35s
2026-09-10 09:00:22,836 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-10 09:00:22,836 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-10 09:00:22,836 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 09:00:22,837 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-10 09:00:22,838 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-10 09:00:22,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:05:28,430 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 09:05:28,431 WARNING core: Account 2: connect timed out after 35s
2026-09-10 09:05:28,431 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-10 09:05:28,431 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-10 09:05:28,432 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 09:05:28,433 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-09-10 09:05:28,433 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-09-10 09:05:39,053 INFO core: Event loop thread started, running loop forever
2026-09-10 09:05:39,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 09:05:39,360 INFO core: _init_accounts coroutine started
2026-09-10 09:05:39,362 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 09:05:39,372 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:10:33,800 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 09:10:33,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:15:53,461 INFO core: Event loop thread started, running loop forever
2026-09-10 09:15:53,762 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 09:15:53,768 INFO core: _init_accounts coroutine started
2026-09-10 09:15:53,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 09:15:53,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:20:31,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 09:20:31,408 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 09:20:31,409 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:20:31,410 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 09:20:31,411 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 09:25:37,436 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 09:25:43,576 INFO core: Event loop thread started, running loop forever
2026-09-10 09:25:43,878 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 09:25:43,883 INFO core: _init_accounts coroutine started
2026-09-10 09:25:43,884 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 09:25:43,890 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:30:17,870 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 09:30:17,871 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 09:30:17,875 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 09:30:17,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:35:29,365 INFO core: Event loop thread started, running loop forever
2026-09-10 09:35:29,666 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 09:35:29,670 INFO core: _init_accounts coroutine started
2026-09-10 09:35:29,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 09:35:29,675 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:40:52,341 INFO core: Event loop thread started, running loop forever
2026-09-10 09:40:52,642 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 09:40:52,645 INFO core: _init_accounts coroutine started
2026-09-10 09:40:52,646 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 09:40:52,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:45:35,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:45:35,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 09:45:35,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 09:45:35,435 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 09:45:35,437 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 09:50:46,406 INFO core: Event loop thread started, running loop forever
2026-09-10 09:50:46,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 09:50:46,712 INFO core: _init_accounts coroutine started
2026-09-10 09:50:46,712 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 09:50:46,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 09:55:17,930 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 09:55:17,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:00:23,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:05:12,966 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-10 10:05:12,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:10:19,435 INFO core: _init_accounts coroutine started
2026-09-10 10:10:47,503 INFO core: Event loop thread started, running loop forever
2026-09-10 10:10:47,804 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 10:10:47,808 INFO core: _init_accounts coroutine started
2026-09-10 10:10:47,810 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 10:10:47,816 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:15:17,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 10:15:17,366 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 10:15:17,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:20:05,235 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 10:20:05,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:25:05,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:30:05,355 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 10:30:05,407 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 10:30:05,407 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 10:30:05,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 10:30:50,576 INFO core: Event loop thread started, running loop forever
2026-09-10 10:30:50,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 10:30:50,880 INFO core: _init_accounts coroutine started
2026-09-10 10:30:50,881 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 10:30:50,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:35:09,498 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 10:35:09,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:40:15,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:45:28,904 INFO core: Event loop thread started, running loop forever
2026-09-10 10:45:29,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 10:45:29,210 INFO core: _init_accounts coroutine started
2026-09-10 10:45:29,212 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 10:45:29,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:50:30,937 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 10:50:30,938 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 10:50:30,939 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 10:50:30,942 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 10:50:30,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 10:55:18,337 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 10:55:18,338 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 10:55:18,344 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 10:55:18,345 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 10:55:18,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:00:15,347 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 11:00:15,347 WARNING core: Account 2: connect timed out after 35s
2026-09-10 11:00:15,348 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 11:00:15,348 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 11:00:15,350 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 11:00:15,351 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 11:00:15,351 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 11:00:15,353 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:05:21,387 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 11:05:21,388 WARNING core: Account 2: connect timed out after 35s
2026-09-10 11:05:28,444 INFO core: Event loop thread started, running loop forever
2026-09-10 11:05:28,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 11:05:28,749 INFO core: _init_accounts coroutine started
2026-09-10 11:05:28,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 11:05:28,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:10:35,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 11:10:38,161 INFO core: Event loop thread started, running loop forever
2026-09-10 11:10:38,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 11:10:38,465 INFO core: _init_accounts coroutine started
2026-09-10 11:10:38,466 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 11:10:38,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:15:10,048 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 11:15:10,049 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 11:15:10,052 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 11:15:10,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:20:41,625 INFO core: Event loop thread started, running loop forever
2026-09-10 11:20:41,934 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 11:20:41,941 INFO core: _init_accounts coroutine started
2026-09-10 11:20:41,942 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 11:20:41,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:25:09,713 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 11:25:09,726 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:30:19,493 INFO core: Event loop thread started, running loop forever
2026-09-10 11:30:19,794 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 11:30:19,797 INFO core: _init_accounts coroutine started
2026-09-10 11:30:19,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 11:30:19,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:35:25,850 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 11:35:25,851 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 11:35:25,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:40:03,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:45:04,676 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 11:45:04,682 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 11:45:04,694 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 11:45:04,694 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 11:45:04,699 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 11:45:04,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:45:04,700 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 11:50:10,419 WARNING core: Account 2: connect timed out after 35s
2026-09-10 11:50:10,420 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 11:50:10,420 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 11:50:10,421 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 11:50:19,583 INFO core: Event loop thread started, running loop forever
2026-09-10 11:50:19,884 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 11:50:19,891 INFO core: _init_accounts coroutine started
2026-09-10 11:50:19,891 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 11:50:19,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 11:55:16,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:00:23,472 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 12:00:52,205 INFO core: Event loop thread started, running loop forever
2026-09-10 12:00:52,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 12:00:52,515 INFO core: _init_accounts coroutine started
2026-09-10 12:00:52,516 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 12:00:52,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:05:25,891 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 12:05:25,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 12:05:25,893 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 12:05:25,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:05:25,894 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 12:10:31,541 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 12:10:43,809 INFO core: Event loop thread started, running loop forever
2026-09-10 12:10:44,110 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 12:10:44,116 INFO core: _init_accounts coroutine started
2026-09-10 12:10:44,116 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 12:10:44,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:15:27,882 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 12:15:27,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:20:26,901 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:25:52,578 INFO core: Event loop thread started, running loop forever
2026-09-10 12:25:52,880 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 12:25:52,886 INFO core: _init_accounts coroutine started
2026-09-10 12:25:52,887 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 12:25:52,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:30:41,043 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:35:28,621 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 12:35:28,621 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 12:35:28,626 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 12:35:28,630 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 12:35:28,638 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:40:33,395 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:45:36,857 INFO core: Event loop thread started, running loop forever
2026-09-10 12:45:37,158 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 12:45:37,162 INFO core: _init_accounts coroutine started
2026-09-10 12:45:37,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 12:45:37,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:50:26,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 12:50:26,516 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 12:50:26,516 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 12:55:13,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 12:55:13,314 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 12:55:13,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:00:11,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 13:00:11,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 13:00:11,442 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 13:00:11,443 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 13:00:11,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:05:18,443 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 13:05:18,444 WARNING core: Account 2: connect timed out after 35s
2026-09-10 13:05:22,460 INFO core: Event loop thread started, running loop forever
2026-09-10 13:05:22,761 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 13:05:22,765 INFO core: _init_accounts coroutine started
2026-09-10 13:05:22,766 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 13:05:22,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:10:20,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:15:47,702 INFO core: Event loop thread started, running loop forever
2026-09-10 13:15:48,005 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 13:15:48,008 INFO core: _init_accounts coroutine started
2026-09-10 13:15:48,011 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 13:15:48,017 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:20:22,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:25:29,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 13:25:33,984 INFO core: Event loop thread started, running loop forever
2026-09-10 13:25:34,285 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 13:25:34,292 INFO core: _init_accounts coroutine started
2026-09-10 13:25:34,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 13:25:34,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:30:36,657 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 13:30:36,658 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 13:30:36,659 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 13:30:36,660 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 13:30:36,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:35:04,664 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 13:35:04,664 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 13:35:04,680 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 13:35:04,681 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 13:35:04,692 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:40:10,484 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 13:40:10,485 WARNING core: Account 2: connect timed out after 35s
2026-09-10 13:40:10,486 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 13:40:10,486 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 13:40:10,487 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 13:40:10,488 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 13:40:10,494 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 13:40:30,871 INFO core: Event loop thread started, running loop forever
2026-09-10 13:40:31,182 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 13:40:31,189 INFO core: _init_accounts coroutine started
2026-09-10 13:40:31,190 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 13:40:31,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:45:13,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:50:20,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 13:50:40,320 INFO core: Event loop thread started, running loop forever
2026-09-10 13:50:40,621 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 13:50:40,628 INFO core: _init_accounts coroutine started
2026-09-10 13:50:40,629 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 13:50:40,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 13:55:22,356 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 13:55:22,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:00:33,946 INFO core: Event loop thread started, running loop forever
2026-09-10 14:00:34,247 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 14:00:34,251 INFO core: _init_accounts coroutine started
2026-09-10 14:00:34,252 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 14:00:34,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:05:04,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:10:11,455 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 14:10:35,706 INFO core: Event loop thread started, running loop forever
2026-09-10 14:10:36,008 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 14:10:36,015 INFO core: _init_accounts coroutine started
2026-09-10 14:10:36,016 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 14:10:36,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:15:07,480 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:20:14,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 14:20:14,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 14:20:14,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 14:20:14,407 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 14:20:28,332 INFO core: Event loop thread started, running loop forever
2026-09-10 14:20:28,633 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 14:20:28,640 INFO core: _init_accounts coroutine started
2026-09-10 14:20:28,641 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 14:20:28,660 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 14:20:28,660 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 14:20:28,661 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 14:20:28,663 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 14:20:28,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:25:27,887 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 14:25:27,887 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 14:25:27,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:30:12,240 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 14:30:12,241 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 14:30:12,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:35:19,398 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 14:35:32,865 INFO core: Event loop thread started, running loop forever
2026-09-10 14:35:33,173 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 14:35:33,177 INFO core: _init_accounts coroutine started
2026-09-10 14:35:33,178 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 14:35:33,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:40:46,796 INFO core: Event loop thread started, running loop forever
2026-09-10 14:40:47,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 14:40:47,100 INFO core: _init_accounts coroutine started
2026-09-10 14:40:47,104 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 14:40:47,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:45:12,798 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 14:45:12,810 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:50:50,459 INFO core: Event loop thread started, running loop forever
2026-09-10 14:50:50,764 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 14:50:50,769 INFO core: _init_accounts coroutine started
2026-09-10 14:50:50,770 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 14:50:50,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:55:03,643 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 14:55:03,644 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 14:55:03,647 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 14:55:03,647 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 15:00:04,421 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 15:00:37,756 INFO core: Event loop thread started, running loop forever
2026-09-10 15:00:38,057 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 15:00:38,063 INFO core: _init_accounts coroutine started
2026-09-10 15:00:38,064 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 15:00:38,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:05:14,319 INFO core: Event loop thread started, running loop forever
2026-09-10 15:05:14,620 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 15:05:14,625 INFO core: _init_accounts coroutine started
2026-09-10 15:05:14,626 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 15:05:14,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:05:44,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 15:10:31,770 INFO core: Event loop thread started, running loop forever
2026-09-10 15:10:32,071 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 15:10:32,075 INFO core: _init_accounts coroutine started
2026-09-10 15:10:32,077 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 15:10:32,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:15:18,875 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 15:15:18,876 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 15:15:18,877 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 15:15:18,878 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 15:15:18,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:20:09,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:20:09,603 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 15:20:09,604 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 15:25:15,434 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 15:25:15,435 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 15:25:35,303 INFO core: Event loop thread started, running loop forever
2026-09-10 15:25:35,604 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 15:25:35,607 INFO core: _init_accounts coroutine started
2026-09-10 15:25:35,610 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 15:25:35,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:30:12,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 15:30:12,621 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 15:30:12,622 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 15:30:12,624 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 15:30:12,636 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 15:30:12,636 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 15:30:12,641 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 15:30:12,642 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 15:30:12,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:35:05,477 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 15:35:05,478 WARNING core: Account 2: connect timed out after 35s
2026-09-10 15:35:05,479 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 15:35:05,479 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 15:35:05,480 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 15:35:05,482 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 15:35:05,483 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 15:35:05,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:40:09,959 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 15:40:09,959 WARNING core: Account 2: connect timed out after 35s
2026-09-10 15:40:09,960 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-10 15:40:09,960 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-10 15:40:09,961 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 15:40:09,964 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:40:09,973 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-10 15:45:16,409 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-10 15:45:43,205 INFO core: Event loop thread started, running loop forever
2026-09-10 15:45:43,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 15:45:43,511 INFO core: _init_accounts coroutine started
2026-09-10 15:45:43,513 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 15:45:43,520 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:50:09,133 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 15:55:07,426 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 15:55:07,426 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 15:55:07,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 15:55:07,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 15:55:07,436 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:00:38,768 INFO core: Event loop thread started, running loop forever
2026-09-10 16:00:39,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 16:00:39,073 INFO core: _init_accounts coroutine started
2026-09-10 16:00:39,075 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 16:00:39,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:05:42,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:10:52,352 INFO core: Event loop thread started, running loop forever
2026-09-10 16:10:52,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 16:10:52,656 INFO core: _init_accounts coroutine started
2026-09-10 16:10:52,659 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 16:10:52,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:15:41,035 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 16:15:41,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 16:15:41,037 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 16:15:41,038 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 16:15:41,047 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 16:15:41,048 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 16:15:41,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:20:48,421 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 16:20:48,423 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 16:20:50,294 INFO core: Event loop thread started, running loop forever
2026-09-10 16:20:50,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 16:20:50,600 INFO core: _init_accounts coroutine started
2026-09-10 16:20:50,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 16:20:50,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:25:10,290 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 16:25:10,290 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 16:25:10,291 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 16:25:10,292 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 16:25:10,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:30:17,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 16:30:19,545 INFO core: Event loop thread started, running loop forever
2026-09-10 16:30:19,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 16:30:19,849 INFO core: _init_accounts coroutine started
2026-09-10 16:30:19,851 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 16:30:19,861 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 16:30:19,861 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 16:30:19,862 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 16:30:19,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:35:15,816 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 16:35:15,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:40:21,530 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 16:40:34,307 INFO core: Event loop thread started, running loop forever
2026-09-10 16:40:34,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 16:40:34,614 INFO core: _init_accounts coroutine started
2026-09-10 16:40:34,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 16:40:34,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:45:40,906 INFO core: Event loop thread started, running loop forever
2026-09-10 16:45:41,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 16:45:41,218 INFO core: _init_accounts coroutine started
2026-09-10 16:45:41,219 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 16:45:41,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:50:32,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:50:32,365 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 16:55:22,174 INFO core: Event loop thread started, running loop forever
2026-09-10 16:55:22,481 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 16:55:22,494 INFO core: _init_accounts coroutine started
2026-09-10 16:55:22,494 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 16:55:22,503 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 16:55:39,179 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 16:55:39,181 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-10 16:55:39,182 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 16:55:39,182 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-10 16:55:39,182 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 16:55:39,182 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-10 16:55:39,182 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 16:55:39,182 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 17:00:28,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 17:00:28,694 INFO core: Event loop thread started, running loop forever
2026-09-10 17:00:28,995 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 17:00:28,999 INFO core: _init_accounts coroutine started
2026-09-10 17:00:29,002 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 17:00:29,010 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-10 17:00:29,011 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-10 17:05:08,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:10:20,407 INFO core: Event loop thread started, running loop forever
2026-09-10 17:10:20,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 17:10:20,711 INFO core: _init_accounts coroutine started
2026-09-10 17:10:20,713 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 17:10:20,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:15:29,963 INFO core: Event loop thread started, running loop forever
2026-09-10 17:15:30,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 17:15:30,270 INFO core: _init_accounts coroutine started
2026-09-10 17:15:30,270 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 17:15:30,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:20:33,042 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 17:20:33,043 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 17:20:33,049 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 17:20:33,050 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 17:20:33,059 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 17:20:33,059 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 17:20:33,064 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 17:20:33,065 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 17:20:33,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:25:40,416 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 17:25:40,417 WARNING core: Account 2: connect timed out after 35s
2026-09-10 17:25:40,418 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 17:25:40,418 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 17:25:44,772 INFO core: Event loop thread started, running loop forever
2026-09-10 17:25:45,073 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 17:25:45,077 INFO core: _init_accounts coroutine started
2026-09-10 17:25:45,079 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 17:25:45,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:25:45,998 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 17:25:45,999 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 17:25:46,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:30:12,874 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 17:30:12,886 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 17:30:12,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:35:18,451 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 17:35:36,587 INFO core: Event loop thread started, running loop forever
2026-09-10 17:35:36,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 17:35:36,892 INFO core: _init_accounts coroutine started
2026-09-10 17:35:36,894 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 17:35:36,899 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:40:42,439 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 17:40:49,557 INFO core: Event loop thread started, running loop forever
2026-09-10 17:40:49,858 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 17:40:49,862 INFO core: _init_accounts coroutine started
2026-09-10 17:40:49,863 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 17:40:49,875 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:45:29,688 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:50:35,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 17:50:49,238 INFO core: Event loop thread started, running loop forever
2026-09-10 17:50:49,539 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 17:50:49,543 INFO core: _init_accounts coroutine started
2026-09-10 17:50:49,544 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 17:50:49,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 17:55:46,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:00:34,385 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 18:00:34,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:05:09,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:10:11,413 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-10 18:10:11,414 INFO core: _init_accounts coroutine started
2026-09-10 18:10:11,414 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 18:10:11,419 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:15:17,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 18:15:32,725 INFO core: Event loop thread started, running loop forever
2026-09-10 18:15:33,026 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 18:15:33,030 INFO core: _init_accounts coroutine started
2026-09-10 18:15:33,033 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 18:15:33,037 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:16:52,270 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 18:16:52,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:20:29,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:25:24,882 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-10 18:25:24,883 INFO core: _init_accounts coroutine started
2026-09-10 18:25:24,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 18:25:24,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:30:31,738 INFO core: Event loop thread started, running loop forever
2026-09-10 18:30:32,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 18:30:32,042 INFO core: _init_accounts coroutine started
2026-09-10 18:30:32,044 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 18:30:32,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:35:24,977 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 18:35:25,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:40:21,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:45:45,735 INFO core: Event loop thread started, running loop forever
2026-09-10 18:45:46,036 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 18:45:46,040 INFO core: _init_accounts coroutine started
2026-09-10 18:45:46,041 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 18:45:46,045 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:50:18,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 18:55:05,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:00:11,470 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 19:00:11,470 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 19:00:41,431 INFO core: Event loop thread started, running loop forever
2026-09-10 19:00:41,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 19:00:41,742 INFO core: _init_accounts coroutine started
2026-09-10 19:00:41,748 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 19:00:41,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:05:43,250 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 19:05:43,250 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 19:05:43,251 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 19:05:43,253 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 19:05:43,255 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:10:10,928 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 19:10:10,928 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 19:10:10,934 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 19:10:10,934 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 19:10:10,954 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:15:04,211 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 19:15:04,211 WARNING core: Account 2: connect timed out after 35s
2026-09-10 19:15:04,212 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 19:15:04,213 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 19:15:04,215 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 19:15:04,216 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 19:15:04,216 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 19:15:04,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:20:11,400 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 19:20:11,401 WARNING core: Account 2: connect timed out after 35s
2026-09-10 19:20:41,198 INFO core: Event loop thread started, running loop forever
2026-09-10 19:20:41,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 19:20:41,504 INFO core: _init_accounts coroutine started
2026-09-10 19:20:41,505 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 19:20:41,513 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:25:36,033 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 19:25:36,033 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 19:25:36,034 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 19:25:36,035 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 19:25:36,045 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:30:03,584 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 19:30:03,595 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 19:30:28,203 INFO core: Event loop thread started, running loop forever
2026-09-10 19:30:28,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 19:30:28,509 INFO core: _init_accounts coroutine started
2026-09-10 19:30:28,509 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 19:30:28,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:35:38,349 INFO core: Event loop thread started, running loop forever
2026-09-10 19:35:38,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 19:35:38,656 INFO core: _init_accounts coroutine started
2026-09-10 19:35:38,658 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 19:35:38,668 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:40:35,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:45:32,830 INFO core: Event loop thread started, running loop forever
2026-09-10 19:45:33,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 19:45:33,138 INFO core: _init_accounts coroutine started
2026-09-10 19:45:33,139 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 19:45:33,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:45:41,836 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 19:50:46,190 INFO core: Event loop thread started, running loop forever
2026-09-10 19:50:46,490 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 19:50:46,493 INFO core: _init_accounts coroutine started
2026-09-10 19:50:46,495 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 19:50:46,508 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 19:55:19,368 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 19:55:19,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:00:19,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:05:19,093 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-10 20:05:19,094 INFO core: _init_accounts coroutine started
2026-09-10 20:05:19,094 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 20:05:19,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:10:09,094 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 20:10:09,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:10:09,094 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 20:15:16,420 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 20:15:33,835 INFO core: Event loop thread started, running loop forever
2026-09-10 20:15:34,136 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 20:15:34,143 INFO core: _init_accounts coroutine started
2026-09-10 20:15:34,143 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 20:15:34,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:20:31,754 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 20:20:31,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:25:19,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:30:26,782 INFO core: Event loop thread started, running loop forever
2026-09-10 20:30:27,090 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 20:30:27,095 INFO core: _init_accounts coroutine started
2026-09-10 20:30:27,095 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 20:30:27,111 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:35:39,587 INFO core: Event loop thread started, running loop forever
2026-09-10 20:35:39,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 20:35:39,894 INFO core: _init_accounts coroutine started
2026-09-10 20:35:39,894 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 20:35:39,909 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 20:35:39,909 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 20:35:39,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:35:39,911 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 20:40:10,953 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 20:40:10,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:45:17,417 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 20:45:17,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 20:45:17,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 20:45:39,989 INFO core: Event loop thread started, running loop forever
2026-09-10 20:45:40,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 20:45:40,294 INFO core: _init_accounts coroutine started
2026-09-10 20:45:40,296 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 20:45:40,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:50:17,173 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 20:50:17,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 20:50:17,174 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 20:55:21,710 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 20:55:21,717 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:00:27,440 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 21:00:36,593 INFO core: Event loop thread started, running loop forever
2026-09-10 21:00:36,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 21:00:36,908 INFO core: _init_accounts coroutine started
2026-09-10 21:00:36,908 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 21:00:36,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:05:24,778 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:10:22,643 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 21:10:22,643 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 21:10:22,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:15:21,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:20:16,947 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 21:20:16,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:25:12,180 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 21:25:12,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:30:28,724 INFO core: Event loop thread started, running loop forever
2026-09-10 21:30:29,026 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 21:30:29,032 INFO core: _init_accounts coroutine started
2026-09-10 21:30:29,033 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 21:30:29,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:35:08,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:40:15,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 21:40:23,456 INFO core: Event loop thread started, running loop forever
2026-09-10 21:40:23,759 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 21:40:23,767 INFO core: _init_accounts coroutine started
2026-09-10 21:40:23,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 21:40:23,769 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:45:04,373 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 21:45:41,405 INFO core: Event loop thread started, running loop forever
2026-09-10 21:45:41,706 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 21:45:41,709 INFO core: _init_accounts coroutine started
2026-09-10 21:45:41,710 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 21:45:41,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:50:47,879 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 21:50:47,880 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 21:50:47,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 21:50:47,882 INFO core: Event loop thread started, running loop forever
2026-09-10 21:50:47,883 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 21:50:47,883 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-10 21:50:47,884 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 21:50:47,884 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 21:50:48,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 21:50:48,193 INFO core: _init_accounts coroutine started
2026-09-10 21:50:48,194 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 21:50:48,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 21:55:04,113 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 21:55:04,133 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:00:17,429 INFO core: Event loop thread started, running loop forever
2026-09-10 22:00:17,731 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 22:00:17,744 INFO core: _init_accounts coroutine started
2026-09-10 22:00:17,745 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 22:00:17,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:05:24,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 22:05:47,604 INFO core: Event loop thread started, running loop forever
2026-09-10 22:05:47,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 22:05:47,909 INFO core: _init_accounts coroutine started
2026-09-10 22:05:47,914 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 22:05:47,920 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:10:28,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:15:37,137 INFO core: Event loop thread started, running loop forever
2026-09-10 22:15:37,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 22:15:37,442 INFO core: _init_accounts coroutine started
2026-09-10 22:15:37,444 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 22:15:37,453 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 22:15:37,453 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 22:15:37,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 22:15:37,456 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 22:15:37,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:20:42,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:25:44,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:30:29,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:35:22,853 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:40:18,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:45:25,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 22:45:25,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 22:45:25,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 22:45:40,448 INFO core: Event loop thread started, running loop forever
2026-09-10 22:45:40,749 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 22:45:40,755 INFO core: _init_accounts coroutine started
2026-09-10 22:45:40,756 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 22:45:40,761 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:50:12,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 22:50:12,791 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 22:55:18,390 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 22:55:18,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 22:55:24,981 INFO core: Event loop thread started, running loop forever
2026-09-10 22:55:25,283 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 22:55:25,289 INFO core: _init_accounts coroutine started
2026-09-10 22:55:25,290 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 22:55:25,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:00:32,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-10 23:00:38,885 INFO core: Event loop thread started, running loop forever
2026-09-10 23:00:39,185 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 23:00:39,190 INFO core: _init_accounts coroutine started
2026-09-10 23:00:39,191 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 23:00:39,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:05:19,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:10:26,451 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-10 23:10:26,582 INFO core: Event loop thread started, running loop forever
2026-09-10 23:10:26,883 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 23:10:26,886 INFO core: _init_accounts coroutine started
2026-09-10 23:10:26,888 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 23:10:26,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:15:17,984 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:20:24,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 23:20:24,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 23:20:24,382 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-10 23:20:35,285 INFO core: Event loop thread started, running loop forever
2026-09-10 23:20:35,587 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 23:20:35,590 INFO core: _init_accounts coroutine started
2026-09-10 23:20:35,591 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 23:20:35,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:25:40,368 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 23:25:40,368 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 23:25:40,370 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-10 23:25:40,371 INFO core: _init_accounts_inner: reloading LLM config
2026-09-10 23:25:40,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:30:45,178 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:35:08,021 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-10 23:35:08,021 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-10 23:35:08,032 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-10 23:35:08,033 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-10 23:35:08,036 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:40:15,400 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-10 23:40:15,400 WARNING core: Account 2: connect timed out after 35s
2026-09-10 23:40:15,401 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-10 23:40:15,401 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-10 23:40:15,402 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-10 23:40:15,402 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-10 23:40:15,403 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-10 23:40:44,061 INFO core: Event loop thread started, running loop forever
2026-09-10 23:40:44,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-10 23:40:44,368 INFO core: _init_accounts coroutine started
2026-09-10 23:40:44,369 INFO core: _init_accounts_inner: starting DB migrations
2026-09-10 23:40:44,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:45:23,705 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:50:15,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:55:08,949 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-10 23:55:08,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-10 23:55:08,950 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-10 23:55:08,952 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 00:00:21,287 INFO core: Event loop thread started, running loop forever
2026-09-11 00:00:21,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 00:00:21,604 INFO core: _init_accounts coroutine started
2026-09-11 00:00:21,604 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 00:00:21,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:05:39,886 INFO core: Event loop thread started, running loop forever
2026-09-11 00:05:40,187 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 00:05:40,191 INFO core: _init_accounts coroutine started
2026-09-11 00:05:40,191 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 00:05:40,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:10:27,604 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 00:10:27,616 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:15:20,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:20:21,050 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 00:20:21,051 INFO core: _init_accounts coroutine started
2026-09-11 00:20:21,052 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 00:20:21,057 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 00:20:21,057 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 00:20:21,059 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 00:20:21,067 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:25:28,433 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 00:25:29,908 INFO core: Event loop thread started, running loop forever
2026-09-11 00:25:30,210 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 00:25:30,214 INFO core: _init_accounts coroutine started
2026-09-11 00:25:30,215 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 00:25:30,223 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:30:17,575 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 00:30:17,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:35:27,700 INFO core: Event loop thread started, running loop forever
2026-09-11 00:35:28,002 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 00:35:28,006 INFO core: _init_accounts coroutine started
2026-09-11 00:35:28,008 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 00:35:28,014 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:40:34,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 00:40:40,931 INFO core: Event loop thread started, running loop forever
2026-09-11 00:40:41,233 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 00:40:41,240 INFO core: _init_accounts coroutine started
2026-09-11 00:40:41,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 00:40:41,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:45:26,200 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 00:45:26,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:50:36,771 INFO core: Event loop thread started, running loop forever
2026-09-11 00:50:37,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 00:50:37,075 INFO core: _init_accounts coroutine started
2026-09-11 00:50:37,076 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 00:50:37,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 00:55:18,006 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:00:08,194 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 01:00:08,195 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 01:00:08,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:00:08,197 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 01:05:33,870 INFO core: Event loop thread started, running loop forever
2026-09-11 01:05:34,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 01:05:34,176 INFO core: _init_accounts coroutine started
2026-09-11 01:05:34,178 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 01:05:34,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:10:16,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:15:23,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 01:15:47,905 INFO core: Event loop thread started, running loop forever
2026-09-11 01:15:48,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 01:15:48,218 INFO core: _init_accounts coroutine started
2026-09-11 01:15:48,219 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 01:15:48,226 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 01:15:48,226 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 01:15:48,228 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 01:15:48,230 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 01:15:48,234 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:20:09,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:25:15,404 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 01:25:15,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 01:25:15,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 01:25:47,699 INFO core: Event loop thread started, running loop forever
2026-09-11 01:25:48,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 01:25:48,003 INFO core: _init_accounts coroutine started
2026-09-11 01:25:48,005 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 01:25:48,015 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:30:22,764 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 01:30:22,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:35:20,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:40:51,607 INFO core: Event loop thread started, running loop forever
2026-09-11 01:40:51,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 01:40:51,911 INFO core: _init_accounts coroutine started
2026-09-11 01:40:51,913 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 01:40:51,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:45:09,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:50:14,724 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 01:50:14,725 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 01:50:14,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 01:50:14,727 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 01:55:20,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 01:55:46,996 INFO core: Event loop thread started, running loop forever
2026-09-11 01:55:47,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 01:55:47,300 INFO core: _init_accounts coroutine started
2026-09-11 01:55:47,303 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 01:55:47,323 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 01:55:47,323 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 01:55:47,324 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 01:55:47,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:00:39,846 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 02:00:39,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:05:41,232 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:10:23,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:15:02,351 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 02:15:02,351 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 02:15:02,390 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 02:15:41,010 INFO core: Event loop thread started, running loop forever
2026-09-11 02:15:41,311 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 02:15:41,314 INFO core: _init_accounts coroutine started
2026-09-11 02:15:41,315 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 02:15:41,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:20:23,868 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 02:20:23,868 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 02:20:23,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:25:30,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 02:25:37,864 INFO core: Event loop thread started, running loop forever
2026-09-11 02:25:38,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 02:25:38,171 INFO core: _init_accounts coroutine started
2026-09-11 02:25:38,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 02:25:38,180 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:30:49,910 INFO core: Event loop thread started, running loop forever
2026-09-11 02:30:50,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 02:30:50,214 INFO core: _init_accounts coroutine started
2026-09-11 02:30:50,216 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 02:30:50,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:35:30,108 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 02:35:30,108 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 02:35:30,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:40:21,822 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 02:40:21,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:40:21,829 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 02:45:16,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:50:50,842 INFO core: Event loop thread started, running loop forever
2026-09-11 02:50:51,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 02:50:51,146 INFO core: _init_accounts coroutine started
2026-09-11 02:50:51,147 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 02:50:51,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 02:55:04,292 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:00:08,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:05:04,959 INFO core: Event loop thread started, running loop forever
2026-09-11 03:05:05,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 03:05:05,264 INFO core: _init_accounts coroutine started
2026-09-11 03:05:05,265 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 03:05:05,273 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-11 03:05:05,292 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:05:15,962 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 03:10:08,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:15:09,962 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 03:15:09,964 INFO core: _init_accounts coroutine started
2026-09-11 03:15:09,964 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 03:15:09,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:20:41,662 INFO core: Event loop thread started, running loop forever
2026-09-11 03:20:41,963 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 03:20:41,967 INFO core: _init_accounts coroutine started
2026-09-11 03:20:41,969 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 03:20:41,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:25:24,507 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 03:25:24,508 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 03:25:24,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:25:24,510 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 03:30:25,370 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 03:30:25,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:35:04,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:40:10,486 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 03:40:43,395 INFO core: Event loop thread started, running loop forever
2026-09-11 03:40:43,697 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 03:40:43,703 INFO core: _init_accounts coroutine started
2026-09-11 03:40:43,703 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 03:40:43,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:45:32,397 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 03:45:32,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:50:40,456 INFO core: Event loop thread started, running loop forever
2026-09-11 03:50:40,757 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 03:50:40,762 INFO core: _init_accounts coroutine started
2026-09-11 03:50:40,764 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 03:50:40,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 03:55:26,886 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 03:55:26,887 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 03:55:26,888 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 03:55:26,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:00:11,485 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 04:00:11,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:05:18,518 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 04:05:18,525 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 04:05:45,680 INFO core: Event loop thread started, running loop forever
2026-09-11 04:05:45,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 04:05:45,986 INFO core: _init_accounts coroutine started
2026-09-11 04:05:45,986 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 04:05:46,015 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 04:05:46,015 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 04:05:46,018 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 04:05:46,021 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 04:05:46,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:05:46,035 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 04:05:46,040 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 04:10:28,838 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 04:10:28,839 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-11 04:10:28,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:15:34,397 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 04:15:38,212 INFO core: Event loop thread started, running loop forever
2026-09-11 04:15:38,513 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 04:15:38,518 INFO core: _init_accounts coroutine started
2026-09-11 04:15:38,520 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 04:15:38,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:20:41,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:20:41,970 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 04:20:41,970 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 04:20:41,972 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 04:20:41,973 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 04:25:29,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:30:41,081 INFO core: Event loop thread started, running loop forever
2026-09-11 04:30:41,382 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 04:30:41,385 INFO core: _init_accounts coroutine started
2026-09-11 04:30:41,386 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 04:30:41,392 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:35:35,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:40:41,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 04:40:46,983 INFO core: Event loop thread started, running loop forever
2026-09-11 04:40:47,284 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 04:40:47,288 INFO core: _init_accounts coroutine started
2026-09-11 04:40:47,290 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 04:40:47,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:45:30,156 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 04:45:30,157 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 04:45:30,157 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:50:27,052 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 04:50:27,054 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 04:55:35,967 INFO core: Event loop thread started, running loop forever
2026-09-11 04:55:36,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 04:55:36,285 INFO core: _init_accounts coroutine started
2026-09-11 04:55:36,285 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 04:55:36,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:00:27,718 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 05:00:27,725 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 05:00:27,729 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 05:00:27,733 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 05:00:27,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:00:27,752 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 05:00:27,753 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 05:00:27,758 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 05:05:33,443 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-11 05:05:36,731 INFO core: Event loop thread started, running loop forever
2026-09-11 05:05:37,032 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 05:05:37,037 INFO core: _init_accounts coroutine started
2026-09-11 05:05:37,040 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 05:05:37,048 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:10:24,788 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 05:10:24,788 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 05:10:24,795 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 05:10:24,796 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 05:10:24,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:15:30,449 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 05:15:33,087 INFO core: Event loop thread started, running loop forever
2026-09-11 05:15:33,388 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 05:15:33,391 INFO core: _init_accounts coroutine started
2026-09-11 05:15:33,392 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 05:15:33,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:20:19,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 05:20:19,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:20:19,442 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 05:25:26,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 05:25:49,085 INFO core: Event loop thread started, running loop forever
2026-09-11 05:25:49,386 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 05:25:49,392 INFO core: _init_accounts coroutine started
2026-09-11 05:25:49,392 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 05:25:49,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:30:19,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:35:26,364 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 05:35:30,977 INFO core: Event loop thread started, running loop forever
2026-09-11 05:35:31,278 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 05:35:31,282 INFO core: _init_accounts coroutine started
2026-09-11 05:35:31,283 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 05:35:31,292 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:40:06,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:45:13,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 05:45:49,213 INFO core: Event loop thread started, running loop forever
2026-09-11 05:45:49,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 05:45:49,523 INFO core: _init_accounts coroutine started
2026-09-11 05:45:49,523 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 05:45:49,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:45:49,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 05:45:49,539 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 05:50:19,373 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 05:50:19,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 05:55:09,199 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 05:55:09,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:00:16,457 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 06:00:20,709 INFO core: Event loop thread started, running loop forever
2026-09-11 06:00:21,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 06:00:21,014 INFO core: _init_accounts coroutine started
2026-09-11 06:00:21,022 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:00:21,023 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 06:05:44,043 INFO core: Event loop thread started, running loop forever
2026-09-11 06:05:44,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 06:05:44,351 INFO core: _init_accounts coroutine started
2026-09-11 06:05:44,352 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 06:05:44,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:10:28,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:15:37,831 INFO core: Event loop thread started, running loop forever
2026-09-11 06:15:38,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 06:15:38,139 INFO core: _init_accounts coroutine started
2026-09-11 06:15:38,139 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 06:15:38,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:20:04,810 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 06:20:04,811 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 06:20:04,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:25:10,399 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 06:25:10,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-11 06:25:10,403 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 06:25:10,403 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 06:25:10,403 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 06:25:10,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 06:25:48,691 INFO core: Event loop thread started, running loop forever
2026-09-11 06:25:48,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 06:25:48,997 INFO core: _init_accounts coroutine started
2026-09-11 06:25:48,998 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 06:25:49,005 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:30:47,820 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 06:30:47,821 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 06:30:47,823 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 06:30:47,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:35:50,859 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 06:35:50,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:40:52,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:45:28,272 INFO core: Event loop thread started, running loop forever
2026-09-11 06:45:28,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 06:45:28,577 INFO core: _init_accounts coroutine started
2026-09-11 06:45:28,578 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 06:45:28,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:50:26,380 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 06:50:26,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 06:50:26,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 06:55:51,241 INFO core: Event loop thread started, running loop forever
2026-09-11 06:55:51,542 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 06:55:51,547 INFO core: _init_accounts coroutine started
2026-09-11 06:55:51,548 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 06:55:51,553 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:00:15,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:05:08,596 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 07:05:08,597 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 07:05:08,600 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 07:05:08,602 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 07:05:08,608 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:10:15,431 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 07:10:15,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 07:10:15,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 07:10:43,851 INFO core: Event loop thread started, running loop forever
2026-09-11 07:10:44,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 07:10:44,156 INFO core: _init_accounts coroutine started
2026-09-11 07:10:44,159 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 07:10:44,166 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 07:10:44,168 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 07:10:44,168 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:15:44,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 07:15:44,643 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 07:15:44,644 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:20:30,453 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:25:09,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:25:09,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 07:30:15,380 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 07:30:15,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 07:30:17,723 INFO core: Event loop thread started, running loop forever
2026-09-11 07:30:18,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 07:30:18,034 INFO core: _init_accounts coroutine started
2026-09-11 07:30:18,034 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 07:30:18,043 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:35:20,565 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 07:35:20,566 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 07:35:20,569 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 07:35:20,570 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 07:35:20,572 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:40:47,612 INFO core: Event loop thread started, running loop forever
2026-09-11 07:40:47,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 07:40:47,916 INFO core: _init_accounts coroutine started
2026-09-11 07:40:47,918 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 07:40:47,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:45:14,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:50:21,385 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 07:50:21,386 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 07:50:21,386 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-11 07:50:21,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 07:50:21,387 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 07:50:21,387 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 07:50:21,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 07:50:21,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 07:50:21,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 07:50:24,769 INFO core: Event loop thread started, running loop forever
2026-09-11 07:50:25,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 07:50:25,073 INFO core: _init_accounts coroutine started
2026-09-11 07:50:25,075 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 07:50:25,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 07:55:46,009 INFO core: Event loop thread started, running loop forever
2026-09-11 07:55:46,310 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 07:55:46,316 INFO core: _init_accounts coroutine started
2026-09-11 07:55:46,316 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 07:55:46,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:00:24,451 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:05:20,885 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 08:05:20,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:10:28,343 INFO core: Event loop thread started, running loop forever
2026-09-11 08:10:28,644 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 08:10:28,648 INFO core: _init_accounts coroutine started
2026-09-11 08:10:28,651 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 08:10:28,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:15:43,611 INFO core: Event loop thread started, running loop forever
2026-09-11 08:15:43,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 08:15:43,921 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:20:33,497 INFO core: _init_accounts coroutine started
2026-09-11 08:20:33,499 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 08:20:33,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:25:33,411 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:30:53,364 INFO core: Event loop thread started, running loop forever
2026-09-11 08:30:53,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 08:30:53,670 INFO core: _init_accounts coroutine started
2026-09-11 08:30:53,671 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 08:30:53,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:35:17,642 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 08:35:17,642 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 08:35:17,644 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 08:35:17,646 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 08:35:17,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:40:23,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 08:40:23,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 08:40:23,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 08:40:49,738 INFO core: Event loop thread started, running loop forever
2026-09-11 08:40:50,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 08:40:50,043 INFO core: _init_accounts coroutine started
2026-09-11 08:40:50,044 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 08:40:50,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:45:07,283 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 08:45:07,284 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 08:45:07,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:50:53,090 INFO core: Event loop thread started, running loop forever
2026-09-11 08:50:53,391 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 08:50:53,397 INFO core: _init_accounts coroutine started
2026-09-11 08:50:53,398 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 08:50:53,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:55:16,990 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 08:55:16,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 08:55:16,991 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 09:00:03,376 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 09:00:03,377 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 09:00:03,377 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 09:00:03,377 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 09:00:03,377 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 09:00:03,378 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 09:00:47,166 INFO core: Event loop thread started, running loop forever
2026-09-11 09:00:47,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 09:00:47,471 INFO core: _init_accounts coroutine started
2026-09-11 09:00:47,473 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 09:00:47,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:05:48,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:10:48,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:15:37,804 INFO core: Event loop thread started, running loop forever
2026-09-11 09:15:38,105 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 09:15:38,109 INFO core: _init_accounts coroutine started
2026-09-11 09:15:38,110 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 09:15:38,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:15:55,815 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 09:15:55,816 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 09:20:07,521 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 09:20:07,536 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:25:51,327 INFO core: Event loop thread started, running loop forever
2026-09-11 09:25:51,628 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 09:25:51,631 INFO core: _init_accounts coroutine started
2026-09-11 09:25:51,632 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 09:25:51,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:30:20,993 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 09:30:20,993 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 09:30:20,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:30:20,996 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 09:35:21,097 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 09:35:21,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:40:39,289 INFO core: Event loop thread started, running loop forever
2026-09-11 09:40:39,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 09:40:39,595 INFO core: _init_accounts coroutine started
2026-09-11 09:40:39,595 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 09:40:39,602 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 09:40:39,602 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 09:40:39,603 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 09:40:39,604 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 09:40:39,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:45:34,623 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:50:10,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 09:50:10,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 09:50:10,434 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 09:50:10,435 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-11 09:50:10,441 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:55:17,441 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 09:55:24,963 INFO core: Event loop thread started, running loop forever
2026-09-11 09:55:25,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 09:55:25,267 INFO core: _init_accounts coroutine started
2026-09-11 09:55:25,269 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 09:55:25,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 09:55:25,279 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 09:55:25,280 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 09:55:25,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 09:55:25,282 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 10:00:15,625 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 10:00:15,626 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 10:00:15,630 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 10:00:15,631 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-11 10:00:15,633 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:05:07,320 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 10:05:07,321 WARNING core: Account 2: connect timed out after 35s
2026-09-11 10:05:07,321 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-11 10:05:07,321 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-11 10:05:07,322 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-11 10:05:07,323 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-11 10:05:07,324 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-11 10:05:07,332 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:10:14,431 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 10:10:14,432 WARNING core: Account 2: connect timed out after 35s
2026-09-11 10:10:14,432 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-11 10:10:14,433 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-11 10:10:14,433 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-11 10:10:14,434 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-11 10:10:14,435 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-11 10:10:38,553 INFO core: Event loop thread started, running loop forever
2026-09-11 10:10:38,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 10:10:38,857 INFO core: _init_accounts coroutine started
2026-09-11 10:10:38,858 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 10:10:38,865 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:15:35,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:20:20,354 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 10:20:20,354 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 10:20:20,355 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 10:20:20,356 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 10:20:20,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:25:21,672 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 10:25:21,673 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 10:25:21,677 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 10:25:21,678 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-11 10:25:21,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:30:32,006 INFO core: Event loop thread started, running loop forever
2026-09-11 10:30:32,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 10:30:32,315 INFO core: _init_accounts coroutine started
2026-09-11 10:30:32,316 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 10:30:32,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:35:38,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:40:22,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 10:40:22,425 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 10:40:22,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 10:40:22,430 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:40:22,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 10:45:37,370 INFO core: Event loop thread started, running loop forever
2026-09-11 10:45:37,671 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 10:45:37,673 INFO core: _init_accounts coroutine started
2026-09-11 10:45:37,675 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 10:45:37,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:50:31,857 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 10:50:31,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 10:55:40,473 INFO core: Event loop thread started, running loop forever
2026-09-11 10:55:40,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 10:55:40,780 INFO core: _init_accounts coroutine started
2026-09-11 10:55:40,780 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 10:55:40,784 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:00:30,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:00:30,880 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 11:00:30,881 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 11:05:36,367 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 11:05:47,246 INFO core: Event loop thread started, running loop forever
2026-09-11 11:05:47,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 11:05:47,552 INFO core: _init_accounts coroutine started
2026-09-11 11:05:47,552 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 11:05:47,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:10:44,927 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 11:10:44,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:10:44,927 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 11:15:02,326 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 11:15:02,327 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 11:15:02,328 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 11:15:02,328 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 11:15:02,328 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 11:15:02,328 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 11:15:48,038 INFO core: Event loop thread started, running loop forever
2026-09-11 11:15:48,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 11:15:48,342 INFO core: _init_accounts coroutine started
2026-09-11 11:15:48,344 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 11:15:48,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:20:42,761 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:25:49,230 INFO core: Event loop thread started, running loop forever
2026-09-11 11:25:49,532 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 11:25:49,537 INFO core: _init_accounts coroutine started
2026-09-11 11:25:49,537 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 11:25:49,543 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:30:53,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:35:36,929 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 11:35:36,930 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 11:35:36,935 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 11:35:36,937 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:40:42,558 INFO core: Event loop thread started, running loop forever
2026-09-11 11:40:42,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 11:40:42,863 INFO core: _init_accounts coroutine started
2026-09-11 11:40:42,865 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 11:40:42,879 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-11 11:40:42,880 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-11 11:45:47,710 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:50:10,384 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 11:50:10,390 INFO core: _init_accounts coroutine started
2026-09-11 11:50:10,391 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 11:50:10,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 11:55:17,480 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 11:55:52,063 INFO core: Event loop thread started, running loop forever
2026-09-11 11:55:52,369 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 11:55:52,373 INFO core: _init_accounts coroutine started
2026-09-11 11:55:52,373 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 11:55:52,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:00:41,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:05:14,937 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 12:05:14,944 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:10:07,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:15:33,394 INFO core: Event loop thread started, running loop forever
2026-09-11 12:15:33,695 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 12:15:33,700 INFO core: _init_accounts coroutine started
2026-09-11 12:15:33,700 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 12:15:33,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:20:19,547 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 12:20:19,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:25:22,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:30:24,563 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 12:30:24,564 INFO core: _init_accounts coroutine started
2026-09-11 12:30:24,564 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 12:30:24,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:30:24,572 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 12:30:24,572 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 12:35:23,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 12:35:23,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:35:23,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 12:40:49,250 INFO core: Event loop thread started, running loop forever
2026-09-11 12:40:49,553 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 12:40:49,558 INFO core: _init_accounts coroutine started
2026-09-11 12:40:49,559 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 12:40:49,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:45:49,822 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 12:45:49,823 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 12:45:49,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:50:09,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 12:50:09,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 12:55:16,364 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 12:55:16,365 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 12:55:16,365 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 12:55:16,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 12:55:35,244 INFO core: Event loop thread started, running loop forever
2026-09-11 12:55:35,545 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 12:55:35,548 INFO core: _init_accounts coroutine started
2026-09-11 12:55:35,550 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 12:55:35,555 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:00:42,682 INFO core: Event loop thread started, running loop forever
2026-09-11 13:00:42,983 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 13:00:42,987 INFO core: _init_accounts coroutine started
2026-09-11 13:00:42,988 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 13:00:42,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:05:13,929 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 13:05:13,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:10:44,983 INFO core: Event loop thread started, running loop forever
2026-09-11 13:10:45,284 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 13:10:45,287 INFO core: _init_accounts coroutine started
2026-09-11 13:10:45,289 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 13:10:45,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:15:42,785 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 13:15:42,795 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:20:09,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:25:10,797 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 13:25:10,798 INFO core: _init_accounts coroutine started
2026-09-11 13:25:10,798 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 13:25:10,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:30:02,358 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 13:30:39,125 INFO core: Event loop thread started, running loop forever
2026-09-11 13:30:39,426 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 13:30:39,430 INFO core: _init_accounts coroutine started
2026-09-11 13:30:39,431 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 13:30:39,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:35:17,008 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 13:35:17,008 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 13:35:17,009 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 13:35:17,011 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 13:35:17,017 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:40:19,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:45:25,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:50:27,435 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 13:50:27,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 13:50:27,445 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 13:50:27,446 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-11 13:50:27,448 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 13:55:29,589 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 13:55:29,589 WARNING core: Account 2: connect timed out after 35s
2026-09-11 13:55:29,590 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-11 13:55:29,590 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-11 13:55:29,591 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-11 13:55:29,592 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-11 13:55:29,593 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-11 13:55:29,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:00:19,540 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 14:00:19,541 WARNING core: Account 2: connect timed out after 35s
2026-09-11 14:00:19,542 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-11 14:00:19,542 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-11 14:00:19,543 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-11 14:00:19,544 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-11 14:00:19,544 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-11 14:00:19,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:05:26,372 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 14:05:26,376 WARNING core: Account 2: connect timed out after 35s
2026-09-11 14:05:26,377 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-11 14:05:26,377 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-11 14:05:26,378 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-11 14:05:26,379 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-11 14:05:26,379 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-11 14:05:46,156 INFO core: Event loop thread started, running loop forever
2026-09-11 14:05:46,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 14:05:46,463 INFO core: _init_accounts coroutine started
2026-09-11 14:05:46,463 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 14:05:46,468 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:10:33,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:15:40,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 14:15:40,415 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 14:15:40,416 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-11 14:15:46,673 INFO core: Event loop thread started, running loop forever
2026-09-11 14:15:46,984 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 14:15:46,991 INFO core: _init_accounts coroutine started
2026-09-11 14:15:46,992 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 14:15:47,010 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:20:36,281 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 14:20:36,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:25:28,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:30:33,227 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 14:30:33,228 INFO core: _init_accounts coroutine started
2026-09-11 14:30:33,228 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 14:30:33,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:35:49,748 INFO core: Event loop thread started, running loop forever
2026-09-11 14:35:50,050 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 14:35:50,057 INFO core: _init_accounts coroutine started
2026-09-11 14:35:50,058 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 14:35:50,062 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:40:21,232 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 14:40:21,268 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:45:30,894 INFO core: Event loop thread started, running loop forever
2026-09-11 14:45:31,195 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 14:45:31,199 INFO core: _init_accounts coroutine started
2026-09-11 14:45:31,200 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 14:45:31,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:50:27,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 14:50:27,321 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 14:55:15,883 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 14:55:15,890 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 14:55:15,895 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 14:55:15,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:00:42,816 INFO core: Event loop thread started, running loop forever
2026-09-11 15:00:43,118 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 15:00:43,121 INFO core: _init_accounts coroutine started
2026-09-11 15:00:43,124 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 15:00:43,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:05:13,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:10:20,384 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 15:10:20,385 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 15:10:20,385 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-11 15:10:20,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 15:10:20,386 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 15:10:20,386 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 15:10:20,386 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 15:10:20,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 15:10:20,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 15:10:22,857 INFO core: Event loop thread started, running loop forever
2026-09-11 15:10:23,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 15:10:23,172 INFO core: _init_accounts coroutine started
2026-09-11 15:10:23,172 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 15:10:23,181 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:15:15,385 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 15:15:15,385 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 15:15:15,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 15:15:15,388 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:15:15,389 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 15:20:18,831 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:25:11,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:30:25,111 INFO core: Event loop thread started, running loop forever
2026-09-11 15:30:25,412 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 15:30:25,421 INFO core: _init_accounts coroutine started
2026-09-11 15:30:25,423 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 15:30:25,426 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:35:12,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:40:21,844 INFO core: Event loop thread started, running loop forever
2026-09-11 15:40:22,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 15:40:22,150 INFO core: _init_accounts coroutine started
2026-09-11 15:40:22,150 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 15:40:22,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:45:03,347 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 15:45:22,862 INFO core: Event loop thread started, running loop forever
2026-09-11 15:45:23,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 15:45:23,173 INFO core: _init_accounts coroutine started
2026-09-11 15:45:23,175 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 15:45:23,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:50:20,854 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 15:50:20,855 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 15:50:20,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 15:55:26,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 15:55:26,396 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 15:55:52,168 INFO core: Event loop thread started, running loop forever
2026-09-11 15:55:52,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 15:55:52,483 INFO core: _init_accounts coroutine started
2026-09-11 15:55:52,484 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 15:55:52,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:00:32,309 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 16:00:32,309 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 16:00:32,313 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 16:00:32,315 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 16:00:32,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:05:39,369 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 16:05:39,370 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 16:05:39,370 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 16:05:46,769 INFO core: Event loop thread started, running loop forever
2026-09-11 16:05:47,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 16:05:47,081 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:10:17,742 INFO core: _init_accounts coroutine started
2026-09-11 16:10:17,743 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 16:10:17,752 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:15:17,913 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 16:15:17,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:20:17,927 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 16:20:17,929 INFO core: _init_accounts coroutine started
2026-09-11 16:20:17,929 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 16:20:17,935 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 16:20:17,935 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 16:20:17,936 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 16:20:17,937 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 16:20:17,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:25:34,637 INFO core: Event loop thread started, running loop forever
2026-09-11 16:25:34,938 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 16:25:34,943 INFO core: _init_accounts coroutine started
2026-09-11 16:25:34,943 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 16:25:34,953 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:30:45,256 INFO core: Event loop thread started, running loop forever
2026-09-11 16:30:45,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 16:30:45,564 INFO core: _init_accounts coroutine started
2026-09-11 16:30:45,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 16:30:45,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:35:12,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:40:19,394 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 16:40:29,508 INFO core: Event loop thread started, running loop forever
2026-09-11 16:40:29,810 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 16:40:29,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:45:36,427 INFO core: _init_accounts coroutine started
2026-09-11 16:45:36,428 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 16:45:37,042 INFO core: Event loop thread started, running loop forever
2026-09-11 16:45:37,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 16:45:37,347 INFO core: _init_accounts coroutine started
2026-09-11 16:45:37,349 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 16:45:37,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:50:44,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 16:50:46,640 INFO core: Event loop thread started, running loop forever
2026-09-11 16:50:46,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 16:50:46,945 INFO core: _init_accounts coroutine started
2026-09-11 16:50:46,946 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 16:50:46,953 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 16:50:46,958 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 16:55:06,599 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 16:55:06,604 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 16:55:06,606 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 16:55:06,608 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:00:12,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 17:00:25,798 INFO core: Event loop thread started, running loop forever
2026-09-11 17:00:26,099 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 17:00:26,102 INFO core: _init_accounts coroutine started
2026-09-11 17:00:26,104 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 17:00:26,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:05:49,111 INFO core: Event loop thread started, running loop forever
2026-09-11 17:05:49,412 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 17:05:49,416 INFO core: _init_accounts coroutine started
2026-09-11 17:05:49,418 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 17:05:49,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:10:13,284 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 17:10:13,284 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 17:10:13,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 17:10:13,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:15:13,970 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 17:15:13,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:20:11,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:25:13,594 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:30:20,467 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 17:30:20,468 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 17:30:25,756 INFO core: Event loop thread started, running loop forever
2026-09-11 17:30:26,057 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 17:30:26,061 INFO core: _init_accounts coroutine started
2026-09-11 17:30:26,062 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 17:30:26,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:35:43,150 INFO core: Event loop thread started, running loop forever
2026-09-11 17:35:43,451 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 17:35:43,457 INFO core: _init_accounts coroutine started
2026-09-11 17:35:43,463 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 17:35:43,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:40:14,359 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:45:21,485 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 17:45:23,468 INFO core: Event loop thread started, running loop forever
2026-09-11 17:45:23,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 17:45:23,773 INFO core: _init_accounts coroutine started
2026-09-11 17:45:23,775 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 17:45:23,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:50:35,350 INFO core: Event loop thread started, running loop forever
2026-09-11 17:50:35,655 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 17:50:35,660 INFO core: _init_accounts coroutine started
2026-09-11 17:50:35,661 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 17:50:35,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 17:55:24,552 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 17:55:24,552 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 17:55:24,554 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 17:55:24,555 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 17:55:24,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:00:03,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 18:00:03,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 18:00:03,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 18:00:11,223 INFO core: Event loop thread started, running loop forever
2026-09-11 18:00:11,526 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 18:00:11,530 INFO core: _init_accounts coroutine started
2026-09-11 18:00:11,530 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 18:00:11,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:05:10,499 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 18:05:10,503 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:10:14,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:15:37,352 INFO core: Event loop thread started, running loop forever
2026-09-11 18:15:37,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 18:15:37,656 INFO core: _init_accounts coroutine started
2026-09-11 18:15:37,658 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 18:15:37,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:20:10,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:25:16,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 18:25:16,397 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 18:25:16,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 18:25:16,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 18:25:16,402 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 18:25:16,402 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 18:25:16,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 18:25:16,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 18:25:33,015 INFO core: Event loop thread started, running loop forever
2026-09-11 18:25:33,317 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 18:25:33,320 INFO core: _init_accounts coroutine started
2026-09-11 18:25:33,321 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 18:25:33,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:30:28,889 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 18:30:28,889 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 18:30:28,892 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 18:30:28,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:30:28,895 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 18:35:34,409 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 18:35:34,410 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 18:35:47,139 INFO core: Event loop thread started, running loop forever
2026-09-11 18:35:47,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 18:35:47,443 INFO core: _init_accounts coroutine started
2026-09-11 18:35:47,446 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 18:35:47,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:40:20,015 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:45:07,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:45:07,520 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 18:45:07,520 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 18:50:35,904 INFO core: Event loop thread started, running loop forever
2026-09-11 18:50:36,205 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 18:50:36,208 INFO core: _init_accounts coroutine started
2026-09-11 18:50:36,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 18:50:36,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 18:55:18,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:00:25,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 19:00:25,404 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 19:00:44,168 INFO core: Event loop thread started, running loop forever
2026-09-11 19:00:44,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 19:00:44,472 INFO core: _init_accounts coroutine started
2026-09-11 19:00:44,474 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 19:00:44,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:05:21,184 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 19:05:21,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:10:19,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:15:11,599 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 19:15:11,599 INFO core: _init_accounts coroutine started
2026-09-11 19:15:11,600 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 19:15:11,602 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:20:50,505 INFO core: Event loop thread started, running loop forever
2026-09-11 19:20:50,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 19:20:50,810 INFO core: _init_accounts coroutine started
2026-09-11 19:20:50,811 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 19:20:50,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:25:27,487 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 19:25:27,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:30:33,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:35:07,199 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 19:35:07,200 INFO core: _init_accounts coroutine started
2026-09-11 19:35:07,200 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 19:35:07,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:35:07,208 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 19:40:13,353 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 19:40:13,353 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-11 19:40:13,354 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 19:40:13,355 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 19:40:32,729 INFO core: Event loop thread started, running loop forever
2026-09-11 19:40:33,034 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 19:40:33,039 INFO core: _init_accounts coroutine started
2026-09-11 19:40:33,041 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 19:40:33,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:45:26,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:50:11,971 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 19:50:11,971 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 19:50:11,972 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 19:50:11,973 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 19:50:12,007 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 19:55:25,088 INFO core: Event loop thread started, running loop forever
2026-09-11 19:55:25,389 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 19:55:25,392 INFO core: _init_accounts coroutine started
2026-09-11 19:55:25,393 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 19:55:25,421 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:00:32,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 20:00:32,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 20:00:32,406 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 20:00:32,407 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 20:00:32,407 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 20:00:32,407 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 20:00:32,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 20:00:32,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 20:00:43,521 INFO core: Event loop thread started, running loop forever
2026-09-11 20:00:43,822 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 20:00:43,826 INFO core: _init_accounts coroutine started
2026-09-11 20:00:43,830 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 20:00:43,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:05:39,687 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:10:13,389 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 20:10:13,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:15:54,184 INFO core: Event loop thread started, running loop forever
2026-09-11 20:15:54,485 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 20:15:54,488 INFO core: _init_accounts coroutine started
2026-09-11 20:15:54,490 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 20:15:54,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:20:33,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:20:33,885 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 20:20:33,900 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 20:20:33,902 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 20:20:33,903 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 20:25:52,515 INFO core: Event loop thread started, running loop forever
2026-09-11 20:25:52,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 20:25:52,819 INFO core: _init_accounts coroutine started
2026-09-11 20:25:52,820 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 20:25:52,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:30:07,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:35:13,376 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 20:35:40,636 INFO core: Event loop thread started, running loop forever
2026-09-11 20:35:40,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 20:35:40,943 INFO core: _init_accounts coroutine started
2026-09-11 20:35:40,944 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 20:35:40,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:40:31,500 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:40:31,501 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 20:40:31,502 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 20:45:38,383 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 20:45:38,385 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-11 20:45:47,363 INFO core: Event loop thread started, running loop forever
2026-09-11 20:45:47,664 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 20:45:47,672 INFO core: _init_accounts coroutine started
2026-09-11 20:45:47,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 20:45:47,688 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 20:45:47,689 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 20:45:47,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:45:47,691 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 20:50:08,144 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 20:50:08,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 20:55:26,791 INFO core: Event loop thread started, running loop forever
2026-09-11 20:55:27,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 20:55:27,094 INFO core: _init_accounts coroutine started
2026-09-11 20:55:27,096 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 20:55:27,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:00:05,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:05:13,140 INFO core: Event loop thread started, running loop forever
2026-09-11 21:05:13,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 21:05:13,444 INFO core: _init_accounts coroutine started
2026-09-11 21:05:13,445 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 21:05:13,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:10:11,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:15:17,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 21:15:22,687 INFO core: Event loop thread started, running loop forever
2026-09-11 21:15:22,989 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 21:15:22,994 INFO core: _init_accounts coroutine started
2026-09-11 21:15:22,994 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 21:15:23,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:20:29,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 21:20:29,826 INFO core: Event loop thread started, running loop forever
2026-09-11 21:20:30,127 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 21:20:30,131 INFO core: _init_accounts coroutine started
2026-09-11 21:20:30,132 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 21:20:30,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:25:42,552 INFO core: Event loop thread started, running loop forever
2026-09-11 21:25:42,853 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 21:25:42,858 INFO core: _init_accounts coroutine started
2026-09-11 21:25:42,860 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 21:25:42,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:25:42,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 21:25:42,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 21:30:14,958 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 21:30:14,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:35:19,849 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 21:35:19,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:40:18,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:45:38,949 INFO core: Event loop thread started, running loop forever
2026-09-11 21:45:39,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 21:45:39,258 INFO core: _init_accounts coroutine started
2026-09-11 21:45:39,259 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 21:45:39,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:50:45,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 21:50:49,848 INFO core: Event loop thread started, running loop forever
2026-09-11 21:50:50,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 21:50:50,152 INFO core: _init_accounts coroutine started
2026-09-11 21:50:50,153 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 21:50:50,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 21:55:47,159 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 21:55:47,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:00:16,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:05:18,065 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-11 22:05:18,066 INFO core: _init_accounts coroutine started
2026-09-11 22:05:18,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 22:05:18,071 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 22:05:18,071 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 22:05:18,073 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 22:05:18,073 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:10:24,443 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 22:10:24,444 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-11 22:10:24,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 22:10:24,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-11 22:10:47,018 INFO core: Event loop thread started, running loop forever
2026-09-11 22:10:47,320 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 22:10:47,324 INFO core: _init_accounts coroutine started
2026-09-11 22:10:47,325 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 22:10:47,331 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:15:51,326 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 22:15:51,326 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 22:15:51,329 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 22:15:51,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:20:33,530 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 22:20:33,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:25:35,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:30:55,771 INFO core: Event loop thread started, running loop forever
2026-09-11 22:30:56,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 22:30:56,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:35:45,341 INFO core: _init_accounts coroutine started
2026-09-11 22:35:45,343 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 22:35:45,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:40:26,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:45:33,447 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 22:45:33,448 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 22:45:33,451 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 22:45:33,454 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 22:45:41,358 INFO core: Event loop thread started, running loop forever
2026-09-11 22:45:41,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 22:45:41,664 INFO core: _init_accounts coroutine started
2026-09-11 22:45:41,665 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 22:45:41,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:50:33,704 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 22:50:33,705 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 22:50:33,714 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 22:50:33,715 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 22:50:33,725 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-11 22:50:33,725 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-11 22:50:33,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:55:30,295 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-11 22:55:30,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 22:55:30,303 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-11 23:00:37,386 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-11 23:00:37,387 WARNING core: Account 2: connect timed out after 35s
2026-09-11 23:00:37,388 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-11 23:00:37,388 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-11 23:00:37,389 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-11 23:00:37,390 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-11 23:00:37,390 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-11 23:00:49,846 INFO core: Event loop thread started, running loop forever
2026-09-11 23:00:50,147 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 23:00:50,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:05:19,895 INFO core: _init_accounts coroutine started
2026-09-11 23:05:19,896 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 23:05:19,904 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 23:05:19,905 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 23:05:19,914 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 23:05:19,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:10:24,538 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 23:10:24,543 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:15:43,124 INFO core: Event loop thread started, running loop forever
2026-09-11 23:15:43,425 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 23:15:43,428 INFO core: _init_accounts coroutine started
2026-09-11 23:15:43,430 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 23:15:43,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:20:33,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:25:08,488 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-11 23:25:08,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:30:07,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:35:29,926 INFO core: Event loop thread started, running loop forever
2026-09-11 23:35:30,227 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 23:35:30,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:40:36,461 INFO core: _init_accounts coroutine started
2026-09-11 23:40:39,990 INFO core: Event loop thread started, running loop forever
2026-09-11 23:40:40,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-11 23:40:40,295 INFO core: _init_accounts coroutine started
2026-09-11 23:40:40,297 INFO core: _init_accounts_inner: starting DB migrations
2026-09-11 23:40:40,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:45:42,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:45:42,286 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-11 23:45:42,287 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-11 23:45:42,288 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-11 23:50:43,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-11 23:55:40,395 INFO core: _init_accounts_inner: reloading LLM config
2026-09-11 23:55:40,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:00:48,730 INFO core: Event loop thread started, running loop forever
2026-09-12 00:00:49,040 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 00:00:49,045 INFO core: _init_accounts coroutine started
2026-09-12 00:00:49,046 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 00:00:49,193 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:05:14,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:10:21,446 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 00:10:21,447 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 00:10:21,447 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-12 00:10:21,448 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 00:10:21,448 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 00:10:21,448 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 00:10:21,448 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 00:10:21,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 00:10:21,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 00:10:24,371 INFO core: Event loop thread started, running loop forever
2026-09-12 00:10:24,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 00:10:24,675 INFO core: _init_accounts coroutine started
2026-09-12 00:10:24,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:10:24,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 00:10:24,694 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 00:10:24,694 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 00:10:24,695 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 00:10:24,696 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 00:15:24,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:20:12,227 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 00:20:12,228 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 00:20:12,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:25:19,412 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 00:25:40,963 INFO core: Event loop thread started, running loop forever
2026-09-12 00:25:41,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 00:25:41,268 INFO core: _init_accounts coroutine started
2026-09-12 00:25:41,271 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 00:25:41,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:30:13,786 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 00:30:13,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:35:50,498 INFO core: Event loop thread started, running loop forever
2026-09-12 00:35:50,801 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 00:35:50,806 INFO core: _init_accounts coroutine started
2026-09-12 00:35:50,806 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 00:35:50,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:40:18,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:45:48,989 INFO core: Event loop thread started, running loop forever
2026-09-12 00:45:49,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 00:45:49,294 INFO core: _init_accounts coroutine started
2026-09-12 00:45:49,294 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 00:45:49,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:50:51,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 00:55:51,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:00:21,422 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 01:00:21,441 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:05:35,980 INFO core: Event loop thread started, running loop forever
2026-09-12 01:05:36,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 01:05:36,289 INFO core: _init_accounts coroutine started
2026-09-12 01:05:36,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 01:05:36,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:10:33,192 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 01:10:33,193 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 01:10:33,194 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 01:10:33,197 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 01:10:33,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:15:40,486 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 01:15:45,856 INFO core: Event loop thread started, running loop forever
2026-09-12 01:15:46,157 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 01:15:46,163 INFO core: _init_accounts coroutine started
2026-09-12 01:15:46,164 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 01:15:46,168 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:20:12,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:25:33,240 INFO core: Event loop thread started, running loop forever
2026-09-12 01:25:33,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 01:25:33,547 INFO core: _init_accounts coroutine started
2026-09-12 01:25:33,547 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 01:25:33,554 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:30:40,486 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 01:30:40,833 INFO core: Event loop thread started, running loop forever
2026-09-12 01:30:41,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 01:30:41,139 INFO core: _init_accounts coroutine started
2026-09-12 01:30:41,141 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 01:30:41,148 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:35:47,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:40:28,028 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 01:40:28,028 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 01:40:28,036 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 01:40:28,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:40:28,038 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 01:45:25,192 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 01:45:25,192 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 01:45:25,197 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 01:45:25,198 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 01:45:25,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:50:12,199 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 01:50:12,199 WARNING core: Account 2: connect timed out after 35s
2026-09-12 01:50:12,200 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-12 01:50:12,201 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-12 01:50:12,202 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 01:50:12,203 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-12 01:50:12,204 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-12 01:50:12,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 01:55:06,000 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 01:55:06,000 WARNING core: Account 2: connect timed out after 35s
2026-09-12 01:55:06,002 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-12 01:55:06,003 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-12 01:55:06,004 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 01:55:06,006 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-12 01:55:06,006 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-12 01:55:06,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:00:13,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 02:00:13,383 WARNING core: Account 2: connect timed out after 35s
2026-09-12 02:00:13,383 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-12 02:00:13,384 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-12 02:00:13,384 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 02:00:13,385 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-12 02:00:13,385 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-12 02:00:50,887 INFO core: Event loop thread started, running loop forever
2026-09-12 02:00:51,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 02:00:51,195 INFO core: _init_accounts coroutine started
2026-09-12 02:00:51,195 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 02:00:51,204 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:05:16,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:10:22,496 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 02:10:35,882 INFO core: Event loop thread started, running loop forever
2026-09-12 02:10:36,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 02:10:36,193 INFO core: _init_accounts coroutine started
2026-09-12 02:10:36,206 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 02:10:36,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:15:29,848 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:20:21,583 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 02:20:21,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 02:20:21,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:25:28,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 02:25:28,402 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 02:25:28,534 INFO core: Event loop thread started, running loop forever
2026-09-12 02:25:28,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 02:25:28,850 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:30:34,399 INFO core: _init_accounts coroutine started
2026-09-12 02:30:34,400 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 02:30:34,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 02:30:38,384 INFO core: Event loop thread started, running loop forever
2026-09-12 02:30:38,685 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 02:30:38,688 INFO core: _init_accounts coroutine started
2026-09-12 02:30:38,690 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 02:30:38,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:35:09,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:40:45,318 INFO core: Event loop thread started, running loop forever
2026-09-12 02:40:45,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 02:40:45,622 INFO core: _init_accounts coroutine started
2026-09-12 02:40:45,624 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 02:40:45,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:45:39,271 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 02:45:39,271 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 02:45:39,276 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 02:45:39,279 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 02:45:39,292 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:50:20,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 02:55:27,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 02:55:32,657 INFO core: Event loop thread started, running loop forever
2026-09-12 02:55:32,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 02:55:32,961 INFO core: _init_accounts coroutine started
2026-09-12 02:55:32,963 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 02:55:32,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:00:02,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 03:00:29,946 INFO core: Event loop thread started, running loop forever
2026-09-12 03:00:30,248 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 03:00:30,252 INFO core: _init_accounts coroutine started
2026-09-12 03:00:30,253 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 03:00:30,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:05:11,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:10:18,375 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 03:10:49,158 INFO core: Event loop thread started, running loop forever
2026-09-12 03:10:49,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 03:10:49,462 INFO core: _init_accounts coroutine started
2026-09-12 03:10:49,465 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 03:10:49,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:15:39,859 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 03:15:39,860 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 03:15:39,864 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 03:15:39,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:20:05,999 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 03:20:06,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:25:14,216 INFO core: Event loop thread started, running loop forever
2026-09-12 03:25:14,516 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 03:25:14,519 INFO core: _init_accounts coroutine started
2026-09-12 03:25:14,521 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 03:25:14,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:30:21,370 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 03:30:49,796 INFO core: Event loop thread started, running loop forever
2026-09-12 03:30:50,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 03:30:50,099 INFO core: _init_accounts coroutine started
2026-09-12 03:30:50,100 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 03:30:50,108 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:35:29,110 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 03:35:29,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:35:29,113 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 03:40:35,190 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 03:40:35,202 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 03:40:35,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:45:38,094 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 03:45:38,094 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 03:45:38,098 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 03:45:38,099 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 03:45:38,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:50:44,410 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 03:50:44,411 WARNING core: Account 2: connect timed out after 35s
2026-09-12 03:50:44,412 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-12 03:50:44,954 INFO core: Event loop thread started, running loop forever
2026-09-12 03:50:45,255 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 03:50:45,263 INFO core: _init_accounts coroutine started
2026-09-12 03:50:45,263 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 03:50:45,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 03:55:36,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:00:48,249 INFO core: Event loop thread started, running loop forever
2026-09-12 04:00:48,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 04:00:48,554 INFO core: _init_accounts coroutine started
2026-09-12 04:00:48,556 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 04:00:48,570 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:00:48,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 04:00:48,573 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 04:00:48,575 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 04:00:48,579 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 04:05:24,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:10:05,339 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 04:10:05,340 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 04:10:05,348 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 04:10:05,349 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 04:10:05,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:15:12,426 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 04:15:12,426 WARNING core: Account 2: connect timed out after 35s
2026-09-12 04:15:12,427 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-12 04:15:12,427 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-12 04:15:12,428 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 04:15:12,429 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-12 04:15:12,429 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-12 04:15:37,112 INFO core: Event loop thread started, running loop forever
2026-09-12 04:15:37,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 04:15:37,417 INFO core: _init_accounts coroutine started
2026-09-12 04:15:37,418 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 04:15:37,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:20:11,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:25:18,468 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 04:25:23,907 INFO core: Event loop thread started, running loop forever
2026-09-12 04:25:24,208 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 04:25:24,210 INFO core: _init_accounts coroutine started
2026-09-12 04:25:24,211 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 04:25:24,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:30:47,995 INFO core: Event loop thread started, running loop forever
2026-09-12 04:30:48,296 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 04:30:48,302 INFO core: _init_accounts coroutine started
2026-09-12 04:30:48,303 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 04:30:48,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:30:48,341 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 04:30:48,357 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 04:30:48,358 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 04:30:48,360 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 04:35:21,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:40:28,400 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 04:40:46,002 INFO core: Event loop thread started, running loop forever
2026-09-12 04:40:46,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 04:40:46,311 INFO core: _init_accounts coroutine started
2026-09-12 04:40:46,312 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 04:40:46,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:45:48,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:50:33,686 INFO core: Event loop thread started, running loop forever
2026-09-12 04:50:33,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 04:50:33,997 INFO core: _init_accounts coroutine started
2026-09-12 04:50:33,998 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 04:50:34,004 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 04:50:55,707 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 04:55:12,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:00:15,383 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 05:00:15,400 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:05:41,745 INFO core: Event loop thread started, running loop forever
2026-09-12 05:05:42,046 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 05:05:42,049 INFO core: _init_accounts coroutine started
2026-09-12 05:05:42,051 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 05:05:42,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:10:05,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:15:21,286 INFO core: Event loop thread started, running loop forever
2026-09-12 05:15:21,587 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 05:15:21,592 INFO core: _init_accounts coroutine started
2026-09-12 05:15:21,593 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 05:15:21,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:20:26,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:25:37,029 INFO core: Event loop thread started, running loop forever
2026-09-12 05:25:37,330 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 05:25:37,333 INFO core: _init_accounts coroutine started
2026-09-12 05:25:37,334 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 05:25:37,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:30:25,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:30:25,714 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 05:30:25,715 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 05:35:31,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 05:35:31,416 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 05:35:31,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 05:35:31,417 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 05:35:31,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 05:35:31,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 05:35:43,613 INFO core: Event loop thread started, running loop forever
2026-09-12 05:35:43,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 05:35:43,920 INFO core: _init_accounts coroutine started
2026-09-12 05:35:43,921 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 05:35:43,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:40:05,759 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 05:40:05,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:40:05,763 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 05:40:05,765 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 05:45:11,451 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 05:45:36,902 INFO core: Event loop thread started, running loop forever
2026-09-12 05:45:37,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 05:45:37,208 INFO core: _init_accounts coroutine started
2026-09-12 05:45:37,210 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 05:45:37,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:50:18,347 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 05:50:18,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 05:55:11,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:00:43,091 INFO core: Event loop thread started, running loop forever
2026-09-12 06:00:43,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 06:00:43,403 INFO core: _init_accounts coroutine started
2026-09-12 06:00:43,403 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 06:00:43,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:00:43,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 06:00:43,419 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 06:05:39,806 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 06:05:39,813 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:10:21,772 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 06:10:21,794 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 06:10:21,794 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 06:10:21,799 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 06:10:21,800 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 06:10:21,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:15:47,148 INFO core: Event loop thread started, running loop forever
2026-09-12 06:15:47,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 06:15:47,454 INFO core: _init_accounts coroutine started
2026-09-12 06:15:47,454 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 06:15:47,464 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:20:13,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:25:22,405 INFO core: Event loop thread started, running loop forever
2026-09-12 06:25:22,706 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 06:25:22,716 INFO core: _init_accounts coroutine started
2026-09-12 06:25:22,717 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 06:25:22,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:30:51,264 INFO core: Event loop thread started, running loop forever
2026-09-12 06:30:51,565 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 06:30:51,571 INFO core: _init_accounts coroutine started
2026-09-12 06:30:51,572 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 06:30:51,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:30:51,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 06:30:51,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 06:30:51,587 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 06:35:42,432 INFO core: Event loop thread started, running loop forever
2026-09-12 06:35:42,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 06:35:42,739 INFO core: _init_accounts coroutine started
2026-09-12 06:35:42,739 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 06:35:42,748 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-12 06:35:42,759 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-12 06:35:58,446 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 06:35:58,485 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 06:35:58,485 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 06:35:58,486 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 06:40:12,785 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:45:03,988 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-12 06:45:03,990 INFO core: _init_accounts coroutine started
2026-09-12 06:45:03,990 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 06:45:04,013 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:50:11,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 06:50:31,913 INFO core: Event loop thread started, running loop forever
2026-09-12 06:50:32,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 06:50:32,219 INFO core: _init_accounts coroutine started
2026-09-12 06:50:32,220 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 06:50:32,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 06:55:05,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:00:12,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 07:00:12,409 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 07:00:17,199 INFO core: Event loop thread started, running loop forever
2026-09-12 07:00:17,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 07:00:17,506 INFO core: _init_accounts coroutine started
2026-09-12 07:00:17,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 07:00:17,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:05:22,152 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 07:05:22,153 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 07:05:22,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:10:05,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 07:10:05,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:15:12,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 07:15:12,432 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 07:15:12,433 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 07:15:12,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 07:15:34,659 INFO core: Event loop thread started, running loop forever
2026-09-12 07:15:34,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 07:15:34,969 INFO core: _init_accounts coroutine started
2026-09-12 07:15:34,971 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 07:15:34,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:20:13,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:25:08,921 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 07:25:08,921 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 07:25:08,923 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 07:25:08,924 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 07:25:08,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:30:14,412 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 07:30:14,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 07:30:14,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 07:30:32,828 INFO core: Event loop thread started, running loop forever
2026-09-12 07:30:33,129 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 07:30:33,132 INFO core: _init_accounts coroutine started
2026-09-12 07:30:33,133 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 07:30:33,141 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:30:33,142 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 07:30:33,142 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 07:35:22,893 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 07:35:22,897 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 07:35:22,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:40:22,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:45:20,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:50:23,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:55:11,925 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 07:55:11,929 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 07:55:11,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 07:55:11,937 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 08:00:17,433 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 08:00:39,653 INFO core: Event loop thread started, running loop forever
2026-09-12 08:00:39,955 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 08:00:39,960 INFO core: _init_accounts coroutine started
2026-09-12 08:00:39,962 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 08:00:39,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:05:13,881 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 08:05:13,882 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 08:05:13,884 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 08:05:13,885 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 08:05:13,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:10:16,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:15:13,734 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 08:15:13,734 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 08:15:13,741 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 08:15:13,742 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 08:15:13,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:20:07,504 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 08:20:07,505 WARNING core: Account 2: connect timed out after 35s
2026-09-12 08:20:07,505 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-12 08:20:07,506 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-12 08:20:07,507 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 08:20:07,509 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-12 08:20:07,514 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-12 08:20:07,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:25:14,468 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 08:25:14,476 WARNING core: Account 2: connect timed out after 35s
2026-09-12 08:25:14,477 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-12 08:25:14,477 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-12 08:25:14,478 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 08:25:14,479 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-12 08:25:14,480 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-12 08:25:44,573 INFO core: Event loop thread started, running loop forever
2026-09-12 08:25:44,875 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 08:25:44,882 INFO core: _init_accounts coroutine started
2026-09-12 08:25:44,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 08:25:44,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:30:43,335 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 08:30:43,336 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 08:30:43,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:35:15,243 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 08:35:15,249 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:40:22,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 08:40:22,401 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 08:40:52,633 INFO core: Event loop thread started, running loop forever
2026-09-12 08:40:52,934 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 08:40:52,940 INFO core: _init_accounts coroutine started
2026-09-12 08:40:52,941 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 08:40:52,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:45:30,459 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 08:45:30,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:45:30,460 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 08:45:30,462 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 08:50:17,675 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 08:50:17,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 08:55:21,644 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:00:28,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 09:00:44,819 INFO core: Event loop thread started, running loop forever
2026-09-12 09:00:45,120 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 09:00:45,126 INFO core: _init_accounts coroutine started
2026-09-12 09:00:45,126 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 09:00:45,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:05:31,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:10:41,361 INFO core: Event loop thread started, running loop forever
2026-09-12 09:10:41,662 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 09:10:41,669 INFO core: _init_accounts coroutine started
2026-09-12 09:10:41,669 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 09:10:41,687 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:15:36,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:20:54,773 INFO core: Event loop thread started, running loop forever
2026-09-12 09:20:55,075 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 09:20:55,078 INFO core: _init_accounts coroutine started
2026-09-12 09:20:55,080 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 09:20:55,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:25:47,722 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 09:25:47,722 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 09:25:47,724 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 09:25:47,726 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 09:25:47,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:30:06,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:30:06,304 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 09:30:06,308 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 09:30:06,320 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 09:30:06,321 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 09:35:13,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 09:35:36,058 INFO core: Event loop thread started, running loop forever
2026-09-12 09:35:36,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 09:35:36,362 INFO core: _init_accounts coroutine started
2026-09-12 09:35:36,365 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 09:35:36,370 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:40:11,763 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 09:40:11,763 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 09:40:11,765 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 09:40:11,766 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 09:40:11,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:45:50,720 INFO core: Event loop thread started, running loop forever
2026-09-12 09:45:51,021 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 09:45:51,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:50:04,928 INFO core: _init_accounts coroutine started
2026-09-12 09:50:04,930 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 09:50:04,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 09:55:30,483 INFO core: Event loop thread started, running loop forever
2026-09-12 09:55:30,784 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 09:55:30,787 INFO core: _init_accounts coroutine started
2026-09-12 09:55:30,789 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 09:55:30,797 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:00:37,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 10:00:48,030 INFO core: Event loop thread started, running loop forever
2026-09-12 10:00:48,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 10:00:48,336 INFO core: _init_accounts coroutine started
2026-09-12 10:00:48,337 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 10:00:48,342 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:05:39,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:05:39,336 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 10:05:39,336 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 10:10:28,451 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 10:10:28,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:10:28,454 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 10:15:30,953 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:20:29,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:25:35,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 10:25:49,991 INFO core: Event loop thread started, running loop forever
2026-09-12 10:25:50,293 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 10:25:50,300 INFO core: _init_accounts coroutine started
2026-09-12 10:25:50,301 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 10:25:50,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:30:50,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:35:45,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:40:45,320 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 10:40:45,320 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 10:40:45,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:45:46,616 INFO core: Event loop thread started, running loop forever
2026-09-12 10:45:46,917 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 10:45:46,922 INFO core: _init_accounts coroutine started
2026-09-12 10:45:46,923 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 10:45:46,932 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:50:24,865 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 10:50:24,868 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 10:55:16,541 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 10:55:16,544 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 10:55:16,545 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 10:55:16,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:00:14,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:05:20,412 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 11:05:28,834 INFO core: Event loop thread started, running loop forever
2026-09-12 11:05:29,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 11:05:29,144 INFO core: _init_accounts coroutine started
2026-09-12 11:05:29,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 11:05:29,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:10:35,385 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 11:10:42,026 INFO core: Event loop thread started, running loop forever
2026-09-12 11:10:42,327 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 11:10:42,331 INFO core: _init_accounts coroutine started
2026-09-12 11:10:42,332 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 11:10:42,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:15:36,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:20:13,092 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:25:22,162 INFO core: Event loop thread started, running loop forever
2026-09-12 11:25:22,465 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 11:25:22,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:30:29,404 INFO core: _init_accounts coroutine started
2026-09-12 11:30:37,520 INFO core: Event loop thread started, running loop forever
2026-09-12 11:30:37,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 11:30:37,828 INFO core: _init_accounts coroutine started
2026-09-12 11:30:37,829 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 11:30:37,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:35:06,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:40:12,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 11:40:46,455 INFO core: Event loop thread started, running loop forever
2026-09-12 11:40:46,757 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 11:40:46,763 INFO core: _init_accounts coroutine started
2026-09-12 11:40:46,765 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 11:40:46,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:45:26,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:50:32,479 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 11:50:32,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 11:50:32,480 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-12 11:50:32,481 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 11:50:45,485 INFO core: Event loop thread started, running loop forever
2026-09-12 11:50:45,787 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 11:50:45,791 INFO core: _init_accounts coroutine started
2026-09-12 11:50:45,794 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 11:50:45,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:55:10,177 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 11:55:10,179 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 11:55:10,182 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 11:55:10,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 11:55:10,184 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 12:00:16,498 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 12:00:40,060 INFO core: Event loop thread started, running loop forever
2026-09-12 12:00:40,370 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 12:00:40,376 INFO core: _init_accounts coroutine started
2026-09-12 12:00:40,377 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 12:00:40,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:05:50,044 INFO core: Event loop thread started, running loop forever
2026-09-12 12:05:50,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 12:05:50,355 INFO core: _init_accounts coroutine started
2026-09-12 12:05:50,356 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 12:05:50,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:10:50,784 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 12:10:50,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:15:11,786 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:20:45,060 INFO core: Event loop thread started, running loop forever
2026-09-12 12:20:45,361 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 12:20:45,368 INFO core: _init_accounts coroutine started
2026-09-12 12:20:45,371 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:20:45,381 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 12:25:43,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:30:27,015 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 12:30:27,015 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 12:30:27,017 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 12:30:27,018 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 12:30:27,031 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:35:50,841 INFO core: Event loop thread started, running loop forever
2026-09-12 12:35:51,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 12:35:51,150 INFO core: _init_accounts coroutine started
2026-09-12 12:35:51,151 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 12:35:51,161 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:40:22,549 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 12:40:22,549 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 12:40:22,550 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 12:40:22,555 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:45:29,406 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 12:45:29,407 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 12:45:33,988 INFO core: Event loop thread started, running loop forever
2026-09-12 12:45:34,291 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 12:45:34,302 INFO core: _init_accounts coroutine started
2026-09-12 12:45:34,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 12:45:34,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:50:18,235 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 12:50:18,270 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 12:50:18,238 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 12:55:13,077 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 12:55:13,078 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:00:35,100 INFO core: Event loop thread started, running loop forever
2026-09-12 13:00:35,401 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 13:00:35,408 INFO core: _init_accounts coroutine started
2026-09-12 13:00:35,409 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 13:00:35,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:05:18,473 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 13:05:18,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:10:42,371 INFO core: Event loop thread started, running loop forever
2026-09-12 13:10:42,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 13:10:42,682 INFO core: _init_accounts coroutine started
2026-09-12 13:10:42,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 13:10:42,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:15:08,575 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 13:15:08,575 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 13:15:08,577 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 13:15:08,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:20:23,253 INFO core: Event loop thread started, running loop forever
2026-09-12 13:20:23,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 13:20:23,557 INFO core: _init_accounts coroutine started
2026-09-12 13:20:23,560 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 13:20:23,577 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 13:20:23,578 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 13:20:23,579 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 13:20:23,580 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 13:20:23,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:25:42,757 INFO core: Event loop thread started, running loop forever
2026-09-12 13:25:43,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 13:25:43,066 INFO core: _init_accounts coroutine started
2026-09-12 13:25:43,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 13:25:43,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:30:08,388 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 13:30:08,389 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 13:30:08,391 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 13:30:08,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 13:30:08,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:35:20,972 INFO core: Event loop thread started, running loop forever
2026-09-12 13:35:21,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 13:35:21,277 INFO core: _init_accounts coroutine started
2026-09-12 13:35:21,279 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 13:35:21,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:40:11,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:45:11,039 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 13:45:11,039 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 13:45:11,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:50:18,358 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 13:50:18,359 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 13:50:18,359 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 13:50:18,360 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 13:50:18,360 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 13:50:18,360 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 13:50:25,273 INFO core: Event loop thread started, running loop forever
2026-09-12 13:50:25,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 13:50:25,582 INFO core: _init_accounts coroutine started
2026-09-12 13:50:25,582 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 13:50:25,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 13:55:17,551 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 13:55:17,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:00:53,532 INFO core: Event loop thread started, running loop forever
2026-09-12 14:00:53,833 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 14:00:53,837 INFO core: _init_accounts coroutine started
2026-09-12 14:00:53,839 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 14:00:53,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:05:53,874 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 14:05:53,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:10:53,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:15:37,977 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-12 14:15:37,978 INFO core: _init_accounts coroutine started
2026-09-12 14:15:37,978 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 14:15:37,987 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 14:15:37,987 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 14:15:37,989 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 14:15:37,992 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:20:23,398 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 14:20:23,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:25:30,438 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 14:25:30,438 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 14:25:30,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 14:25:48,209 INFO core: Event loop thread started, running loop forever
2026-09-12 14:25:48,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 14:25:48,513 INFO core: _init_accounts coroutine started
2026-09-12 14:25:48,513 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 14:25:48,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:30:44,014 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:30:44,015 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 14:30:44,015 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 14:35:20,541 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 14:35:20,543 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:40:24,439 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 14:40:24,464 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:45:11,520 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:50:37,697 INFO core: Event loop thread started, running loop forever
2026-09-12 14:50:37,998 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 14:50:38,001 INFO core: _init_accounts coroutine started
2026-09-12 14:50:38,004 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 14:50:38,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 14:55:44,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 14:55:47,042 INFO core: Event loop thread started, running loop forever
2026-09-12 14:55:47,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 14:55:47,348 INFO core: _init_accounts coroutine started
2026-09-12 14:55:47,348 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 14:55:47,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:00:46,651 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 15:00:46,651 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 15:00:46,660 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:05:05,029 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 15:05:05,032 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 15:05:05,048 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:10:20,505 INFO core: Event loop thread started, running loop forever
2026-09-12 15:10:20,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 15:10:20,813 INFO core: _init_accounts coroutine started
2026-09-12 15:10:20,814 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 15:10:20,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:15:16,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:20:04,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:25:09,327 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 15:25:09,328 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 15:25:09,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:30:25,504 INFO core: Event loop thread started, running loop forever
2026-09-12 15:30:25,805 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 15:30:25,813 INFO core: _init_accounts coroutine started
2026-09-12 15:30:25,814 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 15:30:25,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:35:32,272 INFO core: Event loop thread started, running loop forever
2026-09-12 15:35:32,274 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 15:35:32,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 15:35:32,577 INFO core: _init_accounts coroutine started
2026-09-12 15:35:32,577 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 15:35:32,596 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 15:35:32,596 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 15:35:32,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:35:32,600 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 15:40:51,237 INFO core: Event loop thread started, running loop forever
2026-09-12 15:40:51,539 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 15:40:51,545 INFO core: _init_accounts coroutine started
2026-09-12 15:40:51,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:40:51,557 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 15:45:08,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:50:30,581 INFO core: Event loop thread started, running loop forever
2026-09-12 15:50:30,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 15:50:30,884 INFO core: _init_accounts coroutine started
2026-09-12 15:50:30,885 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 15:50:30,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 15:55:29,054 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:00:07,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 16:00:07,408 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 16:00:07,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 16:00:07,439 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 16:00:07,440 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 16:00:07,440 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 16:00:07,441 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 16:00:07,441 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 16:00:13,602 INFO core: Event loop thread started, running loop forever
2026-09-12 16:00:13,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 16:00:13,908 INFO core: _init_accounts coroutine started
2026-09-12 16:00:13,909 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 16:00:13,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:05:27,915 INFO core: Event loop thread started, running loop forever
2026-09-12 16:05:28,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 16:05:28,228 INFO core: _init_accounts coroutine started
2026-09-12 16:05:28,228 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 16:05:28,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:10:36,440 INFO core: Event loop thread started, running loop forever
2026-09-12 16:10:36,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 16:10:36,745 INFO core: _init_accounts coroutine started
2026-09-12 16:10:36,746 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 16:10:36,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:15:15,871 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 16:15:15,871 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 16:15:15,872 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 16:15:15,873 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 16:15:15,884 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 16:15:15,885 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 16:15:15,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:20:08,465 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 16:20:08,468 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 16:20:08,480 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:25:15,427 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 16:25:34,040 INFO core: Event loop thread started, running loop forever
2026-09-12 16:25:34,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 16:25:34,344 INFO core: _init_accounts coroutine started
2026-09-12 16:25:34,345 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 16:25:34,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:30:14,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 16:30:14,626 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 16:30:14,627 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:35:11,305 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 16:35:11,308 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 16:35:11,318 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 16:35:11,318 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 16:35:11,322 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 16:35:11,323 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 16:35:11,324 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:40:14,738 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 16:40:14,740 WARNING core: Account 2: connect timed out after 35s
2026-09-12 16:40:14,742 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-12 16:40:14,744 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-12 16:40:14,746 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 16:40:14,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:40:14,748 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-12 16:40:14,750 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-12 16:45:18,967 WARNING core: Account 2: connect timed out after 35s
2026-09-12 16:45:18,968 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-12 16:45:18,968 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-12 16:45:18,968 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 16:45:18,969 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-12 16:45:18,969 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-12 16:45:18,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:50:24,478 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 16:50:24,478 WARNING core: Account 2: connect timed out after 35s
2026-09-12 16:50:24,478 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-12 16:50:24,479 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-12 16:50:24,479 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 16:50:24,480 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-12 16:50:24,480 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-12 16:50:37,599 INFO core: Event loop thread started, running loop forever
2026-09-12 16:50:37,901 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 16:50:37,904 INFO core: _init_accounts coroutine started
2026-09-12 16:50:37,906 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 16:50:37,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 16:55:16,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:00:32,245 INFO core: Event loop thread started, running loop forever
2026-09-12 17:00:32,546 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 17:00:32,550 INFO core: _init_accounts coroutine started
2026-09-12 17:00:32,552 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 17:00:32,562 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:05:45,063 INFO core: Event loop thread started, running loop forever
2026-09-12 17:05:45,364 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 17:05:45,369 INFO core: _init_accounts coroutine started
2026-09-12 17:05:45,369 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 17:05:45,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:10:47,103 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 17:10:47,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:15:24,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:20:33,517 INFO core: Event loop thread started, running loop forever
2026-09-12 17:20:33,818 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 17:20:33,823 INFO core: _init_accounts coroutine started
2026-09-12 17:20:33,823 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 17:20:33,830 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 17:20:33,831 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 17:20:33,831 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 17:20:33,832 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 17:20:33,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:25:20,492 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:30:26,359 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 17:30:49,587 INFO core: Event loop thread started, running loop forever
2026-09-12 17:30:49,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 17:30:49,895 INFO core: _init_accounts coroutine started
2026-09-12 17:30:49,895 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 17:30:49,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:35:06,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:40:12,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 17:40:12,421 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 17:40:12,426 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 17:40:12,428 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 17:40:40,663 INFO core: Event loop thread started, running loop forever
2026-09-12 17:40:40,964 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 17:40:40,967 INFO core: _init_accounts coroutine started
2026-09-12 17:40:40,968 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 17:40:40,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:45:07,130 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 17:45:07,131 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 17:45:07,133 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 17:45:07,135 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:50:40,110 INFO core: Event loop thread started, running loop forever
2026-09-12 17:50:40,411 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 17:50:40,416 INFO core: _init_accounts coroutine started
2026-09-12 17:50:40,416 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 17:50:40,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 17:55:09,053 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 17:55:09,053 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 17:55:09,054 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 17:55:09,056 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 17:55:09,073 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 17:55:09,073 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 17:55:09,077 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 17:55:09,078 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 17:55:09,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:00:05,566 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 18:00:05,567 WARNING core: Account 2: connect timed out after 35s
2026-09-12 18:00:05,568 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-12 18:00:05,569 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-12 18:00:05,570 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 18:00:05,571 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-12 18:00:05,572 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-12 18:00:05,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:05:12,395 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 18:05:29,023 INFO core: Event loop thread started, running loop forever
2026-09-12 18:05:29,323 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 18:05:29,329 INFO core: _init_accounts coroutine started
2026-09-12 18:05:29,330 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 18:05:29,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:10:17,157 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 18:10:17,157 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 18:10:17,158 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 18:10:17,160 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 18:10:17,161 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:15:51,715 INFO core: Event loop thread started, running loop forever
2026-09-12 18:15:52,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 18:15:52,020 INFO core: _init_accounts coroutine started
2026-09-12 18:15:52,021 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 18:15:52,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:20:39,508 INFO core: Event loop thread started, running loop forever
2026-09-12 18:20:39,809 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 18:20:39,813 INFO core: _init_accounts coroutine started
2026-09-12 18:20:39,816 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 18:20:39,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:20:58,534 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 18:25:46,346 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 18:25:50,094 INFO core: Event loop thread started, running loop forever
2026-09-12 18:25:50,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 18:25:50,398 INFO core: _init_accounts coroutine started
2026-09-12 18:25:50,399 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 18:25:50,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:30:41,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 18:30:41,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:30:41,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 18:35:35,874 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:40:33,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 18:40:33,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:40:33,290 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 18:45:48,901 INFO core: Event loop thread started, running loop forever
2026-09-12 18:45:49,202 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 18:45:49,205 INFO core: _init_accounts coroutine started
2026-09-12 18:45:49,207 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 18:45:49,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:50:35,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 18:55:11,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:00:18,397 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 19:00:50,976 INFO core: Event loop thread started, running loop forever
2026-09-12 19:00:51,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 19:00:51,282 INFO core: _init_accounts coroutine started
2026-09-12 19:00:51,282 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 19:00:51,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:05:09,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:10:18,258 INFO core: Event loop thread started, running loop forever
2026-09-12 19:10:18,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 19:10:18,562 INFO core: _init_accounts coroutine started
2026-09-12 19:10:18,565 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 19:10:18,570 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:15:25,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 19:15:33,662 INFO core: Event loop thread started, running loop forever
2026-09-12 19:15:33,963 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 19:15:33,967 INFO core: _init_accounts coroutine started
2026-09-12 19:15:33,969 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 19:15:33,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:20:16,080 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 19:20:16,080 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 19:20:16,081 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:25:10,804 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 19:25:10,809 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 19:25:10,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:30:16,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 19:30:16,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 19:30:16,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 19:30:36,166 INFO core: Event loop thread started, running loop forever
2026-09-12 19:30:36,467 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 19:30:36,471 INFO core: _init_accounts coroutine started
2026-09-12 19:30:36,472 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 19:30:36,481 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:35:38,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:40:45,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 19:40:45,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 19:40:45,412 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-12 19:40:45,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 19:40:45,412 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 19:40:45,412 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 19:40:45,413 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 19:40:45,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 19:40:45,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 19:40:48,922 INFO core: Event loop thread started, running loop forever
2026-09-12 19:40:49,224 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 19:40:49,226 INFO core: _init_accounts coroutine started
2026-09-12 19:40:49,228 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 19:40:49,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:45:40,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:50:46,389 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 19:50:46,389 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 19:50:46,390 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:50:46,391 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 19:55:49,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 19:55:49,513 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 20:00:15,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:05:21,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 20:05:21,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 20:05:21,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 20:05:30,826 INFO core: Event loop thread started, running loop forever
2026-09-12 20:05:31,127 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 20:05:31,131 INFO core: _init_accounts coroutine started
2026-09-12 20:05:31,133 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 20:05:31,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:10:03,901 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:15:07,920 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 20:15:07,938 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:20:38,976 INFO core: Event loop thread started, running loop forever
2026-09-12 20:20:39,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 20:20:39,281 INFO core: _init_accounts coroutine started
2026-09-12 20:20:39,282 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 20:20:39,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:25:17,901 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 20:25:17,902 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 20:25:17,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:30:24,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 20:30:24,419 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 20:30:24,419 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 20:30:24,419 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 20:30:24,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 20:30:39,543 INFO core: Event loop thread started, running loop forever
2026-09-12 20:30:39,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 20:30:39,847 INFO core: _init_accounts coroutine started
2026-09-12 20:30:39,849 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 20:30:39,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:35:21,526 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 20:35:21,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:40:49,203 INFO core: Event loop thread started, running loop forever
2026-09-12 20:40:49,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 20:40:49,509 INFO core: _init_accounts coroutine started
2026-09-12 20:40:49,510 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 20:40:49,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:45:29,181 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:50:36,461 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 20:50:49,358 INFO core: Event loop thread started, running loop forever
2026-09-12 20:50:49,659 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 20:50:49,662 INFO core: _init_accounts coroutine started
2026-09-12 20:50:49,664 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 20:50:49,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 20:55:34,644 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 20:55:34,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:00:11,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:05:16,339 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-12 21:05:16,340 INFO core: _init_accounts coroutine started
2026-09-12 21:05:16,340 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 21:05:16,368 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:10:31,570 INFO core: Event loop thread started, running loop forever
2026-09-12 21:10:31,872 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 21:10:31,876 INFO core: _init_accounts coroutine started
2026-09-12 21:10:31,878 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 21:10:31,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:15:10,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:20:16,280 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 21:20:16,280 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 21:20:16,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:20:16,285 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 21:25:10,404 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 21:25:10,408 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:30:17,490 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 21:30:17,490 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 21:30:17,490 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 21:30:38,535 INFO core: Event loop thread started, running loop forever
2026-09-12 21:30:38,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 21:30:38,839 INFO core: _init_accounts coroutine started
2026-09-12 21:30:38,841 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 21:30:38,847 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:35:37,953 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:40:29,076 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 21:40:29,077 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 21:40:29,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:45:37,300 INFO core: Event loop thread started, running loop forever
2026-09-12 21:45:37,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 21:45:37,605 INFO core: _init_accounts coroutine started
2026-09-12 21:45:37,607 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 21:45:37,615 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:50:47,903 INFO core: Event loop thread started, running loop forever
2026-09-12 21:50:48,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 21:50:48,210 INFO core: _init_accounts coroutine started
2026-09-12 21:50:48,211 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 21:50:48,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 21:55:48,678 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:00:49,762 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 22:00:49,762 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 22:00:49,768 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 22:00:49,774 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 22:00:49,813 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 22:00:49,813 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 22:00:49,814 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:05:27,772 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 22:05:27,774 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 22:05:27,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:10:33,347 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 22:10:33,348 WARNING core: Account 2: connect timed out after 35s
2026-09-12 22:10:38,072 INFO core: Event loop thread started, running loop forever
2026-09-12 22:10:38,373 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 22:10:38,379 INFO core: _init_accounts coroutine started
2026-09-12 22:10:38,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 22:10:38,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 22:10:38,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 22:10:38,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:10:38,391 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 22:15:42,792 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 22:15:42,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:20:24,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:25:30,421 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 22:25:52,375 INFO core: Event loop thread started, running loop forever
2026-09-12 22:25:52,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 22:25:52,679 INFO core: _init_accounts coroutine started
2026-09-12 22:25:52,682 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 22:25:52,689 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:30:31,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:35:37,387 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-12 22:35:37,854 INFO core: Event loop thread started, running loop forever
2026-09-12 22:35:38,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 22:35:38,161 INFO core: _init_accounts coroutine started
2026-09-12 22:35:38,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 22:35:38,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:40:10,071 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:45:05,380 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 22:45:05,381 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 22:45:05,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 22:45:05,397 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 22:45:05,398 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 22:45:05,398 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 22:45:05,398 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 22:45:05,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 22:45:10,231 INFO core: Event loop thread started, running loop forever
2026-09-12 22:45:10,532 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 22:45:10,536 INFO core: _init_accounts coroutine started
2026-09-12 22:45:10,536 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 22:45:10,543 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:50:17,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 22:50:17,841 INFO core: Event loop thread started, running loop forever
2026-09-12 22:50:18,142 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 22:50:18,146 INFO core: _init_accounts coroutine started
2026-09-12 22:50:18,148 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 22:50:18,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 22:55:04,421 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 22:55:04,421 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 22:55:04,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:00:11,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 23:00:11,393 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-12 23:00:11,393 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 23:00:11,393 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-12 23:00:11,394 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 23:00:11,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-12 23:00:28,780 INFO core: Event loop thread started, running loop forever
2026-09-12 23:00:29,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 23:00:29,084 INFO core: _init_accounts coroutine started
2026-09-12 23:00:29,086 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 23:00:29,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:05:35,378 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 23:05:51,830 INFO core: Event loop thread started, running loop forever
2026-09-12 23:05:52,131 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 23:05:52,133 INFO core: _init_accounts coroutine started
2026-09-12 23:05:52,135 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 23:05:52,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:10:37,870 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:15:36,788 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 23:15:36,788 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 23:15:36,791 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:15:36,792 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 23:20:17,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:25:18,301 INFO core: _init_accounts_inner: reloading LLM config
2026-09-12 23:25:18,320 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-12 23:25:18,320 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-12 23:25:18,324 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-12 23:25:18,325 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-12 23:25:18,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:30:03,901 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 23:30:03,901 WARNING core: Account 2: connect timed out after 35s
2026-09-12 23:30:03,902 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-12 23:30:03,902 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-12 23:30:03,903 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 23:30:03,905 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-12 23:30:03,907 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-12 23:30:03,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:35:09,405 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-12 23:35:09,406 WARNING core: Account 2: connect timed out after 35s
2026-09-12 23:35:09,407 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-12 23:35:09,407 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-12 23:35:09,407 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-12 23:35:09,408 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-12 23:35:09,409 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-12 23:35:37,947 INFO core: Event loop thread started, running loop forever
2026-09-12 23:35:38,248 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 23:35:38,251 INFO core: _init_accounts coroutine started
2026-09-12 23:35:38,254 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 23:35:38,260 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:40:15,408 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-12 23:40:15,421 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:45:14,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:50:46,460 INFO core: Event loop thread started, running loop forever
2026-09-12 23:50:46,761 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-12 23:50:46,767 INFO core: _init_accounts coroutine started
2026-09-12 23:50:46,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-12 23:50:46,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:55:50,639 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-12 23:55:50,639 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-12 23:55:50,642 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-12 23:55:50,644 INFO core: status() clients=0 connected=False forwarding=False
2026-09-12 23:55:50,644 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 00:00:16,743 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:05:13,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:10:20,363 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 00:10:20,365 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 00:10:20,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 00:10:39,578 INFO core: Event loop thread started, running loop forever
2026-09-13 00:10:39,879 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 00:10:39,882 INFO core: _init_accounts coroutine started
2026-09-13 00:10:39,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 00:10:39,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:15:10,847 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 00:15:10,858 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:20:08,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:25:51,394 INFO core: Event loop thread started, running loop forever
2026-09-13 00:25:51,695 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 00:25:51,698 INFO core: _init_accounts coroutine started
2026-09-13 00:25:51,699 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 00:25:51,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:30:29,413 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 00:30:29,413 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 00:30:29,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 00:30:29,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:35:17,128 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 00:35:17,133 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:40:24,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 00:40:24,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 00:40:24,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 00:40:47,491 INFO core: Event loop thread started, running loop forever
2026-09-13 00:40:47,792 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 00:40:47,798 INFO core: _init_accounts coroutine started
2026-09-13 00:40:47,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 00:40:47,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:45:30,918 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 00:45:30,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:50:31,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 00:55:04,660 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-13 00:55:04,661 INFO core: _init_accounts coroutine started
2026-09-13 00:55:04,661 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 00:55:04,665 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:00:16,318 INFO core: Event loop thread started, running loop forever
2026-09-13 01:00:16,620 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 01:00:16,626 INFO core: _init_accounts coroutine started
2026-09-13 01:00:16,626 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 01:00:16,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:05:23,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 01:05:27,395 INFO core: Event loop thread started, running loop forever
2026-09-13 01:05:27,696 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 01:05:27,700 INFO core: _init_accounts coroutine started
2026-09-13 01:05:27,700 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 01:05:27,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:10:14,621 INFO core: Event loop thread started, running loop forever
2026-09-13 01:10:14,923 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 01:10:14,927 INFO core: _init_accounts coroutine started
2026-09-13 01:10:14,930 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 01:10:14,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:15:14,240 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:20:21,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 01:20:45,192 INFO core: Event loop thread started, running loop forever
2026-09-13 01:20:45,494 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 01:20:45,500 INFO core: _init_accounts coroutine started
2026-09-13 01:20:45,500 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 01:20:45,505 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:25:38,954 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 01:25:38,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:30:13,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:35:40,153 INFO core: Event loop thread started, running loop forever
2026-09-13 01:35:40,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 01:35:40,460 INFO core: _init_accounts coroutine started
2026-09-13 01:35:40,460 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 01:35:40,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:40:38,873 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 01:40:38,874 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 01:40:38,875 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:45:44,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 01:45:44,377 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-13 01:45:44,384 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 01:45:44,384 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 01:45:47,044 INFO core: Event loop thread started, running loop forever
2026-09-13 01:45:47,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 01:45:47,349 INFO core: _init_accounts coroutine started
2026-09-13 01:45:47,351 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 01:45:47,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:45:47,363 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 01:45:47,363 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 01:50:34,147 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 01:50:34,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 01:55:08,765 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 01:55:08,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:00:15,415 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 02:00:15,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 02:00:15,454 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-13 02:00:15,455 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-13 02:00:27,853 INFO core: Event loop thread started, running loop forever
2026-09-13 02:00:28,154 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 02:00:28,157 INFO core: _init_accounts coroutine started
2026-09-13 02:00:28,159 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 02:00:28,168 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:05:34,453 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 02:05:37,910 INFO core: Event loop thread started, running loop forever
2026-09-13 02:05:38,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 02:05:38,217 INFO core: _init_accounts coroutine started
2026-09-13 02:05:38,218 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 02:05:38,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:10:23,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:15:22,929 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 02:15:22,929 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 02:15:22,931 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 02:15:22,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:15:22,933 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 02:20:53,217 INFO core: Event loop thread started, running loop forever
2026-09-13 02:20:53,520 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 02:20:53,523 INFO core: _init_accounts coroutine started
2026-09-13 02:20:53,524 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 02:20:53,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:20:53,539 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 02:20:53,539 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 02:20:53,540 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 02:25:06,678 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 02:25:06,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:30:12,443 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 02:30:47,500 INFO core: Event loop thread started, running loop forever
2026-09-13 02:30:47,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 02:30:47,808 INFO core: _init_accounts coroutine started
2026-09-13 02:30:47,811 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 02:30:47,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:35:45,553 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:40:30,435 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 02:40:30,441 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:45:52,037 INFO core: Event loop thread started, running loop forever
2026-09-13 02:45:52,349 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 02:45:52,353 INFO core: _init_accounts coroutine started
2026-09-13 02:45:52,355 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 02:45:52,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:50:52,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 02:55:48,876 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 02:55:48,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:00:06,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:05:50,588 INFO core: Event loop thread started, running loop forever
2026-09-13 03:05:50,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 03:05:50,894 INFO core: _init_accounts coroutine started
2026-09-13 03:05:50,896 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 03:05:50,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:10:45,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:10:45,200 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 03:15:04,400 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 03:15:04,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 03:15:04,416 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-13 03:15:04,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 03:15:04,416 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 03:15:04,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 03:15:09,729 INFO core: Event loop thread started, running loop forever
2026-09-13 03:15:10,029 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 03:15:10,037 INFO core: _init_accounts coroutine started
2026-09-13 03:15:10,038 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 03:15:10,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:20:10,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:25:14,046 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 03:25:14,049 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 03:25:14,061 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 03:25:14,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:25:14,066 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 03:30:24,266 INFO core: Event loop thread started, running loop forever
2026-09-13 03:30:24,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 03:30:24,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:30:24,583 INFO core: _init_accounts coroutine started
2026-09-13 03:30:24,583 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 03:35:22,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:40:41,645 INFO core: Event loop thread started, running loop forever
2026-09-13 03:40:41,946 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 03:40:41,951 INFO core: _init_accounts coroutine started
2026-09-13 03:40:41,951 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 03:40:41,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:45:23,067 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:50:48,649 INFO core: Event loop thread started, running loop forever
2026-09-13 03:50:48,951 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 03:50:48,957 INFO core: _init_accounts coroutine started
2026-09-13 03:50:48,958 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 03:50:48,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 03:55:39,271 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 03:55:39,271 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 03:55:39,272 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 03:55:39,274 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 03:55:39,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:00:32,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:05:32,858 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:10:39,904 INFO core: Event loop thread started, running loop forever
2026-09-13 04:10:40,205 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 04:10:40,209 INFO core: _init_accounts coroutine started
2026-09-13 04:10:40,210 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 04:10:40,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:15:28,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:20:35,537 INFO core: Event loop thread started, running loop forever
2026-09-13 04:20:35,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 04:20:35,842 INFO core: _init_accounts coroutine started
2026-09-13 04:20:35,843 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 04:20:35,851 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:25:30,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:30:37,445 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 04:30:37,445 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 04:30:54,208 INFO core: Event loop thread started, running loop forever
2026-09-13 04:30:54,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 04:30:54,515 INFO core: _init_accounts coroutine started
2026-09-13 04:30:54,515 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 04:30:54,521 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:35:40,426 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:40:33,883 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 04:40:33,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:45:27,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:50:29,206 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-13 04:50:29,207 INFO core: _init_accounts coroutine started
2026-09-13 04:50:29,207 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 04:50:29,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 04:55:21,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:00:27,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 05:00:27,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 05:00:48,295 INFO core: Event loop thread started, running loop forever
2026-09-13 05:00:48,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 05:00:48,600 INFO core: _init_accounts coroutine started
2026-09-13 05:00:48,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 05:00:48,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:05:22,474 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:10:45,073 INFO core: Event loop thread started, running loop forever
2026-09-13 05:10:45,374 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 05:10:45,378 INFO core: _init_accounts coroutine started
2026-09-13 05:10:45,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 05:10:45,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:15:21,814 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 05:15:21,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:20:06,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:25:18,433 INFO core: Event loop thread started, running loop forever
2026-09-13 05:25:18,734 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 05:25:18,739 INFO core: _init_accounts coroutine started
2026-09-13 05:25:18,740 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 05:25:18,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:30:19,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 05:30:19,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 05:30:19,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:35:05,494 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 05:35:05,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:40:12,420 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 05:40:27,508 INFO core: Event loop thread started, running loop forever
2026-09-13 05:40:27,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 05:40:27,824 INFO core: _init_accounts coroutine started
2026-09-13 05:40:27,824 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 05:40:27,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:45:42,396 INFO core: Event loop thread started, running loop forever
2026-09-13 05:45:42,697 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 05:45:42,702 INFO core: _init_accounts coroutine started
2026-09-13 05:45:42,702 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 05:45:42,710 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:50:13,654 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 05:50:13,655 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 05:50:13,658 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 05:50:13,661 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 05:55:19,448 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 05:55:19,453 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 05:55:51,349 INFO core: Event loop thread started, running loop forever
2026-09-13 05:55:51,650 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 05:55:51,653 INFO core: _init_accounts coroutine started
2026-09-13 05:55:51,654 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 05:55:51,669 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 05:55:51,669 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 05:55:51,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:00:18,999 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 06:00:19,005 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:05:25,480 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 06:05:43,731 INFO core: Event loop thread started, running loop forever
2026-09-13 06:05:44,032 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 06:05:44,037 INFO core: _init_accounts coroutine started
2026-09-13 06:05:44,039 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 06:05:44,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:10:35,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:15:05,376 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 06:15:05,377 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 06:15:05,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 06:15:39,312 INFO core: Event loop thread started, running loop forever
2026-09-13 06:15:39,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 06:15:39,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:15:39,624 INFO core: _init_accounts coroutine started
2026-09-13 06:15:39,626 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 06:20:30,131 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:25:42,959 INFO core: Event loop thread started, running loop forever
2026-09-13 06:25:43,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 06:25:43,266 INFO core: _init_accounts coroutine started
2026-09-13 06:25:43,266 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 06:25:43,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:30:41,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:35:22,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 06:35:22,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 06:35:22,877 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:40:40,719 INFO core: Event loop thread started, running loop forever
2026-09-13 06:40:41,021 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 06:40:41,024 INFO core: _init_accounts coroutine started
2026-09-13 06:40:41,026 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 06:40:41,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:45:16,874 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 06:45:16,875 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 06:45:16,877 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 06:45:16,882 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 06:45:16,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:45:16,891 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 06:45:16,895 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 06:50:40,873 INFO core: Event loop thread started, running loop forever
2026-09-13 06:50:41,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 06:50:41,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:55:47,416 INFO core: _init_accounts coroutine started
2026-09-13 06:55:50,912 INFO core: Event loop thread started, running loop forever
2026-09-13 06:55:51,213 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 06:55:51,216 INFO core: _init_accounts coroutine started
2026-09-13 06:55:51,218 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 06:55:51,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 06:55:51,233 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 06:55:51,236 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 07:00:47,337 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 07:00:47,340 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 07:00:47,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:05:09,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:10:35,751 INFO core: Event loop thread started, running loop forever
2026-09-13 07:10:36,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 07:10:36,057 INFO core: _init_accounts coroutine started
2026-09-13 07:10:36,058 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 07:10:36,062 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:15:22,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 07:15:22,573 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 07:15:22,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:20:25,084 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 07:20:25,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:25:20,341 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 07:25:20,347 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:30:10,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:35:16,456 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 07:35:34,504 INFO core: Event loop thread started, running loop forever
2026-09-13 07:35:34,805 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 07:35:34,810 INFO core: _init_accounts coroutine started
2026-09-13 07:35:34,811 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 07:35:34,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:40:12,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:45:44,544 INFO core: Event loop thread started, running loop forever
2026-09-13 07:45:44,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 07:45:44,849 INFO core: _init_accounts coroutine started
2026-09-13 07:45:44,851 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 07:45:44,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:50:41,691 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 07:50:41,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 07:55:47,220 INFO core: Event loop thread started, running loop forever
2026-09-13 07:55:47,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 07:55:47,525 INFO core: _init_accounts coroutine started
2026-09-13 07:55:47,526 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 07:55:47,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:00:41,422 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:05:15,200 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 08:05:15,200 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 08:05:15,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:10:21,477 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 08:10:21,478 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 08:10:21,478 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-13 08:10:21,480 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 08:10:21,480 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 08:10:21,480 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 08:10:21,480 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 08:10:40,926 INFO core: Event loop thread started, running loop forever
2026-09-13 08:10:41,227 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 08:10:41,242 INFO core: _init_accounts coroutine started
2026-09-13 08:10:41,243 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 08:10:41,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:15:30,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:20:16,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:25:08,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:30:06,376 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 08:30:55,076 INFO core: Event loop thread started, running loop forever
2026-09-13 08:30:55,377 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 08:30:55,383 INFO core: _init_accounts coroutine started
2026-09-13 08:30:55,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:30:55,384 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 08:35:31,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:40:43,593 INFO core: Event loop thread started, running loop forever
2026-09-13 08:40:43,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 08:40:43,903 INFO core: _init_accounts coroutine started
2026-09-13 08:40:43,904 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 08:40:43,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:40:43,928 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 08:45:06,264 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 08:45:06,274 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 08:45:06,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:45:06,288 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 08:50:21,504 INFO core: Event loop thread started, running loop forever
2026-09-13 08:50:21,805 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 08:50:21,809 INFO core: _init_accounts coroutine started
2026-09-13 08:50:21,812 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 08:50:21,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 08:55:28,464 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-13 08:55:46,902 INFO core: Event loop thread started, running loop forever
2026-09-13 08:55:47,214 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 08:55:47,218 INFO core: _init_accounts coroutine started
2026-09-13 08:55:47,219 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 08:55:47,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:00:15,972 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 09:00:15,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:05:43,255 INFO core: Event loop thread started, running loop forever
2026-09-13 09:05:43,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 09:05:43,561 INFO core: _init_accounts coroutine started
2026-09-13 09:05:43,562 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 09:05:43,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:10:24,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:15:24,268 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 09:15:24,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:20:44,244 INFO core: Event loop thread started, running loop forever
2026-09-13 09:20:44,549 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 09:20:44,553 INFO core: _init_accounts coroutine started
2026-09-13 09:20:44,555 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 09:20:44,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:25:38,505 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:30:16,618 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 09:30:16,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:35:45,359 INFO core: Event loop thread started, running loop forever
2026-09-13 09:35:45,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 09:35:45,667 INFO core: _init_accounts coroutine started
2026-09-13 09:35:45,667 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 09:35:45,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:40:31,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:40:31,255 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 09:40:31,256 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 09:40:31,258 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 09:45:29,184 INFO core: Event loop thread started, running loop forever
2026-09-13 09:45:29,485 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 09:45:29,489 INFO core: _init_accounts coroutine started
2026-09-13 09:45:29,490 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 09:45:29,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:45:38,193 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 09:45:38,194 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 09:45:38,194 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 09:45:38,196 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 09:50:06,346 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 09:50:06,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 09:55:06,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:00:12,642 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-13 10:00:12,651 INFO core: _init_accounts coroutine started
2026-09-13 10:00:12,651 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 10:00:12,711 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 10:00:12,711 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 10:00:12,717 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 10:00:12,724 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 10:00:12,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:05:06,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:10:28,328 INFO core: Event loop thread started, running loop forever
2026-09-13 10:10:28,629 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 10:10:28,635 INFO core: _init_accounts coroutine started
2026-09-13 10:10:28,636 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 10:10:28,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:15:15,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:15:15,264 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 10:15:15,265 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 10:15:15,266 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 10:15:15,267 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 10:20:22,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 10:20:22,423 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 10:20:22,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 10:20:52,213 INFO core: Event loop thread started, running loop forever
2026-09-13 10:20:52,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 10:20:52,525 INFO core: _init_accounts coroutine started
2026-09-13 10:20:52,526 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 10:20:52,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:25:30,107 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 10:25:30,108 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 10:25:30,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 10:25:30,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:30:26,708 INFO core: Event loop thread started, running loop forever
2026-09-13 10:30:27,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 10:30:27,018 INFO core: _init_accounts coroutine started
2026-09-13 10:30:27,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 10:30:27,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:30:27,026 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-13 10:35:34,871 INFO core: Event loop thread started, running loop forever
2026-09-13 10:35:35,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 10:35:35,176 INFO core: _init_accounts coroutine started
2026-09-13 10:35:35,177 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 10:35:35,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:40:15,811 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 10:40:15,811 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 10:40:15,812 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 10:40:15,813 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 10:40:15,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:45:04,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 10:45:54,859 INFO core: Event loop thread started, running loop forever
2026-09-13 10:45:55,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 10:45:55,164 INFO core: _init_accounts coroutine started
2026-09-13 10:45:55,165 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 10:45:55,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:50:48,175 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 10:50:48,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 10:55:06,141 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:00:35,977 INFO core: Event loop thread started, running loop forever
2026-09-13 11:00:36,278 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 11:00:36,284 INFO core: _init_accounts coroutine started
2026-09-13 11:00:36,284 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 11:00:36,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:05:31,896 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 11:05:31,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:10:44,071 INFO core: Event loop thread started, running loop forever
2026-09-13 11:10:44,374 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 11:10:44,379 INFO core: _init_accounts coroutine started
2026-09-13 11:10:44,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 11:10:44,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 11:10:44,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 11:10:44,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:10:44,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 11:15:11,994 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 11:15:11,998 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:20:18,389 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 11:20:18,390 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 11:20:18,390 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 11:20:45,723 INFO core: Event loop thread started, running loop forever
2026-09-13 11:20:46,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 11:20:46,027 INFO core: _init_accounts coroutine started
2026-09-13 11:20:46,029 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 11:20:46,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:25:08,321 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 11:25:08,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:30:36,507 INFO core: Event loop thread started, running loop forever
2026-09-13 11:30:36,808 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 11:30:36,811 INFO core: _init_accounts coroutine started
2026-09-13 11:30:36,812 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 11:30:36,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:35:43,483 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 11:35:44,797 INFO core: Event loop thread started, running loop forever
2026-09-13 11:35:45,099 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 11:35:45,116 INFO core: _init_accounts coroutine started
2026-09-13 11:35:45,117 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 11:35:45,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:40:27,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:45:14,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:50:20,507 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 11:50:28,858 INFO core: Event loop thread started, running loop forever
2026-09-13 11:50:29,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 11:50:29,171 INFO core: _init_accounts coroutine started
2026-09-13 11:50:29,171 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 11:50:29,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 11:55:30,867 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 11:55:30,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:00:34,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:05:04,956 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-13 12:05:04,959 INFO core: _init_accounts coroutine started
2026-09-13 12:05:04,959 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 12:05:04,965 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 12:05:04,966 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 12:05:04,968 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 12:05:04,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:10:06,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 12:10:06,464 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:15:11,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:20:08,380 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 12:20:08,381 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 12:20:08,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:25:08,683 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:30:15,422 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 12:30:54,620 INFO core: Event loop thread started, running loop forever
2026-09-13 12:30:54,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 12:30:54,925 INFO core: _init_accounts coroutine started
2026-09-13 12:30:54,926 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 12:30:54,938 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 12:30:54,939 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 12:30:54,939 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:30:54,940 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 12:35:18,686 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 12:35:18,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:40:19,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:45:51,889 INFO core: Event loop thread started, running loop forever
2026-09-13 12:45:52,191 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 12:45:52,194 INFO core: _init_accounts coroutine started
2026-09-13 12:45:52,197 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 12:45:52,202 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:50:05,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 12:55:52,232 INFO core: Event loop thread started, running loop forever
2026-09-13 12:55:52,534 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 12:55:52,538 INFO core: _init_accounts coroutine started
2026-09-13 12:55:52,540 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 12:55:52,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:00:07,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:05:03,491 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 13:05:03,491 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 13:05:03,493 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 13:05:03,503 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 13:05:03,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:10:09,486 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 13:10:43,227 INFO core: Event loop thread started, running loop forever
2026-09-13 13:10:43,529 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 13:10:43,533 INFO core: _init_accounts coroutine started
2026-09-13 13:10:43,536 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 13:10:43,542 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:10:43,551 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 13:10:43,551 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 13:10:43,555 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 13:15:15,045 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 13:15:15,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:20:22,760 INFO core: Event loop thread started, running loop forever
2026-09-13 13:20:23,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 13:20:23,064 INFO core: _init_accounts coroutine started
2026-09-13 13:20:23,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 13:20:23,071 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:25:23,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:30:14,930 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 13:30:14,931 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 13:30:14,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:30:14,942 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 13:35:20,458 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 13:35:38,872 INFO core: Event loop thread started, running loop forever
2026-09-13 13:35:39,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 13:35:39,183 INFO core: _init_accounts coroutine started
2026-09-13 13:35:39,183 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 13:35:39,189 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:40:34,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:45:39,894 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:50:23,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 13:50:23,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 13:50:23,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 13:55:20,092 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 13:55:20,093 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 13:55:20,097 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 13:55:20,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:00:43,082 INFO core: Event loop thread started, running loop forever
2026-09-13 14:00:43,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 14:00:43,398 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:05:23,610 INFO core: _init_accounts coroutine started
2026-09-13 14:05:23,610 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 14:05:23,621 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:10:34,710 INFO core: Event loop thread started, running loop forever
2026-09-13 14:10:35,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 14:10:35,018 INFO core: _init_accounts coroutine started
2026-09-13 14:10:35,019 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 14:10:35,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:15:06,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:20:06,946 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:25:13,353 INFO core: Event loop thread started, running loop forever
2026-09-13 14:25:13,654 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 14:25:13,658 INFO core: _init_accounts coroutine started
2026-09-13 14:25:13,660 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 14:25:13,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:30:06,453 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:35:48,526 INFO core: Event loop thread started, running loop forever
2026-09-13 14:35:48,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 14:35:48,841 INFO core: _init_accounts coroutine started
2026-09-13 14:35:48,842 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 14:35:48,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:40:13,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:45:05,814 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 14:45:05,816 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 14:45:05,821 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 14:45:05,826 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 14:45:05,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:50:24,182 INFO core: Event loop thread started, running loop forever
2026-09-13 14:50:24,483 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 14:50:24,488 INFO core: _init_accounts coroutine started
2026-09-13 14:50:24,488 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 14:50:24,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:55:05,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 14:55:05,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 15:00:12,447 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 15:00:13,888 INFO core: Event loop thread started, running loop forever
2026-09-13 15:00:14,189 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 15:00:14,194 INFO core: _init_accounts coroutine started
2026-09-13 15:00:14,196 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 15:00:14,220 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 15:00:14,220 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 15:00:14,224 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 15:00:14,225 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 15:00:14,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:05:17,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:10:24,463 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 15:10:25,185 INFO core: Event loop thread started, running loop forever
2026-09-13 15:10:25,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 15:10:25,489 INFO core: _init_accounts coroutine started
2026-09-13 15:10:25,489 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 15:10:25,503 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:15:41,448 INFO core: Event loop thread started, running loop forever
2026-09-13 15:15:41,749 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 15:15:42,302 INFO core: _init_accounts coroutine started
2026-09-13 15:15:42,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 15:15:42,309 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:20:36,853 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 15:20:36,854 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 15:20:36,858 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 15:20:36,861 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 15:20:36,878 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 15:20:36,878 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 15:20:36,884 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-13 15:20:36,885 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-13 15:20:36,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:25:06,195 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 15:25:06,195 WARNING core: Account 2: connect timed out after 35s
2026-09-13 15:25:06,196 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-13 15:25:06,196 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-13 15:25:06,197 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 15:25:06,198 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-13 15:25:06,198 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-13 15:25:06,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:30:13,424 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 15:30:13,426 WARNING core: Account 2: connect timed out after 35s
2026-09-13 15:30:13,426 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-13 15:30:13,426 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-13 15:30:13,427 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 15:30:13,428 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-13 15:30:13,429 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-13 15:30:37,444 INFO core: Event loop thread started, running loop forever
2026-09-13 15:30:37,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 15:30:37,762 INFO core: _init_accounts coroutine started
2026-09-13 15:30:37,763 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 15:30:37,771 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:35:33,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:40:40,370 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 15:40:47,767 INFO core: Event loop thread started, running loop forever
2026-09-13 15:40:48,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 15:40:48,072 INFO core: _init_accounts coroutine started
2026-09-13 15:40:48,074 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 15:40:48,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:45:22,008 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 15:45:22,008 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 15:45:22,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:50:29,453 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 15:50:29,455 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-13 15:50:38,477 INFO core: Event loop thread started, running loop forever
2026-09-13 15:50:38,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 15:50:38,789 INFO core: _init_accounts coroutine started
2026-09-13 15:50:38,791 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 15:50:38,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 15:55:31,061 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:00:18,577 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 16:00:18,578 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 16:00:18,583 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 16:00:18,585 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 16:00:18,586 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:05:15,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:10:30,252 INFO core: Event loop thread started, running loop forever
2026-09-13 16:10:30,553 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 16:10:30,556 INFO core: _init_accounts coroutine started
2026-09-13 16:10:30,557 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 16:10:30,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:15:36,306 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 16:15:36,306 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 16:15:36,316 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 16:15:36,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:15:36,320 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 16:20:27,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:25:23,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:30:17,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:35:11,132 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 16:35:11,133 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 16:35:11,141 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-13 16:35:11,142 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:35:11,143 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-13 16:40:12,716 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 16:40:12,717 WARNING core: Account 2: connect timed out after 35s
2026-09-13 16:40:12,718 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-13 16:40:12,720 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-13 16:40:12,721 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 16:40:12,722 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-13 16:40:12,723 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-13 16:40:12,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:45:19,391 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 16:45:19,393 WARNING core: Account 2: connect timed out after 35s
2026-09-13 16:45:44,172 INFO core: Event loop thread started, running loop forever
2026-09-13 16:45:44,473 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 16:45:44,476 INFO core: _init_accounts coroutine started
2026-09-13 16:45:44,479 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 16:45:44,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:50:27,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 16:55:28,615 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 16:55:28,616 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 16:55:28,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:00:52,626 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 17:00:52,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:00:52,630 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 17:05:51,825 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 17:05:51,825 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 17:05:51,830 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-13 17:05:51,831 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-13 17:05:51,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:10:34,015 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 17:10:34,016 WARNING core: Account 2: connect timed out after 35s
2026-09-13 17:10:34,017 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-13 17:10:34,017 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-13 17:10:34,021 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 17:10:34,022 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-13 17:10:34,023 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-13 17:10:34,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:15:13,664 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 17:15:13,665 WARNING core: Account 2: connect timed out after 35s
2026-09-13 17:15:13,666 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-13 17:15:13,667 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-13 17:15:13,668 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 17:15:13,669 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-13 17:15:13,670 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-13 17:15:13,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:20:04,658 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 17:20:04,658 WARNING core: Account 2: connect timed out after 35s
2026-09-13 17:20:04,658 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-13 17:20:04,659 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-13 17:20:04,659 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 17:20:04,660 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-13 17:20:04,660 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-13 17:20:04,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:25:10,453 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 17:25:10,454 WARNING core: Account 2: connect timed out after 35s
2026-09-13 17:25:10,455 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-13 17:25:23,032 INFO core: Event loop thread started, running loop forever
2026-09-13 17:25:23,334 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 17:25:23,337 INFO core: _init_accounts coroutine started
2026-09-13 17:25:23,339 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 17:25:23,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:30:05,011 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:35:50,685 INFO core: Event loop thread started, running loop forever
2026-09-13 17:35:50,986 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 17:35:50,991 INFO core: _init_accounts coroutine started
2026-09-13 17:35:50,991 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 17:35:50,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:40:30,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:45:12,765 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 17:45:12,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:45:12,767 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 17:50:18,364 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-13 17:50:18,365 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 17:50:18,366 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-13 17:50:38,020 INFO core: Event loop thread started, running loop forever
2026-09-13 17:50:38,321 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 17:50:38,324 INFO core: _init_accounts coroutine started
2026-09-13 17:50:38,325 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 17:50:38,331 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 17:55:15,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:00:22,463 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 18:00:26,487 INFO core: Event loop thread started, running loop forever
2026-09-13 18:00:26,788 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 18:00:26,795 INFO core: _init_accounts coroutine started
2026-09-13 18:00:26,795 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 18:00:26,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:05:50,487 INFO core: Event loop thread started, running loop forever
2026-09-13 18:05:50,788 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 18:05:50,793 INFO core: _init_accounts coroutine started
2026-09-13 18:05:50,794 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 18:05:50,805 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 18:05:50,806 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 18:05:50,807 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 18:05:50,809 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 18:05:50,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:10:06,705 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:15:12,375 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 18:15:12,377 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 18:15:28,316 INFO core: Event loop thread started, running loop forever
2026-09-13 18:15:28,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 18:15:28,621 INFO core: _init_accounts coroutine started
2026-09-13 18:15:28,622 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 18:15:28,627 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:20:10,234 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 18:20:10,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:25:21,238 INFO core: Event loop thread started, running loop forever
2026-09-13 18:25:21,539 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 18:25:21,543 INFO core: _init_accounts coroutine started
2026-09-13 18:25:21,543 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 18:25:21,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:30:06,988 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:30:06,988 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 18:35:05,481 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 18:35:05,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:40:12,496 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 18:40:12,516 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 18:40:12,517 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 18:40:12,517 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 18:40:12,518 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 18:40:13,864 INFO core: Event loop thread started, running loop forever
2026-09-13 18:40:14,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 18:40:14,170 INFO core: _init_accounts coroutine started
2026-09-13 18:40:14,170 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 18:40:14,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:45:36,136 INFO core: Event loop thread started, running loop forever
2026-09-13 18:45:36,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 18:45:36,441 INFO core: _init_accounts coroutine started
2026-09-13 18:45:36,442 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 18:45:36,453 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:50:35,422 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 18:55:45,725 INFO core: Event loop thread started, running loop forever
2026-09-13 18:55:46,026 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 18:55:46,032 INFO core: _init_accounts coroutine started
2026-09-13 18:55:46,033 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 18:55:46,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:00:33,974 INFO core: Event loop thread started, running loop forever
2026-09-13 19:00:34,275 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 19:00:34,279 INFO core: _init_accounts coroutine started
2026-09-13 19:00:34,279 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 19:00:34,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:05:41,420 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 19:05:50,166 INFO core: Event loop thread started, running loop forever
2026-09-13 19:05:50,467 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 19:05:50,470 INFO core: _init_accounts coroutine started
2026-09-13 19:05:50,471 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 19:05:50,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 19:05:50,479 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 19:05:50,480 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 19:05:50,481 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 19:05:50,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:10:29,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:15:34,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:20:18,090 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 19:20:18,091 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 19:20:18,100 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-13 19:20:18,100 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-13 19:20:18,105 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:25:25,460 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 19:25:25,460 WARNING core: Account 2: connect timed out after 35s
2026-09-13 19:25:25,461 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-13 19:25:25,461 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-13 19:25:25,462 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 19:25:25,463 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-13 19:25:25,463 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-13 19:25:29,591 INFO core: Event loop thread started, running loop forever
2026-09-13 19:25:29,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 19:25:29,900 INFO core: _init_accounts coroutine started
2026-09-13 19:25:29,900 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 19:25:29,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:30:08,176 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 19:30:08,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:35:08,899 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:40:29,021 INFO core: Event loop thread started, running loop forever
2026-09-13 19:40:29,322 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 19:40:29,327 INFO core: _init_accounts coroutine started
2026-09-13 19:40:29,328 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 19:40:29,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:45:36,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 19:45:44,963 INFO core: Event loop thread started, running loop forever
2026-09-13 19:45:45,265 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 19:45:45,269 INFO core: _init_accounts coroutine started
2026-09-13 19:45:45,270 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 19:45:45,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 19:45:45,280 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 19:45:45,280 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 19:45:45,281 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 19:45:45,292 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:46:57,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:46:57,655 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 19:46:57,655 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 19:46:57,671 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-13 19:46:57,672 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-13 19:50:27,017 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 19:50:27,017 WARNING core: Account 2: connect timed out after 35s
2026-09-13 19:50:27,017 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-13 19:50:27,017 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-13 19:50:27,018 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 19:50:27,019 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-13 19:50:27,019 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-13 19:50:27,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:55:09,524 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-13 19:55:09,524 WARNING core: Account 2: connect timed out after 35s
2026-09-13 19:55:09,525 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-13 19:55:09,525 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-13 19:55:09,526 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-13 19:55:09,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 19:55:09,539 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-13 20:00:16,459 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-13 20:00:46,898 INFO core: Event loop thread started, running loop forever
2026-09-13 20:00:47,200 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 20:00:47,204 INFO core: _init_accounts coroutine started
2026-09-13 20:00:47,206 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 20:00:47,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:05:09,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:05:09,185 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 20:10:16,385 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 20:10:16,386 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-13 20:10:16,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 20:10:16,387 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-13 20:10:16,387 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 20:10:16,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 20:10:16,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 20:10:16,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 20:10:32,495 INFO core: Event loop thread started, running loop forever
2026-09-13 20:10:32,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 20:10:32,813 INFO core: _init_accounts coroutine started
2026-09-13 20:10:32,813 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 20:10:32,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:15:16,601 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 20:15:16,601 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 20:15:16,603 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 20:15:16,605 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 20:15:16,622 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:20:22,429 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 20:20:44,712 INFO core: Event loop thread started, running loop forever
2026-09-13 20:20:45,013 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 20:20:45,016 INFO core: _init_accounts coroutine started
2026-09-13 20:20:45,019 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 20:20:45,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:25:11,932 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:25:11,933 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 20:25:11,933 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 20:30:11,132 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 20:30:11,138 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 20:30:11,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:35:18,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 20:35:19,146 INFO core: Event loop thread started, running loop forever
2026-09-13 20:35:19,447 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 20:35:19,450 INFO core: _init_accounts coroutine started
2026-09-13 20:35:19,453 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 20:35:19,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:40:49,022 INFO core: Event loop thread started, running loop forever
2026-09-13 20:40:49,323 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 20:40:49,326 INFO core: _init_accounts coroutine started
2026-09-13 20:40:49,327 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 20:40:49,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:45:47,842 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 20:45:47,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:50:27,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 20:55:16,529 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-13 20:55:16,529 INFO core: _init_accounts coroutine started
2026-09-13 20:55:16,530 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 20:55:16,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:00:23,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 21:00:47,437 INFO core: Event loop thread started, running loop forever
2026-09-13 21:00:47,740 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 21:00:47,743 INFO core: _init_accounts coroutine started
2026-09-13 21:00:47,744 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 21:00:47,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:05:11,845 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 21:05:11,865 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:10:03,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:15:12,911 INFO core: Event loop thread started, running loop forever
2026-09-13 21:15:13,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 21:15:13,218 INFO core: _init_accounts coroutine started
2026-09-13 21:15:13,219 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 21:15:13,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:20:12,229 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 21:20:12,230 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 21:20:12,233 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 21:20:12,235 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 21:20:12,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:25:19,453 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 21:25:36,121 INFO core: Event loop thread started, running loop forever
2026-09-13 21:25:36,422 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 21:25:36,425 INFO core: _init_accounts coroutine started
2026-09-13 21:25:36,430 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 21:25:36,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:30:30,637 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 21:30:30,638 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 21:30:30,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:35:05,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 21:35:05,617 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 21:35:05,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:40:12,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 21:40:44,648 INFO core: Event loop thread started, running loop forever
2026-09-13 21:40:44,950 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 21:40:44,955 INFO core: _init_accounts coroutine started
2026-09-13 21:40:44,956 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 21:40:44,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:45:53,463 INFO core: Event loop thread started, running loop forever
2026-09-13 21:45:53,764 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 21:45:53,768 INFO core: _init_accounts coroutine started
2026-09-13 21:45:53,770 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 21:45:53,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:50:33,686 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 21:50:33,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 21:55:35,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:00:44,467 INFO core: Event loop thread started, running loop forever
2026-09-13 22:00:44,768 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 22:00:44,772 INFO core: _init_accounts coroutine started
2026-09-13 22:00:44,774 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 22:00:44,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:05:22,451 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 22:05:22,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:10:27,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:15:41,380 INFO core: Event loop thread started, running loop forever
2026-09-13 22:15:41,681 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 22:15:41,687 INFO core: _init_accounts coroutine started
2026-09-13 22:15:41,687 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 22:15:41,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:20:48,472 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 22:20:51,559 INFO core: Event loop thread started, running loop forever
2026-09-13 22:20:51,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 22:20:51,867 INFO core: _init_accounts coroutine started
2026-09-13 22:20:51,867 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 22:20:51,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:25:28,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:30:32,970 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 22:30:32,971 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 22:30:32,977 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:35:07,895 INFO core: Event loop thread started, running loop forever
2026-09-13 22:35:08,196 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 22:35:08,200 INFO core: _init_accounts coroutine started
2026-09-13 22:35:08,201 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 22:35:08,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:35:39,924 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 22:35:39,931 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 22:35:39,931 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-13 22:35:39,932 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-13 22:35:39,932 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 22:40:24,203 INFO core: Event loop thread started, running loop forever
2026-09-13 22:40:24,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 22:40:24,508 INFO core: _init_accounts coroutine started
2026-09-13 22:40:24,509 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 22:40:24,517 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:45:31,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 22:45:41,545 INFO core: Event loop thread started, running loop forever
2026-09-13 22:45:41,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 22:45:41,850 INFO core: _init_accounts coroutine started
2026-09-13 22:45:41,852 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 22:45:41,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:50:48,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 22:50:53,086 INFO core: Event loop thread started, running loop forever
2026-09-13 22:50:53,388 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 22:50:53,402 INFO core: _init_accounts coroutine started
2026-09-13 22:50:53,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 22:50:53,408 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 22:55:40,583 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:00:44,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:05:16,606 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 23:05:16,606 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 23:05:16,616 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 23:05:16,618 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 23:05:16,633 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:10:17,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:15:23,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-13 23:15:43,179 INFO core: Event loop thread started, running loop forever
2026-09-13 23:15:43,480 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 23:15:43,487 INFO core: _init_accounts coroutine started
2026-09-13 23:15:43,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 23:15:43,492 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:15:43,499 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 23:15:43,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 23:15:43,506 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-13 23:20:24,872 INFO core: _init_accounts_inner: reloading LLM config
2026-09-13 23:20:24,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:25:48,489 INFO core: Event loop thread started, running loop forever
2026-09-13 23:25:48,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 23:25:48,797 INFO core: _init_accounts coroutine started
2026-09-13 23:25:48,797 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 23:25:48,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:30:51,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:35:37,657 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-13 23:35:37,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:40:47,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:40:52,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:45:18,191 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-13 23:45:18,193 INFO core: _init_accounts coroutine started
2026-09-13 23:45:18,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 23:45:18,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:50:24,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-13 23:50:39,112 INFO core: Event loop thread started, running loop forever
2026-09-13 23:50:39,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-13 23:50:39,419 INFO core: _init_accounts coroutine started
2026-09-13 23:50:39,420 INFO core: _init_accounts_inner: starting DB migrations
2026-09-13 23:50:39,429 INFO core: status() clients=0 connected=False forwarding=False
2026-09-13 23:55:29,129 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-13 23:55:29,129 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-13 23:55:29,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:00:49,357 INFO core: Event loop thread started, running loop forever
2026-09-14 00:00:49,658 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 00:00:49,665 INFO core: _init_accounts coroutine started
2026-09-14 00:00:49,665 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 00:00:49,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:05:26,709 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 00:05:26,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:10:13,180 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:15:30,124 INFO core: Event loop thread started, running loop forever
2026-09-14 00:15:30,425 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 00:15:30,428 INFO core: _init_accounts coroutine started
2026-09-14 00:15:30,430 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 00:15:30,437 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 00:15:30,438 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 00:15:30,438 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:20:44,501 INFO core: Event loop thread started, running loop forever
2026-09-14 00:20:44,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 00:20:44,804 INFO core: _init_accounts coroutine started
2026-09-14 00:20:44,805 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 00:20:44,813 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:25:35,368 INFO core: Event loop thread started, running loop forever
2026-09-14 00:25:35,670 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 00:25:35,673 INFO core: _init_accounts coroutine started
2026-09-14 00:25:35,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 00:25:35,685 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 00:25:35,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:25:35,687 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 00:25:35,695 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 00:25:35,696 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 00:25:50,380 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 00:30:41,471 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 00:30:44,741 INFO core: Event loop thread started, running loop forever
2026-09-14 00:30:45,042 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 00:30:45,048 INFO core: _init_accounts coroutine started
2026-09-14 00:30:45,049 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 00:30:45,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:35:37,677 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 00:35:37,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:35:37,678 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 00:35:37,680 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 00:40:34,495 INFO core: Event loop thread started, running loop forever
2026-09-14 00:40:34,798 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 00:40:34,802 INFO core: _init_accounts coroutine started
2026-09-14 00:40:34,804 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 00:40:34,810 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-14 00:40:34,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:40:44,507 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 00:40:44,507 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 00:45:12,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:50:47,171 INFO core: Event loop thread started, running loop forever
2026-09-14 00:50:47,473 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 00:50:47,477 INFO core: _init_accounts coroutine started
2026-09-14 00:50:47,478 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 00:50:47,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 00:55:27,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:00:09,911 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 01:00:09,912 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 01:00:09,917 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 01:00:09,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:05:15,450 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 01:05:39,320 INFO core: Event loop thread started, running loop forever
2026-09-14 01:05:39,621 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 01:05:39,624 INFO core: _init_accounts coroutine started
2026-09-14 01:05:39,624 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 01:05:39,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:10:17,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:10:17,083 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 01:10:17,083 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 01:15:18,271 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 01:15:18,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:20:25,389 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 01:20:25,439 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 01:20:25,439 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 01:20:25,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 01:20:28,845 INFO core: Event loop thread started, running loop forever
2026-09-14 01:20:29,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 01:20:29,157 INFO core: _init_accounts coroutine started
2026-09-14 01:20:29,157 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 01:20:29,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:25:07,506 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:30:14,525 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 01:30:25,792 INFO core: Event loop thread started, running loop forever
2026-09-14 01:30:26,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 01:30:26,103 INFO core: _init_accounts coroutine started
2026-09-14 01:30:26,103 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 01:30:26,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:35:10,580 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 01:35:10,580 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 01:35:10,583 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 01:35:10,585 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 01:35:10,611 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 01:35:10,611 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 01:35:10,617 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 01:35:10,622 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:35:10,628 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 01:40:16,483 WARNING core: Account 2: connect timed out after 35s
2026-09-14 01:40:16,484 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-14 01:40:16,485 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-14 01:40:16,486 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 01:40:16,487 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-14 01:40:16,488 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-14 01:40:23,147 INFO core: Event loop thread started, running loop forever
2026-09-14 01:40:23,448 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 01:40:23,456 INFO core: _init_accounts coroutine started
2026-09-14 01:40:23,456 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 01:40:23,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:45:07,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:50:13,447 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 01:50:30,758 INFO core: Event loop thread started, running loop forever
2026-09-14 01:50:31,059 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 01:50:31,065 INFO core: _init_accounts coroutine started
2026-09-14 01:50:31,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 01:50:31,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 01:55:37,486 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 01:55:47,589 INFO core: Event loop thread started, running loop forever
2026-09-14 01:55:47,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 01:55:47,894 INFO core: _init_accounts coroutine started
2026-09-14 01:55:47,895 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 01:55:47,907 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:00:37,545 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 02:00:37,545 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 02:00:37,547 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 02:00:37,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:00:37,549 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 02:05:29,329 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 02:05:29,329 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 02:05:29,331 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:10:03,315 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 02:10:03,316 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 02:10:03,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:15:06,466 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 02:15:06,466 WARNING core: Account 2: connect timed out after 35s
2026-09-14 02:15:06,467 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-14 02:15:06,467 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-14 02:15:06,468 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 02:15:06,469 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-14 02:15:06,469 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-14 02:15:06,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:20:12,411 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 02:20:12,412 WARNING core: Account 2: connect timed out after 35s
2026-09-14 02:20:12,413 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-14 02:20:12,413 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-14 02:20:12,414 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 02:20:12,415 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-14 02:20:12,415 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-14 02:20:15,931 INFO core: Event loop thread started, running loop forever
2026-09-14 02:20:16,232 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 02:20:16,236 INFO core: _init_accounts coroutine started
2026-09-14 02:20:16,237 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 02:20:16,249 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 02:20:16,249 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 02:20:16,251 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 02:20:16,251 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 02:20:16,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:25:12,616 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:30:18,443 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 02:30:18,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 02:30:18,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 02:30:22,962 INFO core: Event loop thread started, running loop forever
2026-09-14 02:30:23,275 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 02:30:23,279 INFO core: _init_accounts coroutine started
2026-09-14 02:30:23,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 02:30:23,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:35:05,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:40:07,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 02:40:07,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 02:40:07,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 02:40:07,443 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 02:40:07,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:45:36,318 INFO core: Event loop thread started, running loop forever
2026-09-14 02:45:36,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 02:45:36,623 INFO core: _init_accounts coroutine started
2026-09-14 02:45:36,624 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 02:45:36,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:50:33,160 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 02:50:33,186 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 02:55:51,650 INFO core: Event loop thread started, running loop forever
2026-09-14 02:55:51,951 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 02:55:51,954 INFO core: _init_accounts coroutine started
2026-09-14 02:55:51,957 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 02:55:51,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:00:22,480 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 03:00:22,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 03:00:22,481 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 03:00:22,482 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 03:00:22,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:05:21,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:10:27,516 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 03:10:27,530 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 03:10:27,880 INFO core: Event loop thread started, running loop forever
2026-09-14 03:10:28,185 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 03:10:28,192 INFO core: _init_accounts coroutine started
2026-09-14 03:10:28,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 03:10:28,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:15:06,385 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 03:15:27,401 INFO core: Event loop thread started, running loop forever
2026-09-14 03:15:27,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 03:15:27,704 INFO core: _init_accounts coroutine started
2026-09-14 03:15:27,705 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 03:15:27,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:20:30,993 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:20:30,994 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 03:20:30,994 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 03:25:29,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:30:52,612 INFO core: Event loop thread started, running loop forever
2026-09-14 03:30:52,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 03:30:52,916 INFO core: _init_accounts coroutine started
2026-09-14 03:30:52,917 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 03:30:52,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:30:52,929 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 03:30:52,930 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 03:35:49,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:40:39,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:40:39,844 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 03:45:32,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:50:09,882 INFO core: Event loop thread started, running loop forever
2026-09-14 03:50:10,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 03:50:10,190 INFO core: _init_accounts coroutine started
2026-09-14 03:50:10,191 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 03:50:10,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 03:50:39,915 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 03:50:39,916 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 03:50:39,923 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 03:55:17,504 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 03:55:17,505 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 03:55:17,506 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-14 03:55:33,064 INFO core: Event loop thread started, running loop forever
2026-09-14 03:55:33,367 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 03:55:33,370 INFO core: _init_accounts coroutine started
2026-09-14 03:55:33,373 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 03:55:33,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:00:28,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:05:19,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:10:33,750 INFO core: Event loop thread started, running loop forever
2026-09-14 04:10:34,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 04:10:34,058 INFO core: _init_accounts coroutine started
2026-09-14 04:10:34,059 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 04:10:34,069 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 04:10:34,069 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 04:10:34,070 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 04:10:34,071 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 04:10:34,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:15:40,473 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 04:15:40,474 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 04:15:40,474 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 04:15:51,302 INFO core: Event loop thread started, running loop forever
2026-09-14 04:15:51,603 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 04:15:51,608 INFO core: _init_accounts coroutine started
2026-09-14 04:15:51,608 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 04:15:51,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 04:15:51,620 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 04:15:51,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:20:52,111 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 04:20:52,126 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:20:52,132 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 04:25:39,788 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:30:45,498 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 04:30:49,823 INFO core: Event loop thread started, running loop forever
2026-09-14 04:30:50,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 04:30:50,130 INFO core: _init_accounts coroutine started
2026-09-14 04:30:50,131 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 04:30:50,156 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:35:51,800 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 04:35:51,801 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 04:35:51,803 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 04:35:51,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:40:12,214 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 04:40:12,229 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 04:40:12,230 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 04:40:12,235 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 04:40:12,236 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 04:40:12,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:45:19,198 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 04:45:19,200 WARNING core: Account 2: connect timed out after 35s
2026-09-14 04:45:19,212 INFO core: Event loop thread started, running loop forever
2026-09-14 04:45:19,513 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 04:45:19,517 INFO core: _init_accounts coroutine started
2026-09-14 04:45:19,518 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 04:45:19,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:50:03,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 04:55:10,474 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 04:55:22,810 INFO core: Event loop thread started, running loop forever
2026-09-14 04:55:23,111 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 04:55:23,115 INFO core: _init_accounts coroutine started
2026-09-14 04:55:23,116 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 04:55:23,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:00:18,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:05:53,141 INFO core: Event loop thread started, running loop forever
2026-09-14 05:05:53,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 05:05:53,464 INFO core: _init_accounts coroutine started
2026-09-14 05:05:53,464 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 05:05:53,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:10:06,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:10:06,975 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 05:10:06,975 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 05:15:12,530 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 05:15:40,687 INFO core: Event loop thread started, running loop forever
2026-09-14 05:15:40,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 05:15:40,992 INFO core: _init_accounts coroutine started
2026-09-14 05:15:40,995 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 05:15:41,005 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:20:37,198 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:20:37,199 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 05:20:37,200 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 05:25:29,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:30:06,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 05:30:36,835 INFO core: Event loop thread started, running loop forever
2026-09-14 05:30:37,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 05:30:37,139 INFO core: _init_accounts coroutine started
2026-09-14 05:30:37,140 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 05:30:37,145 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:35:29,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:40:42,615 INFO core: Event loop thread started, running loop forever
2026-09-14 05:40:42,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 05:40:42,919 INFO core: _init_accounts coroutine started
2026-09-14 05:40:42,922 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 05:40:42,930 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:45:48,470 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 05:45:49,123 INFO core: Event loop thread started, running loop forever
2026-09-14 05:45:49,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 05:45:49,428 INFO core: _init_accounts coroutine started
2026-09-14 05:45:49,435 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:45:49,436 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 05:50:42,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 05:55:45,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:00:39,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:05:36,570 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 06:05:36,571 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 06:05:36,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:10:16,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:15:22,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 06:15:22,452 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-14 06:15:50,640 INFO core: Event loop thread started, running loop forever
2026-09-14 06:15:50,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 06:15:50,945 INFO core: _init_accounts coroutine started
2026-09-14 06:15:50,948 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 06:15:50,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:20:07,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:25:14,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 06:25:44,180 INFO core: Event loop thread started, running loop forever
2026-09-14 06:25:44,481 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 06:25:44,488 INFO core: _init_accounts coroutine started
2026-09-14 06:25:44,489 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 06:25:44,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:30:09,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:35:16,465 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-14 06:35:41,216 INFO core: Event loop thread started, running loop forever
2026-09-14 06:35:41,520 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 06:35:41,530 INFO core: _init_accounts coroutine started
2026-09-14 06:35:41,531 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 06:35:41,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:40:09,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:45:28,254 INFO core: Event loop thread started, running loop forever
2026-09-14 06:45:28,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 06:45:28,561 INFO core: _init_accounts coroutine started
2026-09-14 06:45:28,561 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 06:45:28,568 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:50:35,473 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 06:50:45,243 INFO core: Event loop thread started, running loop forever
2026-09-14 06:50:45,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 06:50:45,559 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 06:55:37,397 INFO core: _init_accounts coroutine started
2026-09-14 06:55:37,397 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 06:55:37,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:00:35,102 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 07:00:35,102 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 07:00:35,114 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 07:00:35,116 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 07:00:35,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:05:41,503 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 07:05:41,510 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 07:05:41,510 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 07:05:48,745 INFO core: Event loop thread started, running loop forever
2026-09-14 07:05:49,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 07:05:49,055 INFO core: _init_accounts coroutine started
2026-09-14 07:05:49,057 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 07:05:49,063 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:10:28,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:15:35,486 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 07:15:48,379 INFO core: Event loop thread started, running loop forever
2026-09-14 07:15:48,680 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 07:15:48,684 INFO core: _init_accounts coroutine started
2026-09-14 07:15:48,685 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 07:15:48,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:20:37,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:25:09,924 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 07:25:09,925 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 07:25:09,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:30:05,896 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 07:30:05,930 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 07:30:05,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:35:46,369 INFO core: Event loop thread started, running loop forever
2026-09-14 07:35:46,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 07:35:46,678 INFO core: _init_accounts coroutine started
2026-09-14 07:35:46,679 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 07:35:46,693 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:40:45,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:45:07,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 07:45:55,442 INFO core: Event loop thread started, running loop forever
2026-09-14 07:45:55,743 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 07:45:55,750 INFO core: _init_accounts coroutine started
2026-09-14 07:45:55,750 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 07:45:55,773 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 07:45:55,773 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 07:45:55,774 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 07:45:55,776 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 07:45:55,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:50:40,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 07:55:14,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:00:21,465 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 08:00:31,966 INFO core: Event loop thread started, running loop forever
2026-09-14 08:00:32,267 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 08:00:32,272 INFO core: _init_accounts coroutine started
2026-09-14 08:00:32,273 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 08:00:32,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:05:17,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:10:24,480 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 08:10:36,419 INFO core: Event loop thread started, running loop forever
2026-09-14 08:10:36,719 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 08:10:36,724 INFO core: _init_accounts coroutine started
2026-09-14 08:10:36,726 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 08:10:36,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:15:42,648 INFO core: Event loop thread started, running loop forever
2026-09-14 08:15:42,950 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 08:15:42,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:20:12,601 INFO core: _init_accounts coroutine started
2026-09-14 08:20:12,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 08:20:12,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:25:18,747 INFO core: Event loop thread started, running loop forever
2026-09-14 08:25:19,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 08:25:19,057 INFO core: _init_accounts coroutine started
2026-09-14 08:25:19,063 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 08:25:19,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:30:26,531 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 08:30:31,773 INFO core: Event loop thread started, running loop forever
2026-09-14 08:30:32,076 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 08:30:32,084 INFO core: _init_accounts coroutine started
2026-09-14 08:30:32,084 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 08:30:32,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:35:21,793 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 08:35:21,793 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 08:35:21,798 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 08:35:21,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:40:27,494 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 08:40:27,495 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 08:40:50,832 INFO core: Event loop thread started, running loop forever
2026-09-14 08:40:51,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 08:40:51,153 INFO core: _init_accounts coroutine started
2026-09-14 08:40:51,154 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 08:40:51,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:45:29,526 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 08:45:29,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:45:29,529 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 08:45:29,531 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 08:50:36,464 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 08:50:36,465 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 08:50:44,630 INFO core: Event loop thread started, running loop forever
2026-09-14 08:50:44,934 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 08:50:44,941 INFO core: _init_accounts coroutine started
2026-09-14 08:50:44,942 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 08:50:44,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 08:55:45,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:00:28,392 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:05:29,833 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 09:05:29,833 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 09:05:29,837 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 09:05:29,839 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 09:05:29,850 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:10:07,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:15:14,490 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 09:15:41,378 INFO core: Event loop thread started, running loop forever
2026-09-14 09:15:41,681 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 09:15:41,687 INFO core: _init_accounts coroutine started
2026-09-14 09:15:41,692 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 09:15:41,698 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:20:31,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:25:27,224 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 09:25:27,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:30:38,299 INFO core: Event loop thread started, running loop forever
2026-09-14 09:30:38,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 09:30:38,604 INFO core: _init_accounts coroutine started
2026-09-14 09:30:38,606 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 09:30:38,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:35:17,978 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 09:35:18,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:40:33,285 INFO core: Event loop thread started, running loop forever
2026-09-14 09:40:33,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 09:40:33,590 INFO core: _init_accounts coroutine started
2026-09-14 09:40:33,591 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 09:40:33,604 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 09:40:33,604 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 09:40:33,605 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 09:40:33,607 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 09:40:33,621 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:45:33,262 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:50:31,056 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 09:50:31,057 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 09:50:31,065 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 09:50:31,066 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 09:50:31,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:55:38,399 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 09:55:38,399 WARNING core: Account 2: connect timed out after 35s
2026-09-14 09:55:38,400 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-14 09:55:38,400 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-14 09:55:38,401 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 09:55:38,404 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-14 09:55:38,405 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-14 09:55:47,711 INFO core: Event loop thread started, running loop forever
2026-09-14 09:55:48,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 09:55:48,019 INFO core: _init_accounts coroutine started
2026-09-14 09:55:48,019 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 09:55:48,032 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 09:55:48,034 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 09:55:48,034 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 09:55:48,038 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 10:00:06,406 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 10:00:06,408 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 10:00:06,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 10:00:06,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 10:00:13,694 INFO core: Event loop thread started, running loop forever
2026-09-14 10:00:13,995 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 10:00:13,999 INFO core: _init_accounts coroutine started
2026-09-14 10:00:14,000 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 10:00:14,006 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:05:20,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 10:05:43,043 INFO core: Event loop thread started, running loop forever
2026-09-14 10:05:43,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 10:05:43,348 INFO core: _init_accounts coroutine started
2026-09-14 10:05:43,349 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 10:05:43,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:10:40,162 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 10:10:40,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:15:20,536 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:20:44,384 INFO core: Event loop thread started, running loop forever
2026-09-14 10:20:44,686 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 10:20:44,690 INFO core: _init_accounts coroutine started
2026-09-14 10:20:44,691 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 10:20:44,698 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:25:39,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:30:14,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:35:09,332 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 10:35:09,332 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 10:35:09,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:40:16,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 10:40:36,262 INFO core: Event loop thread started, running loop forever
2026-09-14 10:40:36,563 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 10:40:36,572 INFO core: _init_accounts coroutine started
2026-09-14 10:40:36,572 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 10:40:36,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:45:11,778 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:50:17,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 10:50:40,305 INFO core: Event loop thread started, running loop forever
2026-09-14 10:50:40,606 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 10:50:40,609 INFO core: _init_accounts coroutine started
2026-09-14 10:50:40,612 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 10:50:40,621 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 10:55:44,701 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 10:55:44,702 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 10:55:44,704 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 10:55:44,708 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:00:16,909 INFO core: Event loop thread started, running loop forever
2026-09-14 11:00:17,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 11:00:17,230 INFO core: _init_accounts coroutine started
2026-09-14 11:00:17,230 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 11:00:17,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:00:51,959 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 11:00:51,960 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 11:00:51,961 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 11:00:51,961 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 11:05:04,949 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-14 11:05:04,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:10:08,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:15:05,825 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-14 11:15:05,826 INFO core: _init_accounts coroutine started
2026-09-14 11:15:05,826 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 11:15:05,835 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 11:15:05,836 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 11:15:05,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:20:33,745 INFO core: Event loop thread started, running loop forever
2026-09-14 11:20:34,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 11:20:34,054 INFO core: _init_accounts coroutine started
2026-09-14 11:20:34,055 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 11:20:34,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:25:24,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:30:31,290 INFO core: Event loop thread started, running loop forever
2026-09-14 11:30:31,591 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 11:30:31,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:35:31,936 INFO core: _init_accounts coroutine started
2026-09-14 11:35:31,937 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 11:35:31,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:40:38,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 11:40:51,384 INFO core: Event loop thread started, running loop forever
2026-09-14 11:40:51,685 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 11:40:51,691 INFO core: _init_accounts coroutine started
2026-09-14 11:40:51,691 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 11:40:51,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:45:12,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:50:36,911 INFO core: Event loop thread started, running loop forever
2026-09-14 11:50:37,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 11:50:37,216 INFO core: _init_accounts coroutine started
2026-09-14 11:50:37,219 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 11:50:37,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 11:55:49,933 INFO core: Event loop thread started, running loop forever
2026-09-14 11:55:50,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 11:55:50,237 INFO core: _init_accounts coroutine started
2026-09-14 11:55:50,238 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 11:55:50,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:00:44,418 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 12:00:44,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:05:50,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:10:29,842 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-14 12:10:29,843 INFO core: _init_accounts coroutine started
2026-09-14 12:10:29,843 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 12:10:29,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:15:04,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 12:15:15,692 INFO core: Event loop thread started, running loop forever
2026-09-14 12:15:15,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 12:15:15,996 INFO core: _init_accounts coroutine started
2026-09-14 12:15:15,999 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 12:15:16,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:20:22,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 12:20:30,864 INFO core: Event loop thread started, running loop forever
2026-09-14 12:20:31,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 12:20:31,169 INFO core: _init_accounts coroutine started
2026-09-14 12:20:31,170 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 12:20:31,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:25:41,916 INFO core: Event loop thread started, running loop forever
2026-09-14 12:25:42,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 12:25:42,220 INFO core: _init_accounts coroutine started
2026-09-14 12:25:42,220 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 12:25:42,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:30:32,767 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 12:30:32,769 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 12:30:32,774 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 12:30:32,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:30:32,777 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 12:35:39,446 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 12:35:39,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 12:35:39,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 12:35:44,403 INFO core: Event loop thread started, running loop forever
2026-09-14 12:35:44,706 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 12:35:44,712 INFO core: _init_accounts coroutine started
2026-09-14 12:35:44,712 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 12:35:44,718 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:40:47,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:45:38,949 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 12:45:38,954 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:50:39,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 12:55:39,553 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-14 12:55:39,554 INFO core: _init_accounts coroutine started
2026-09-14 12:55:39,554 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 12:55:39,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:00:54,316 INFO core: Event loop thread started, running loop forever
2026-09-14 13:00:54,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 13:00:54,623 INFO core: _init_accounts coroutine started
2026-09-14 13:00:54,623 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 13:00:54,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:05:07,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:10:13,455 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-14 13:10:46,941 INFO core: Event loop thread started, running loop forever
2026-09-14 13:10:47,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 13:10:47,248 INFO core: _init_accounts coroutine started
2026-09-14 13:10:47,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:10:47,253 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 13:10:47,261 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 13:10:47,264 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 13:15:24,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:20:19,299 INFO core: Event loop thread started, running loop forever
2026-09-14 13:20:19,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 13:20:19,606 INFO core: _init_accounts coroutine started
2026-09-14 13:20:19,606 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 13:20:19,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:20:30,308 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 13:25:26,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 13:25:46,967 INFO core: Event loop thread started, running loop forever
2026-09-14 13:25:47,268 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 13:25:47,271 INFO core: _init_accounts coroutine started
2026-09-14 13:25:47,273 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 13:25:47,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:30:53,699 INFO core: Event loop thread started, running loop forever
2026-09-14 13:30:54,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 13:30:54,003 INFO core: _init_accounts coroutine started
2026-09-14 13:30:54,004 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 13:30:54,014 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:35:07,382 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:40:13,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 13:40:13,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 13:40:13,412 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-14 13:40:13,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 13:40:13,413 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-14 13:40:13,413 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 13:40:13,413 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 13:40:13,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 13:40:13,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 13:40:28,023 INFO core: Event loop thread started, running loop forever
2026-09-14 13:40:28,324 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 13:40:28,328 INFO core: _init_accounts coroutine started
2026-09-14 13:40:28,329 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 13:40:28,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:45:13,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:50:20,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 13:50:20,407 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 13:50:20,407 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-14 13:50:20,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 13:50:20,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-14 13:50:20,408 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 13:50:20,408 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-14 13:50:20,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 13:50:20,409 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-14 13:50:33,988 INFO core: Event loop thread started, running loop forever
2026-09-14 13:50:34,289 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 13:50:34,292 INFO core: _init_accounts coroutine started
2026-09-14 13:50:34,293 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 13:50:34,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:55:26,664 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 13:55:26,665 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 13:55:26,665 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 14:00:31,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:05:38,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 14:05:48,744 INFO core: Event loop thread started, running loop forever
2026-09-14 14:05:49,045 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 14:05:49,050 INFO core: _init_accounts coroutine started
2026-09-14 14:05:49,051 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 14:05:49,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:10:21,016 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 14:10:21,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:15:52,608 INFO core: Event loop thread started, running loop forever
2026-09-14 14:15:52,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 14:15:52,915 INFO core: _init_accounts coroutine started
2026-09-14 14:15:52,916 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 14:15:52,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:20:22,029 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 14:20:22,054 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:25:38,499 INFO core: Event loop thread started, running loop forever
2026-09-14 14:25:38,800 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 14:25:38,804 INFO core: _init_accounts coroutine started
2026-09-14 14:25:38,806 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 14:25:38,813 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:30:49,104 INFO core: Event loop thread started, running loop forever
2026-09-14 14:30:49,405 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 14:30:49,409 INFO core: _init_accounts coroutine started
2026-09-14 14:30:49,410 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 14:30:49,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:35:48,542 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 14:35:48,542 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 14:35:48,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:40:44,251 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 14:40:44,256 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 14:40:44,266 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 14:40:44,266 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 14:40:44,271 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 14:40:44,272 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 14:40:44,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:45:13,474 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 14:45:13,475 WARNING core: Account 2: connect timed out after 35s
2026-09-14 14:45:13,475 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-14 14:45:13,476 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-14 14:45:13,476 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 14:45:13,477 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-14 14:45:13,477 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-14 14:45:13,487 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:50:17,608 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 14:50:17,609 WARNING core: Account 2: connect timed out after 35s
2026-09-14 14:50:17,609 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-14 14:50:17,609 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-14 14:50:17,610 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 14:50:17,611 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-14 14:50:17,611 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-14 14:50:17,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 14:55:23,421 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 14:55:23,421 WARNING core: Account 2: connect timed out after 35s
2026-09-14 14:55:23,422 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-14 14:55:23,422 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-14 14:55:23,423 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 14:55:23,424 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-14 14:55:23,425 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-14 14:55:29,657 INFO core: Event loop thread started, running loop forever
2026-09-14 14:55:29,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 14:55:29,961 INFO core: _init_accounts coroutine started
2026-09-14 14:55:29,962 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 14:55:29,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:00:40,058 INFO core: Event loop thread started, running loop forever
2026-09-14 15:00:40,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 15:00:40,362 INFO core: _init_accounts coroutine started
2026-09-14 15:00:40,363 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 15:00:40,370 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:05:26,604 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 15:05:26,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:10:34,765 INFO core: Event loop thread started, running loop forever
2026-09-14 15:10:35,067 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 15:10:35,071 INFO core: _init_accounts coroutine started
2026-09-14 15:10:35,071 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 15:10:35,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:15:06,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:20:07,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:25:14,446 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 15:25:14,447 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 15:25:14,447 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-14 15:25:14,448 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 15:25:14,448 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-14 15:25:14,448 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 15:25:14,449 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 15:25:14,449 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 15:25:14,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 15:25:47,819 INFO core: Event loop thread started, running loop forever
2026-09-14 15:25:48,121 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 15:25:48,124 INFO core: _init_accounts coroutine started
2026-09-14 15:25:48,127 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 15:25:48,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:30:36,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:35:10,346 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 15:35:10,346 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 15:35:10,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:40:13,139 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 15:40:13,145 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 15:40:13,148 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:45:20,405 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 15:45:29,840 INFO core: Event loop thread started, running loop forever
2026-09-14 15:45:30,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 15:45:30,145 INFO core: _init_accounts coroutine started
2026-09-14 15:45:30,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 15:45:30,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:50:36,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 15:50:52,985 INFO core: Event loop thread started, running loop forever
2026-09-14 15:50:53,288 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 15:50:53,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 15:55:33,682 INFO core: _init_accounts coroutine started
2026-09-14 15:55:33,682 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 15:55:33,692 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:00:08,610 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 16:00:08,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:05:09,460 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-14 16:05:09,462 INFO core: _init_accounts coroutine started
2026-09-14 16:05:09,462 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 16:05:09,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 16:05:09,467 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 16:05:09,469 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 16:05:09,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:05:09,471 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 16:10:16,432 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 16:10:33,280 INFO core: Event loop thread started, running loop forever
2026-09-14 16:10:33,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 16:10:33,587 INFO core: _init_accounts coroutine started
2026-09-14 16:10:33,589 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 16:10:33,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:15:40,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 16:15:40,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 16:15:40,405 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-14 16:15:40,406 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 16:15:40,406 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-14 16:15:40,406 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 16:15:40,407 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 16:15:40,407 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 16:15:40,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 16:15:44,380 INFO core: Event loop thread started, running loop forever
2026-09-14 16:15:44,681 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 16:15:44,684 INFO core: _init_accounts coroutine started
2026-09-14 16:15:44,686 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 16:15:44,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:20:20,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:20:20,663 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 16:20:20,663 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 16:25:26,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 16:25:36,428 INFO core: Event loop thread started, running loop forever
2026-09-14 16:25:36,729 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 16:25:36,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:30:20,944 INFO core: _init_accounts coroutine started
2026-09-14 16:30:20,945 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 16:30:20,951 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 16:30:20,951 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 16:30:20,951 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 16:30:20,952 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 16:30:20,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:35:32,437 INFO core: Event loop thread started, running loop forever
2026-09-14 16:35:32,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 16:35:32,743 INFO core: _init_accounts coroutine started
2026-09-14 16:35:32,743 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 16:35:32,749 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:40:14,917 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 16:40:14,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:45:20,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:50:11,353 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-14 16:50:11,354 INFO core: _init_accounts coroutine started
2026-09-14 16:50:11,354 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 16:50:11,359 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 16:55:23,721 INFO core: Event loop thread started, running loop forever
2026-09-14 16:55:24,022 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 16:55:24,026 INFO core: _init_accounts coroutine started
2026-09-14 16:55:24,028 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 16:55:24,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:00:30,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 17:00:38,467 INFO core: Event loop thread started, running loop forever
2026-09-14 17:00:38,771 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 17:00:38,780 INFO core: _init_accounts coroutine started
2026-09-14 17:00:38,780 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 17:00:38,785 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:05:53,356 INFO core: Event loop thread started, running loop forever
2026-09-14 17:05:53,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 17:05:53,660 INFO core: _init_accounts coroutine started
2026-09-14 17:05:53,663 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 17:05:53,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:10:25,515 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 17:10:25,527 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:15:17,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:20:35,919 INFO core: Event loop thread started, running loop forever
2026-09-14 17:20:36,220 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 17:20:36,223 INFO core: _init_accounts coroutine started
2026-09-14 17:20:36,223 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 17:20:36,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:25:50,163 INFO core: Event loop thread started, running loop forever
2026-09-14 17:25:50,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 17:25:50,467 INFO core: _init_accounts coroutine started
2026-09-14 17:25:50,468 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 17:25:50,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:30:16,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:35:22,224 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 17:35:22,224 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:35:22,224 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 17:40:20,493 INFO core: Event loop thread started, running loop forever
2026-09-14 17:40:20,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 17:40:20,798 INFO core: _init_accounts coroutine started
2026-09-14 17:40:20,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 17:40:20,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:45:27,401 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 17:45:30,253 INFO core: Event loop thread started, running loop forever
2026-09-14 17:45:30,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 17:45:30,561 INFO core: _init_accounts coroutine started
2026-09-14 17:45:30,561 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 17:45:30,568 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 17:45:30,568 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 17:45:30,569 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 17:45:30,570 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 17:45:30,580 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 17:45:30,581 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 17:45:30,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:45:30,591 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 17:45:30,599 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 17:50:07,312 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 17:50:07,313 WARNING core: Account 2: connect timed out after 35s
2026-09-14 17:50:07,313 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-14 17:50:07,314 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-14 17:50:07,314 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 17:50:07,315 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-14 17:50:07,316 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-14 17:50:07,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 17:55:13,396 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 17:55:13,397 WARNING core: Account 2: connect timed out after 35s
2026-09-14 17:55:13,398 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-14 17:55:13,398 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-14 17:55:13,399 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 17:55:13,400 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-14 17:55:13,401 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-14 17:55:27,014 INFO core: Event loop thread started, running loop forever
2026-09-14 17:55:27,316 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 17:55:27,319 INFO core: _init_accounts coroutine started
2026-09-14 17:55:27,322 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 17:55:27,326 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:00:53,638 INFO core: Event loop thread started, running loop forever
2026-09-14 18:00:53,939 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 18:00:53,943 INFO core: _init_accounts coroutine started
2026-09-14 18:00:53,943 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 18:00:53,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:05:44,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:10:39,965 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 18:10:39,965 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 18:10:40,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:15:18,863 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 18:15:18,866 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 18:15:18,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:20:24,384 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 18:20:26,523 INFO core: Event loop thread started, running loop forever
2026-09-14 18:20:26,824 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 18:20:26,828 INFO core: _init_accounts coroutine started
2026-09-14 18:20:26,829 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 18:20:26,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:25:32,148 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 18:25:32,148 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 18:25:32,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:25:32,150 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 18:30:50,113 INFO core: Event loop thread started, running loop forever
2026-09-14 18:30:50,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 18:30:50,419 INFO core: _init_accounts coroutine started
2026-09-14 18:30:50,420 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 18:30:50,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:35:46,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:35:46,287 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 18:35:46,288 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 18:35:46,289 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 18:40:13,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:40:13,546 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 18:45:20,522 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 18:45:43,788 INFO core: Event loop thread started, running loop forever
2026-09-14 18:45:44,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 18:45:44,092 INFO core: _init_accounts coroutine started
2026-09-14 18:45:44,093 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 18:45:44,107 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:50:15,338 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 18:50:15,339 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 18:50:15,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 18:55:19,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:00:20,480 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 19:00:20,485 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 19:00:20,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:05:46,864 INFO core: Event loop thread started, running loop forever
2026-09-14 19:05:47,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 19:05:47,170 INFO core: _init_accounts coroutine started
2026-09-14 19:05:47,172 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 19:05:47,178 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:10:33,037 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 19:10:33,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:15:04,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:20:46,576 INFO core: Event loop thread started, running loop forever
2026-09-14 19:20:46,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 19:20:46,882 INFO core: _init_accounts coroutine started
2026-09-14 19:20:46,882 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 19:20:46,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:25:38,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:30:08,310 INFO core: Event loop thread started, running loop forever
2026-09-14 19:30:08,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 19:30:08,618 INFO core: _init_accounts coroutine started
2026-09-14 19:30:08,621 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 19:30:08,633 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-14 19:30:08,636 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-14 19:35:09,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:40:25,310 INFO core: Event loop thread started, running loop forever
2026-09-14 19:40:25,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 19:40:25,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:45:32,437 INFO core: _init_accounts coroutine started
2026-09-14 19:45:32,437 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 19:45:32,438 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-14 19:45:47,714 INFO core: Event loop thread started, running loop forever
2026-09-14 19:45:48,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 19:45:48,023 INFO core: _init_accounts coroutine started
2026-09-14 19:45:48,023 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 19:45:48,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:45:48,048 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 19:45:48,048 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 19:50:22,732 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 19:50:22,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 19:55:29,380 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 19:55:29,417 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 19:55:29,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 19:55:29,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 19:55:37,543 INFO core: Event loop thread started, running loop forever
2026-09-14 19:55:37,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 19:55:37,847 INFO core: _init_accounts coroutine started
2026-09-14 19:55:37,849 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 19:55:37,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:00:21,540 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 20:00:21,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:05:17,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:10:09,998 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-14 20:10:09,999 INFO core: _init_accounts coroutine started
2026-09-14 20:10:09,999 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 20:10:10,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:15:14,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:15:14,838 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 20:15:14,838 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 20:20:13,726 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 20:20:13,730 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 20:20:13,753 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 20:20:13,753 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 20:20:13,759 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 20:20:13,760 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 20:20:13,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:25:19,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 20:25:27,658 INFO core: Event loop thread started, running loop forever
2026-09-14 20:25:27,960 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 20:25:27,963 INFO core: _init_accounts coroutine started
2026-09-14 20:25:27,966 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 20:25:27,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:30:33,375 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 20:30:47,837 INFO core: Event loop thread started, running loop forever
2026-09-14 20:30:48,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 20:30:48,142 INFO core: _init_accounts coroutine started
2026-09-14 20:30:48,144 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 20:30:48,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:30:48,153 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 20:30:48,153 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 20:30:48,154 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 20:30:48,155 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 20:35:38,731 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 20:35:38,732 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 20:35:38,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:40:16,564 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 20:40:16,566 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 20:40:16,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:45:16,073 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 20:45:16,073 WARNING core: Account 2: connect timed out after 35s
2026-09-14 20:45:16,074 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-14 20:45:16,074 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-14 20:45:16,075 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 20:45:16,076 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-14 20:45:16,077 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-14 20:45:16,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:50:21,217 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 20:50:21,218 WARNING core: Account 2: connect timed out after 35s
2026-09-14 20:50:21,218 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-14 20:50:21,218 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-14 20:50:21,218 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 20:50:21,219 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-14 20:50:21,219 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-14 20:50:21,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 20:55:28,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 20:55:28,409 WARNING core: Account 2: connect timed out after 35s
2026-09-14 20:55:28,410 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-14 20:55:28,410 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-14 20:55:28,411 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 20:55:28,412 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-14 20:55:28,412 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-14 20:55:52,040 INFO core: Event loop thread started, running loop forever
2026-09-14 20:55:52,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 20:55:52,345 INFO core: _init_accounts coroutine started
2026-09-14 20:55:52,346 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 20:55:52,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:00:33,091 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 21:00:33,092 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 21:00:33,097 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 21:00:33,103 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 21:00:33,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:05:38,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:10:44,425 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 21:10:44,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 21:10:44,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 21:10:45,484 INFO core: Event loop thread started, running loop forever
2026-09-14 21:10:45,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 21:10:45,792 INFO core: _init_accounts coroutine started
2026-09-14 21:10:45,792 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 21:10:45,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:10:45,815 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 21:15:42,471 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 21:15:42,475 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 21:15:42,480 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 21:15:42,489 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:20:42,963 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 21:20:42,963 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 21:20:42,964 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:25:49,391 INFO core: Event loop thread started, running loop forever
2026-09-14 21:25:49,692 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 21:25:49,700 INFO core: _init_accounts coroutine started
2026-09-14 21:25:49,701 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 21:25:49,708 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:30:24,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:35:31,784 INFO core: Event loop thread started, running loop forever
2026-09-14 21:35:32,090 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 21:35:32,096 INFO core: _init_accounts coroutine started
2026-09-14 21:35:32,096 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 21:35:32,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:40:27,257 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:45:08,691 INFO core: Event loop thread started, running loop forever
2026-09-14 21:45:08,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 21:45:08,998 INFO core: _init_accounts coroutine started
2026-09-14 21:45:08,999 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 21:45:09,006 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-14 21:45:09,006 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-14 21:45:33,719 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 21:45:33,719 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 21:45:33,719 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-14 21:45:33,720 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 21:45:33,720 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-14 21:45:33,720 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 21:45:33,720 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 21:45:33,720 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 21:45:33,721 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 21:50:36,658 INFO core: Event loop thread started, running loop forever
2026-09-14 21:50:36,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 21:50:36,962 INFO core: _init_accounts coroutine started
2026-09-14 21:50:36,964 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 21:50:36,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 21:55:37,484 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:00:26,282 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 22:00:26,282 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 22:00:26,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:05:06,410 INFO core: Event loop thread started, running loop forever
2026-09-14 22:05:06,711 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 22:05:06,719 INFO core: _init_accounts coroutine started
2026-09-14 22:05:06,719 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 22:05:06,727 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-14 22:05:06,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:10:03,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:15:28,770 INFO core: Event loop thread started, running loop forever
2026-09-14 22:15:29,071 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 22:15:29,076 INFO core: _init_accounts coroutine started
2026-09-14 22:15:29,077 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 22:15:29,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:20:13,270 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 22:20:13,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:25:26,509 INFO core: Event loop thread started, running loop forever
2026-09-14 22:25:26,810 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 22:25:26,814 INFO core: _init_accounts coroutine started
2026-09-14 22:25:26,815 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 22:25:26,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:30:17,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:35:23,934 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 22:35:23,935 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 22:35:23,936 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-14 22:35:23,937 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 22:35:23,946 INFO core: Event loop thread started, running loop forever
2026-09-14 22:35:24,248 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 22:35:24,251 INFO core: _init_accounts coroutine started
2026-09-14 22:35:24,253 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 22:35:24,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:40:31,396 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-14 22:40:33,035 INFO core: Event loop thread started, running loop forever
2026-09-14 22:40:33,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 22:40:33,339 INFO core: _init_accounts coroutine started
2026-09-14 22:40:33,340 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 22:40:33,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:45:08,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:50:15,380 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 22:50:15,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 22:50:15,382 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-14 22:50:15,383 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 22:50:15,383 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-14 22:50:15,383 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 22:50:15,383 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-14 22:50:15,383 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 22:50:15,383 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 22:50:36,565 INFO core: Event loop thread started, running loop forever
2026-09-14 22:50:36,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 22:50:36,869 INFO core: _init_accounts coroutine started
2026-09-14 22:50:36,872 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 22:50:36,879 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 22:50:36,880 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 22:50:36,880 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 22:50:36,881 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 22:50:36,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 22:55:12,937 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 22:55:12,937 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 22:55:12,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:00:18,391 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 23:00:29,888 INFO core: Event loop thread started, running loop forever
2026-09-14 23:00:30,190 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 23:00:30,195 INFO core: _init_accounts coroutine started
2026-09-14 23:00:30,196 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 23:00:30,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:05:48,818 INFO core: Event loop thread started, running loop forever
2026-09-14 23:05:49,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 23:05:49,122 INFO core: _init_accounts coroutine started
2026-09-14 23:05:49,124 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 23:05:49,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:10:18,470 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 23:10:18,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:15:11,109 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:20:53,806 INFO core: Event loop thread started, running loop forever
2026-09-14 23:20:54,107 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 23:20:54,111 INFO core: _init_accounts coroutine started
2026-09-14 23:20:54,114 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 23:20:54,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:25:13,653 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 23:25:13,654 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 23:25:13,661 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:30:19,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 23:30:45,233 INFO core: Event loop thread started, running loop forever
2026-09-14 23:30:45,535 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 23:30:45,546 INFO core: _init_accounts coroutine started
2026-09-14 23:30:45,546 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 23:30:45,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:35:51,340 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-14 23:35:51,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:40:43,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:45:27,661 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-14 23:45:27,662 INFO core: _init_accounts coroutine started
2026-09-14 23:45:27,662 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 23:45:27,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:50:33,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-14 23:50:46,912 INFO core: Event loop thread started, running loop forever
2026-09-14 23:50:47,214 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-14 23:50:47,220 INFO core: _init_accounts coroutine started
2026-09-14 23:50:47,221 INFO core: _init_accounts_inner: starting DB migrations
2026-09-14 23:50:47,232 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-14 23:50:47,232 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-14 23:50:47,234 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-14 23:50:47,235 INFO core: _init_accounts_inner: reloading LLM config
2026-09-14 23:50:47,253 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-14 23:50:47,254 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-14 23:50:47,258 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-14 23:50:47,259 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-14 23:50:47,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-14 23:55:50,916 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-14 23:55:50,917 WARNING core: Account 2: connect timed out after 35s
2026-09-14 23:55:50,917 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-14 23:55:50,917 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-14 23:55:50,918 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-14 23:55:50,919 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-14 23:55:50,920 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-14 23:55:50,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:00:35,268 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 00:00:35,269 WARNING core: Account 2: connect timed out after 35s
2026-09-15 00:00:35,270 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-15 00:00:35,271 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-15 00:00:35,271 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-15 00:00:35,273 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-15 00:00:35,273 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-15 00:00:35,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:05:24,547 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 00:05:24,547 WARNING core: Account 2: connect timed out after 35s
2026-09-15 00:05:24,548 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-15 00:05:24,548 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-15 00:05:24,549 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-15 00:05:24,550 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-15 00:05:24,550 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-15 00:05:24,553 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:10:26,143 INFO core: Event loop thread started, running loop forever
2026-09-15 00:10:26,444 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 00:10:26,448 INFO core: _init_accounts coroutine started
2026-09-15 00:10:26,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 00:10:26,458 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:10:31,141 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 00:10:31,142 WARNING core: Account 2: connect timed out after 35s
2026-09-15 00:15:16,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:20:23,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 00:20:48,909 INFO core: Event loop thread started, running loop forever
2026-09-15 00:20:49,210 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 00:20:49,214 INFO core: _init_accounts coroutine started
2026-09-15 00:20:49,216 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 00:20:49,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:25:13,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:30:14,797 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 00:30:14,798 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 00:30:14,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:30:14,803 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 00:35:17,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:40:24,433 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 00:40:24,434 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 00:40:24,434 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 00:40:24,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 00:40:29,838 INFO core: Event loop thread started, running loop forever
2026-09-15 00:40:30,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 00:40:30,144 INFO core: _init_accounts coroutine started
2026-09-15 00:40:30,144 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 00:40:30,151 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:45:13,288 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 00:45:13,288 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 00:45:13,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:50:20,398 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 00:50:20,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 00:50:20,400 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 00:50:20,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 00:50:20,401 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 00:50:20,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 00:50:20,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 00:50:39,452 INFO core: Event loop thread started, running loop forever
2026-09-15 00:50:39,752 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 00:50:39,756 INFO core: _init_accounts coroutine started
2026-09-15 00:50:39,758 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 00:50:39,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 00:55:21,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 00:55:21,401 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 00:55:21,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 00:55:21,405 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 00:55:21,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:00:28,467 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 01:00:29,412 INFO core: Event loop thread started, running loop forever
2026-09-15 01:00:29,717 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 01:00:29,722 INFO core: _init_accounts coroutine started
2026-09-15 01:00:29,722 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 01:00:29,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:05:11,867 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:10:03,160 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 01:10:03,160 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 01:10:03,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:15:25,936 INFO core: Event loop thread started, running loop forever
2026-09-15 01:15:26,237 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 01:15:26,240 INFO core: _init_accounts coroutine started
2026-09-15 01:15:26,242 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 01:15:26,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:20:35,217 INFO core: Event loop thread started, running loop forever
2026-09-15 01:20:35,518 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 01:20:35,522 INFO core: _init_accounts coroutine started
2026-09-15 01:20:35,525 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 01:20:35,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:25:42,356 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 01:25:50,321 INFO core: Event loop thread started, running loop forever
2026-09-15 01:25:50,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 01:25:50,631 INFO core: _init_accounts coroutine started
2026-09-15 01:25:50,631 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 01:25:50,636 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:30:22,059 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 01:30:22,059 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 01:30:22,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:35:29,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 01:35:29,406 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 01:35:39,506 INFO core: Event loop thread started, running loop forever
2026-09-15 01:35:39,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 01:35:39,811 INFO core: _init_accounts coroutine started
2026-09-15 01:35:39,813 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 01:35:39,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:40:27,895 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 01:40:27,895 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 01:40:27,897 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 01:40:27,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:40:27,899 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 01:45:53,204 INFO core: Event loop thread started, running loop forever
2026-09-15 01:45:53,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 01:45:53,507 INFO core: _init_accounts coroutine started
2026-09-15 01:45:53,509 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 01:45:53,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:50:31,661 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 01:50:31,661 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 01:50:31,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 01:50:31,662 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 01:55:15,548 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 01:55:15,554 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:00:45,340 INFO core: Event loop thread started, running loop forever
2026-09-15 02:00:45,642 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 02:00:45,645 INFO core: _init_accounts coroutine started
2026-09-15 02:00:45,648 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 02:00:45,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:05:12,305 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 02:05:12,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:10:36,798 INFO core: Event loop thread started, running loop forever
2026-09-15 02:10:37,099 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 02:10:37,103 INFO core: _init_accounts coroutine started
2026-09-15 02:10:37,105 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 02:10:37,113 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 02:10:37,113 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 02:10:37,114 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 02:10:37,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:10:37,116 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 02:15:24,022 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:20:19,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:20:19,121 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 02:20:19,128 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 02:25:32,863 INFO core: Event loop thread started, running loop forever
2026-09-15 02:25:33,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 02:25:33,173 INFO core: _init_accounts coroutine started
2026-09-15 02:25:33,174 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 02:25:33,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:30:32,993 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 02:30:33,005 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:35:38,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:40:06,608 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-15 02:40:06,609 INFO core: _init_accounts coroutine started
2026-09-15 02:40:06,609 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 02:40:06,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:45:40,142 INFO core: Event loop thread started, running loop forever
2026-09-15 02:45:40,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 02:45:40,449 INFO core: _init_accounts coroutine started
2026-09-15 02:45:40,460 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 02:45:40,464 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:50:46,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 02:50:46,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 02:50:46,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 02:50:46,388 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 02:55:19,115 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 02:55:19,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:00:38,137 INFO core: Event loop thread started, running loop forever
2026-09-15 03:00:38,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:00:38,442 INFO core: _init_accounts coroutine started
2026-09-15 03:00:38,445 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:00:38,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:05:23,211 INFO core: Event loop thread started, running loop forever
2026-09-15 03:05:23,512 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:05:23,516 INFO core: _init_accounts coroutine started
2026-09-15 03:05:23,517 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:05:23,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:15:48,995 INFO core: Event loop thread started, running loop forever
2026-09-15 03:15:49,296 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:15:49,300 INFO core: _init_accounts coroutine started
2026-09-15 03:15:49,300 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:15:49,310 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 03:15:49,310 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 03:15:49,311 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 03:15:49,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:15:49,312 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 03:20:52,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:25:04,378 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:30:11,422 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 03:30:35,050 INFO core: Event loop thread started, running loop forever
2026-09-15 03:30:35,351 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:30:35,360 INFO core: _init_accounts coroutine started
2026-09-15 03:30:35,361 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:30:35,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:30:35,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 03:35:42,359 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 03:35:43,058 INFO core: Event loop thread started, running loop forever
2026-09-15 03:35:43,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:35:43,362 INFO core: _init_accounts coroutine started
2026-09-15 03:35:43,364 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:35:43,379 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:40:26,871 INFO core: Event loop thread started, running loop forever
2026-09-15 03:40:27,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:40:27,175 INFO core: _init_accounts coroutine started
2026-09-15 03:40:27,177 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:40:27,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:40:50,891 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 03:45:08,252 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 03:45:08,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:50:28,728 INFO core: Event loop thread started, running loop forever
2026-09-15 03:50:29,029 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:50:29,035 INFO core: _init_accounts coroutine started
2026-09-15 03:50:29,035 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:50:29,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 03:55:50,859 INFO core: Event loop thread started, running loop forever
2026-09-15 03:55:51,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 03:55:51,164 INFO core: _init_accounts coroutine started
2026-09-15 03:55:51,166 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 03:55:51,171 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:00:51,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:05:12,650 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:10:53,090 INFO core: Event loop thread started, running loop forever
2026-09-15 04:10:53,390 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 04:10:53,394 INFO core: _init_accounts coroutine started
2026-09-15 04:10:53,396 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 04:10:53,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:15:16,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:15:16,495 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 04:20:23,424 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 04:20:23,425 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-15 04:20:40,346 INFO core: Event loop thread started, running loop forever
2026-09-15 04:20:40,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 04:20:40,651 INFO core: _init_accounts coroutine started
2026-09-15 04:20:40,653 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 04:20:40,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:25:25,375 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 04:25:25,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 04:25:25,383 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 04:25:25,384 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 04:25:25,390 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:30:19,675 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:35:21,572 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:40:28,432 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 04:40:28,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 04:40:52,500 INFO core: Event loop thread started, running loop forever
2026-09-15 04:40:52,801 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 04:40:52,805 INFO core: _init_accounts coroutine started
2026-09-15 04:40:52,807 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 04:40:52,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:45:26,773 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 04:45:26,797 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:50:17,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 04:55:50,942 INFO core: Event loop thread started, running loop forever
2026-09-15 04:55:51,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 04:55:51,246 INFO core: _init_accounts coroutine started
2026-09-15 04:55:51,248 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 04:55:51,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:00:06,439 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 05:00:06,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:05:12,142 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:10:07,621 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-15 05:10:07,624 INFO core: _init_accounts coroutine started
2026-09-15 05:10:07,625 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 05:10:07,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:15:40,406 INFO core: Event loop thread started, running loop forever
2026-09-15 05:15:40,707 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 05:15:40,710 INFO core: _init_accounts coroutine started
2026-09-15 05:15:40,712 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 05:15:40,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:20:49,063 INFO core: Event loop thread started, running loop forever
2026-09-15 05:20:49,372 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 05:20:49,376 INFO core: _init_accounts coroutine started
2026-09-15 05:20:49,377 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 05:20:49,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:25:09,137 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 05:25:09,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:30:07,262 INFO core: Event loop thread started, running loop forever
2026-09-15 05:30:07,564 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 05:30:07,568 INFO core: _init_accounts coroutine started
2026-09-15 05:30:07,570 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 05:30:07,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:35:14,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 05:35:35,823 INFO core: Event loop thread started, running loop forever
2026-09-15 05:35:36,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 05:35:36,127 INFO core: _init_accounts coroutine started
2026-09-15 05:35:36,129 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 05:35:36,135 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:40:46,457 INFO core: Event loop thread started, running loop forever
2026-09-15 05:40:46,758 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 05:40:46,763 INFO core: _init_accounts coroutine started
2026-09-15 05:40:46,763 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 05:40:46,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:45:42,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:50:31,736 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 05:50:31,738 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 05:50:31,738 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 05:55:31,224 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 05:55:31,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:00:21,525 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 06:00:21,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:05:17,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:10:04,474 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:15:46,183 INFO core: Event loop thread started, running loop forever
2026-09-15 06:15:46,484 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 06:15:46,489 INFO core: _init_accounts coroutine started
2026-09-15 06:15:46,489 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 06:15:46,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:20:14,531 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 06:20:14,531 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 06:20:14,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:25:21,406 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 06:25:21,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 06:25:29,092 INFO core: Event loop thread started, running loop forever
2026-09-15 06:25:29,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 06:25:29,398 INFO core: _init_accounts coroutine started
2026-09-15 06:25:29,399 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 06:25:29,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:30:03,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:35:09,121 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 06:35:09,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:40:38,129 INFO core: Event loop thread started, running loop forever
2026-09-15 06:40:38,430 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 06:40:38,435 INFO core: _init_accounts coroutine started
2026-09-15 06:40:38,436 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 06:40:38,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:45:28,468 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:50:40,518 INFO core: Event loop thread started, running loop forever
2026-09-15 06:50:40,819 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 06:50:40,822 INFO core: _init_accounts coroutine started
2026-09-15 06:50:40,824 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 06:50:40,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 06:55:15,615 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 06:55:15,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:00:42,958 INFO core: Event loop thread started, running loop forever
2026-09-15 07:00:43,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:00:43,268 INFO core: _init_accounts coroutine started
2026-09-15 07:00:43,268 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:00:43,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:05:39,422 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 07:05:39,422 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 07:05:39,424 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 07:05:39,428 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 07:05:39,431 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:10:49,528 INFO core: Event loop thread started, running loop forever
2026-09-15 07:10:49,830 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:10:49,834 INFO core: _init_accounts coroutine started
2026-09-15 07:10:49,836 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:10:49,844 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 07:10:49,845 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 07:10:49,846 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 07:10:49,847 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 07:10:49,861 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 07:10:49,861 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 07:10:49,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:10:49,868 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-15 07:15:06,200 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-15 07:15:06,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:20:13,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 07:20:16,051 INFO core: Event loop thread started, running loop forever
2026-09-15 07:20:16,352 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:20:16,360 INFO core: _init_accounts coroutine started
2026-09-15 07:20:16,362 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:20:16,375 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 07:20:16,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:20:16,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 07:25:29,432 INFO core: Event loop thread started, running loop forever
2026-09-15 07:25:29,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:25:29,737 INFO core: _init_accounts coroutine started
2026-09-15 07:25:29,740 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:25:29,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:30:56,208 INFO core: Event loop thread started, running loop forever
2026-09-15 07:30:56,509 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:30:56,511 INFO core: _init_accounts coroutine started
2026-09-15 07:30:56,512 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:30:56,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:35:19,398 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:40:25,511 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 07:40:26,767 INFO core: Event loop thread started, running loop forever
2026-09-15 07:40:27,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:40:27,076 INFO core: _init_accounts coroutine started
2026-09-15 07:40:27,078 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:40:27,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:45:39,237 INFO core: Event loop thread started, running loop forever
2026-09-15 07:45:39,538 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:45:39,541 INFO core: _init_accounts coroutine started
2026-09-15 07:45:39,543 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:45:39,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:50:46,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 07:50:46,410 INFO core: Event loop thread started, running loop forever
2026-09-15 07:50:46,711 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 07:50:46,717 INFO core: _init_accounts coroutine started
2026-09-15 07:50:46,718 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 07:50:46,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 07:55:33,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:00:12,491 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 08:00:12,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:05:22,513 INFO core: Event loop thread started, running loop forever
2026-09-15 08:05:22,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 08:05:22,822 INFO core: _init_accounts coroutine started
2026-09-15 08:05:22,822 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 08:05:22,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:10:22,513 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:15:28,212 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 08:15:28,213 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 08:15:28,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:15:28,219 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 08:20:17,517 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 08:20:17,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:25:23,404 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 08:25:24,837 INFO core: Event loop thread started, running loop forever
2026-09-15 08:25:25,138 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 08:25:25,142 INFO core: _init_accounts coroutine started
2026-09-15 08:25:25,142 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 08:25:25,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:30:35,385 INFO core: Event loop thread started, running loop forever
2026-09-15 08:30:35,686 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 08:30:35,689 INFO core: _init_accounts coroutine started
2026-09-15 08:30:35,691 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 08:30:35,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:35:16,005 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 08:35:16,005 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 08:35:16,011 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:40:27,973 INFO core: Event loop thread started, running loop forever
2026-09-15 08:40:28,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 08:40:28,277 INFO core: _init_accounts coroutine started
2026-09-15 08:40:28,279 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 08:40:28,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:45:34,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 08:45:40,863 INFO core: Event loop thread started, running loop forever
2026-09-15 08:45:41,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 08:45:41,170 INFO core: _init_accounts coroutine started
2026-09-15 08:45:41,172 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 08:45:41,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:50:06,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 08:55:13,436 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 08:55:36,899 INFO core: Event loop thread started, running loop forever
2026-09-15 08:55:37,200 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 08:55:37,204 INFO core: _init_accounts coroutine started
2026-09-15 08:55:37,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 08:55:37,216 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 08:55:37,216 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 08:55:37,218 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 08:55:37,219 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 08:55:37,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:00:07,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:05:35,992 INFO core: Event loop thread started, running loop forever
2026-09-15 09:05:36,293 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 09:05:36,296 INFO core: _init_accounts coroutine started
2026-09-15 09:05:36,297 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 09:05:36,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:10:23,185 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 09:10:23,186 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:10:23,188 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 09:15:25,458 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 09:15:25,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:20:32,405 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 09:20:48,696 INFO core: Event loop thread started, running loop forever
2026-09-15 09:20:48,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 09:20:49,003 INFO core: _init_accounts coroutine started
2026-09-15 09:20:49,004 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 09:20:49,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:25:21,088 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 09:25:21,088 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 09:25:21,090 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:30:16,501 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 09:30:16,505 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:35:36,106 INFO core: Event loop thread started, running loop forever
2026-09-15 09:35:36,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 09:35:36,412 INFO core: _init_accounts coroutine started
2026-09-15 09:35:36,413 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 09:35:36,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:40:21,856 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:45:04,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 09:45:51,176 INFO core: Event loop thread started, running loop forever
2026-09-15 09:45:51,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 09:45:51,480 INFO core: _init_accounts coroutine started
2026-09-15 09:45:51,481 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 09:45:51,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:50:08,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:55:15,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 09:55:18,457 INFO core: Event loop thread started, running loop forever
2026-09-15 09:55:18,763 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 09:55:18,779 INFO core: _init_accounts coroutine started
2026-09-15 09:55:18,779 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 09:55:18,824 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 09:55:18,824 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 09:55:18,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 09:55:18,828 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 10:00:07,366 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 10:00:07,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:05:07,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:10:06,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:15:20,093 INFO core: Event loop thread started, running loop forever
2026-09-15 10:15:20,394 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 10:15:20,399 INFO core: _init_accounts coroutine started
2026-09-15 10:15:20,402 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 10:15:20,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:20:27,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 10:20:41,201 INFO core: Event loop thread started, running loop forever
2026-09-15 10:20:41,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 10:20:41,508 INFO core: _init_accounts coroutine started
2026-09-15 10:20:41,509 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 10:20:41,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:25:09,170 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 10:25:09,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:30:47,587 INFO core: Event loop thread started, running loop forever
2026-09-15 10:30:47,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 10:30:47,892 INFO core: _init_accounts coroutine started
2026-09-15 10:30:47,893 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 10:30:47,899 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:35:04,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:40:34,866 INFO core: Event loop thread started, running loop forever
2026-09-15 10:40:35,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 10:40:35,182 INFO core: _init_accounts coroutine started
2026-09-15 10:40:35,183 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 10:40:35,193 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:45:07,628 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 10:45:07,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:50:26,945 INFO core: Event loop thread started, running loop forever
2026-09-15 10:50:27,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 10:50:27,257 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:55:20,797 INFO core: _init_accounts coroutine started
2026-09-15 10:55:20,797 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 10:55:20,804 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 10:55:20,805 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 10:55:20,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 10:55:20,806 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 11:00:27,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 11:00:32,360 INFO core: Event loop thread started, running loop forever
2026-09-15 11:00:32,662 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 11:00:32,665 INFO core: _init_accounts coroutine started
2026-09-15 11:00:32,666 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 11:00:32,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:05:26,023 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 11:05:26,023 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 11:05:26,026 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 11:05:26,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:05:26,028 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 11:10:17,119 INFO core: Event loop thread started, running loop forever
2026-09-15 11:10:17,421 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 11:10:17,425 INFO core: _init_accounts coroutine started
2026-09-15 11:10:17,426 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 11:10:17,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:10:33,143 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 11:15:06,920 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-15 11:15:06,931 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-15 11:20:34,960 INFO core: Event loop thread started, running loop forever
2026-09-15 11:20:35,261 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 11:20:35,266 INFO core: _init_accounts coroutine started
2026-09-15 11:20:35,268 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 11:20:35,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:25:27,715 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 11:25:27,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:30:51,288 INFO core: Event loop thread started, running loop forever
2026-09-15 11:30:51,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 11:30:51,595 INFO core: _init_accounts coroutine started
2026-09-15 11:30:51,595 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 11:30:51,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:35:25,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:40:25,345 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 11:40:25,346 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 11:40:25,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:40:25,351 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 11:45:23,276 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 11:45:23,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:50:27,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 11:55:33,464 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 11:55:33,465 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 11:55:50,107 INFO core: Event loop thread started, running loop forever
2026-09-15 11:55:50,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 11:55:50,411 INFO core: _init_accounts coroutine started
2026-09-15 11:55:50,414 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 11:55:50,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:00:06,363 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 12:00:11,911 INFO core: Event loop thread started, running loop forever
2026-09-15 12:00:12,213 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 12:00:12,217 INFO core: _init_accounts coroutine started
2026-09-15 12:00:12,217 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 12:00:12,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:05:18,449 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 12:05:33,070 INFO core: Event loop thread started, running loop forever
2026-09-15 12:05:33,372 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 12:05:33,378 INFO core: _init_accounts coroutine started
2026-09-15 12:05:33,378 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 12:05:33,389 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:10:06,401 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:15:12,857 INFO core: Event loop thread started, running loop forever
2026-09-15 12:15:13,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 12:15:13,176 INFO core: _init_accounts coroutine started
2026-09-15 12:15:13,176 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 12:15:13,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:20:19,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 12:20:50,145 INFO core: Event loop thread started, running loop forever
2026-09-15 12:20:50,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 12:20:50,450 INFO core: _init_accounts coroutine started
2026-09-15 12:20:50,453 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 12:20:50,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:25:05,116 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 12:25:05,119 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 12:25:05,127 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 12:25:05,129 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 12:25:05,140 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 12:25:05,143 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 12:25:05,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:30:12,466 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-15 12:30:12,467 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-15 12:30:50,185 INFO core: Event loop thread started, running loop forever
2026-09-15 12:30:50,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 12:30:50,491 INFO core: _init_accounts coroutine started
2026-09-15 12:30:50,491 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 12:30:50,496 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:35:12,682 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 12:35:12,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:40:14,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:45:13,096 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-15 12:45:13,097 INFO core: _init_accounts coroutine started
2026-09-15 12:45:13,097 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 12:45:13,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:50:50,903 INFO core: Event loop thread started, running loop forever
2026-09-15 12:50:51,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 12:50:51,207 INFO core: _init_accounts coroutine started
2026-09-15 12:50:51,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 12:50:51,213 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 12:55:08,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:00:49,069 INFO core: Event loop thread started, running loop forever
2026-09-15 13:00:49,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 13:00:49,381 INFO core: _init_accounts coroutine started
2026-09-15 13:00:49,385 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 13:00:49,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 13:00:49,407 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 13:00:49,408 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:00:49,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 13:05:20,007 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 13:05:20,007 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:10:27,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 13:10:47,039 INFO core: Event loop thread started, running loop forever
2026-09-15 13:10:47,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 13:10:47,344 INFO core: _init_accounts coroutine started
2026-09-15 13:10:47,346 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 13:10:47,351 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:15:18,054 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:20:13,091 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 13:20:13,091 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 13:20:13,092 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 13:20:13,094 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 13:20:13,095 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:25:20,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 13:25:22,753 INFO core: Event loop thread started, running loop forever
2026-09-15 13:25:23,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 13:25:23,057 INFO core: _init_accounts coroutine started
2026-09-15 13:25:23,060 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 13:25:23,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:30:17,437 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 13:30:17,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:35:43,863 INFO core: Event loop thread started, running loop forever
2026-09-15 13:35:44,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 13:35:44,167 INFO core: _init_accounts coroutine started
2026-09-15 13:35:44,169 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 13:35:44,175 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 13:35:44,175 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 13:35:44,176 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 13:35:44,177 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 13:35:44,184 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 13:35:44,185 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 13:35:44,188 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-15 13:35:44,189 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-15 13:35:44,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:40:28,850 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 13:40:28,850 WARNING core: Account 2: connect timed out after 35s
2026-09-15 13:40:28,851 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-15 13:40:28,852 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-15 13:40:28,853 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-15 13:40:28,854 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-15 13:40:28,854 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-15 13:40:28,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:45:49,431 INFO core: Event loop thread started, running loop forever
2026-09-15 13:45:49,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 13:45:49,736 INFO core: _init_accounts coroutine started
2026-09-15 13:45:49,736 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 13:45:49,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:50:15,767 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 13:50:15,767 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 13:50:15,768 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 13:55:40,972 INFO core: Event loop thread started, running loop forever
2026-09-15 13:55:41,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 13:55:41,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:00:11,750 INFO core: _init_accounts coroutine started
2026-09-15 14:00:11,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:00:11,791 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:05:05,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:10:43,985 INFO core: Event loop thread started, running loop forever
2026-09-15 14:10:44,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 14:10:44,293 INFO core: _init_accounts coroutine started
2026-09-15 14:10:44,294 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:10:44,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:15:04,308 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 14:15:17,130 INFO core: Event loop thread started, running loop forever
2026-09-15 14:15:17,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 14:15:17,437 INFO core: _init_accounts coroutine started
2026-09-15 14:15:17,438 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:15:17,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:20:24,421 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-15 14:20:31,173 INFO core: Event loop thread started, running loop forever
2026-09-15 14:20:31,474 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 14:20:31,484 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:20:31,487 INFO core: _init_accounts coroutine started
2026-09-15 14:25:38,365 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:25:38,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 14:25:44,696 INFO core: Event loop thread started, running loop forever
2026-09-15 14:25:44,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 14:25:45,002 INFO core: _init_accounts coroutine started
2026-09-15 14:25:45,003 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:25:45,010 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:30:28,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:35:33,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:40:40,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 14:40:40,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 14:40:40,403 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-15 14:40:40,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 14:40:40,404 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 14:40:40,404 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 14:40:40,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 14:40:40,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 14:40:40,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 14:40:51,949 INFO core: Event loop thread started, running loop forever
2026-09-15 14:40:52,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 14:40:52,254 INFO core: _init_accounts coroutine started
2026-09-15 14:40:52,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:40:52,268 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:45:13,779 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 14:45:13,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:50:29,838 INFO core: Event loop thread started, running loop forever
2026-09-15 14:50:30,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 14:50:30,144 INFO core: _init_accounts coroutine started
2026-09-15 14:50:30,146 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:50:30,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 14:55:36,402 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 14:55:40,192 INFO core: Event loop thread started, running loop forever
2026-09-15 14:55:40,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 14:55:40,498 INFO core: _init_accounts coroutine started
2026-09-15 14:55:40,499 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 14:55:40,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:00:38,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:00:38,231 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 15:00:38,231 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 15:05:37,654 INFO core: Event loop thread started, running loop forever
2026-09-15 15:05:37,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 15:05:37,963 INFO core: _init_accounts coroutine started
2026-09-15 15:05:37,963 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 15:05:37,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:05:44,676 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 15:10:23,005 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:15:49,246 INFO core: Event loop thread started, running loop forever
2026-09-15 15:15:49,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 15:15:49,550 INFO core: _init_accounts coroutine started
2026-09-15 15:15:49,551 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 15:15:49,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:20:23,613 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 15:20:23,616 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 15:20:23,619 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 15:20:23,621 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 15:20:23,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:25:33,313 INFO core: Event loop thread started, running loop forever
2026-09-15 15:25:33,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 15:25:33,617 INFO core: _init_accounts coroutine started
2026-09-15 15:25:33,618 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 15:25:33,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:30:40,385 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 15:30:48,790 INFO core: Event loop thread started, running loop forever
2026-09-15 15:30:49,091 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 15:30:49,095 INFO core: _init_accounts coroutine started
2026-09-15 15:30:49,096 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 15:30:49,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:35:08,320 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 15:35:08,331 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:40:46,514 INFO core: Event loop thread started, running loop forever
2026-09-15 15:40:46,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 15:40:46,819 INFO core: _init_accounts coroutine started
2026-09-15 15:40:46,821 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 15:40:46,830 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 15:40:46,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:40:46,831 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 15:45:06,079 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 15:45:06,086 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 15:45:06,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:50:13,418 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 15:50:36,328 INFO core: Event loop thread started, running loop forever
2026-09-15 15:50:36,629 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 15:50:36,633 INFO core: _init_accounts coroutine started
2026-09-15 15:50:36,635 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 15:50:36,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:55:40,964 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 15:55:40,964 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 15:55:40,965 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 16:00:36,368 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 16:00:36,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:00:36,369 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 16:05:07,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:10:49,538 INFO core: Event loop thread started, running loop forever
2026-09-15 16:10:49,840 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 16:10:49,846 INFO core: _init_accounts coroutine started
2026-09-15 16:10:49,846 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 16:10:49,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:15:18,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:20:24,358 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 16:20:41,090 INFO core: Event loop thread started, running loop forever
2026-09-15 16:20:41,391 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 16:20:41,394 INFO core: _init_accounts coroutine started
2026-09-15 16:20:41,395 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 16:20:41,400 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:25:39,822 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 16:25:39,822 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 16:25:39,825 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 16:25:39,827 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 16:25:39,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:30:03,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 16:30:03,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 16:30:03,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 16:30:14,620 INFO core: Event loop thread started, running loop forever
2026-09-15 16:30:14,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 16:30:14,926 INFO core: _init_accounts coroutine started
2026-09-15 16:30:14,930 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 16:30:14,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:35:20,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 16:35:41,438 INFO core: Event loop thread started, running loop forever
2026-09-15 16:35:41,739 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 16:35:41,743 INFO core: _init_accounts coroutine started
2026-09-15 16:35:41,745 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 16:35:41,750 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:40:11,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:45:18,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 16:45:51,215 INFO core: Event loop thread started, running loop forever
2026-09-15 16:45:51,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 16:45:51,520 INFO core: _init_accounts coroutine started
2026-09-15 16:45:51,521 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 16:45:51,527 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:50:12,778 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 16:50:12,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 16:55:50,762 INFO core: Event loop thread started, running loop forever
2026-09-15 16:55:51,064 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 16:55:51,068 INFO core: _init_accounts coroutine started
2026-09-15 16:55:51,069 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 16:55:51,076 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:00:10,229 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 17:00:10,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:05:43,648 INFO core: Event loop thread started, running loop forever
2026-09-15 17:05:43,949 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 17:05:43,957 INFO core: _init_accounts coroutine started
2026-09-15 17:05:43,958 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 17:05:43,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:10:40,214 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 17:10:40,228 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:15:37,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:20:15,304 INFO core: Event loop thread started, running loop forever
2026-09-15 17:20:15,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 17:20:15,608 INFO core: _init_accounts coroutine started
2026-09-15 17:20:15,610 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 17:20:15,615 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:25:06,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:30:13,431 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 17:30:27,075 INFO core: Event loop thread started, running loop forever
2026-09-15 17:30:27,376 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 17:30:27,381 INFO core: _init_accounts coroutine started
2026-09-15 17:30:27,382 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 17:30:27,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:35:26,721 INFO core: Event loop thread started, running loop forever
2026-09-15 17:35:27,022 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 17:35:27,032 INFO core: _init_accounts coroutine started
2026-09-15 17:35:27,033 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 17:35:27,037 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:40:34,334 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 17:40:39,240 INFO core: Event loop thread started, running loop forever
2026-09-15 17:40:39,540 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 17:40:39,547 INFO core: _init_accounts coroutine started
2026-09-15 17:40:39,547 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 17:40:39,553 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:45:23,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:50:19,920 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 17:50:19,922 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 17:50:19,924 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 17:55:25,376 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 17:55:43,310 INFO core: Event loop thread started, running loop forever
2026-09-15 17:55:43,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 17:55:43,614 INFO core: _init_accounts coroutine started
2026-09-15 17:55:43,616 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 17:55:43,621 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:00:12,284 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 18:00:12,284 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 18:00:12,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 18:00:12,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:05:08,475 INFO core: Event loop thread started, running loop forever
2026-09-15 18:05:08,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 18:05:08,779 INFO core: _init_accounts coroutine started
2026-09-15 18:05:08,781 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 18:05:08,786 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:10:48,235 INFO core: Event loop thread started, running loop forever
2026-09-15 18:10:48,536 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 18:10:48,540 INFO core: _init_accounts coroutine started
2026-09-15 18:10:48,541 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 18:10:48,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:15:49,015 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:20:26,060 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 18:20:26,060 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 18:20:26,064 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 18:20:26,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:25:32,867 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 18:25:32,867 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 18:25:32,868 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 18:25:32,872 INFO core: Event loop thread started, running loop forever
2026-09-15 18:25:32,869 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 18:25:33,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 18:25:33,178 INFO core: _init_accounts coroutine started
2026-09-15 18:25:33,179 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 18:25:33,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:25:33,189 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-15 18:30:22,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:35:40,577 INFO core: Event loop thread started, running loop forever
2026-09-15 18:35:40,878 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 18:35:40,881 INFO core: _init_accounts coroutine started
2026-09-15 18:35:40,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 18:35:40,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:40:14,298 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 18:40:14,298 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 18:40:14,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:40:14,301 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 18:45:30,019 INFO core: Event loop thread started, running loop forever
2026-09-15 18:45:30,321 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 18:45:30,324 INFO core: _init_accounts coroutine started
2026-09-15 18:45:30,324 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 18:45:30,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:50:43,383 INFO core: Event loop thread started, running loop forever
2026-09-15 18:50:43,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 18:50:43,687 INFO core: _init_accounts coroutine started
2026-09-15 18:50:43,688 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 18:50:43,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 18:55:17,232 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 18:55:17,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:00:11,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:05:46,823 INFO core: Event loop thread started, running loop forever
2026-09-15 19:05:47,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 19:05:47,128 INFO core: _init_accounts coroutine started
2026-09-15 19:05:47,129 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 19:05:47,348 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 19:05:47,348 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 19:05:47,349 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 19:05:47,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:05:47,351 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 19:10:31,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:15:44,313 INFO core: Event loop thread started, running loop forever
2026-09-15 19:15:44,615 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 19:15:44,617 INFO core: _init_accounts coroutine started
2026-09-15 19:15:44,618 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 19:15:44,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:20:42,954 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:25:19,695 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 19:25:19,695 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 19:25:19,699 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 19:25:19,702 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 19:25:19,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:30:25,505 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 19:30:52,406 INFO core: Event loop thread started, running loop forever
2026-09-15 19:30:52,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 19:30:52,713 INFO core: _init_accounts coroutine started
2026-09-15 19:30:52,714 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 19:30:52,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:35:44,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:40:16,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:45:22,386 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 19:45:33,408 INFO core: Event loop thread started, running loop forever
2026-09-15 19:45:33,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 19:45:33,713 INFO core: _init_accounts coroutine started
2026-09-15 19:45:33,715 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 19:45:33,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:50:53,505 INFO core: Event loop thread started, running loop forever
2026-09-15 19:50:53,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 19:50:53,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 19:55:20,687 INFO core: _init_accounts coroutine started
2026-09-15 19:55:20,687 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 19:55:20,693 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:00:26,928 INFO core: Event loop thread started, running loop forever
2026-09-15 20:00:27,229 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 20:00:27,234 INFO core: _init_accounts coroutine started
2026-09-15 20:00:27,234 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 20:00:27,240 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:05:10,485 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 20:05:10,486 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 20:05:10,487 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:05:10,487 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 20:10:33,855 INFO core: Event loop thread started, running loop forever
2026-09-15 20:10:34,157 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 20:10:34,162 INFO core: _init_accounts coroutine started
2026-09-15 20:10:34,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 20:10:34,171 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 20:10:34,172 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 20:10:34,173 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 20:10:34,174 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 20:10:34,184 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 20:10:34,184 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 20:10:34,189 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-15 20:10:34,190 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-15 20:10:34,190 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:15:40,033 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 20:15:40,033 WARNING core: Account 2: connect timed out after 35s
2026-09-15 20:15:40,034 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-15 20:15:40,034 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-15 20:15:40,035 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-15 20:15:40,036 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-15 20:15:40,036 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-15 20:15:40,048 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:20:03,538 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 20:20:03,541 WARNING core: Account 2: connect timed out after 35s
2026-09-15 20:20:03,542 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-15 20:20:03,542 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-15 20:20:03,544 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-15 20:20:03,546 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-15 20:20:03,547 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-15 20:20:03,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:25:09,440 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-15 20:25:09,440 WARNING core: Account 2: connect timed out after 35s
2026-09-15 20:25:09,440 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-15 20:25:09,440 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-15 20:25:09,441 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-15 20:25:09,441 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-15 20:25:09,443 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-15 20:25:20,843 INFO core: Event loop thread started, running loop forever
2026-09-15 20:25:21,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 20:25:21,149 INFO core: _init_accounts coroutine started
2026-09-15 20:25:21,150 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 20:25:21,156 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:30:11,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:35:21,053 INFO core: Event loop thread started, running loop forever
2026-09-15 20:35:21,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 20:35:21,362 INFO core: _init_accounts coroutine started
2026-09-15 20:35:21,362 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 20:35:21,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:40:28,374 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 20:40:32,584 INFO core: Event loop thread started, running loop forever
2026-09-15 20:40:32,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 20:40:32,888 INFO core: _init_accounts coroutine started
2026-09-15 20:40:32,888 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 20:40:32,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:45:39,418 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 20:45:42,285 INFO core: Event loop thread started, running loop forever
2026-09-15 20:45:42,587 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 20:45:42,593 INFO core: _init_accounts coroutine started
2026-09-15 20:45:42,594 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 20:45:42,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:50:09,845 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 20:50:09,846 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 20:50:09,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 20:50:09,850 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 20:55:15,397 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 20:55:46,686 INFO core: Event loop thread started, running loop forever
2026-09-15 20:55:46,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 20:55:46,990 INFO core: _init_accounts coroutine started
2026-09-15 20:55:46,992 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 20:55:47,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:00:02,341 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 21:00:44,377 INFO core: Event loop thread started, running loop forever
2026-09-15 21:00:44,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 21:00:44,682 INFO core: _init_accounts coroutine started
2026-09-15 21:00:44,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 21:00:44,697 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 21:00:44,697 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 21:00:44,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:05:05,939 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 21:05:05,947 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 21:05:05,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:10:11,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 21:10:50,898 INFO core: Event loop thread started, running loop forever
2026-09-15 21:10:51,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 21:10:51,202 INFO core: _init_accounts coroutine started
2026-09-15 21:10:51,204 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 21:10:51,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:15:23,015 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 21:15:23,015 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 21:15:23,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:20:29,385 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 21:20:29,386 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 21:20:29,387 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 21:20:29,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 21:20:29,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 21:20:29,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 21:20:29,393 INFO core: Event loop thread started, running loop forever
2026-09-15 21:20:29,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 21:20:29,698 INFO core: _init_accounts coroutine started
2026-09-15 21:20:29,700 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 21:20:29,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:25:36,395 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-09-15 21:25:39,229 INFO core: Event loop thread started, running loop forever
2026-09-15 21:25:39,535 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 21:25:39,538 INFO core: _init_accounts coroutine started
2026-09-15 21:25:39,540 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 21:25:39,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:30:36,633 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:35:18,978 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 21:35:18,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 21:35:18,992 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:40:39,669 INFO core: Event loop thread started, running loop forever
2026-09-15 21:40:39,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 21:40:39,974 INFO core: _init_accounts coroutine started
2026-09-15 21:40:39,976 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 21:40:39,985 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 21:40:39,985 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 21:40:39,986 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 21:40:39,988 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 21:40:39,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:45:07,656 INFO core: Event loop thread started, running loop forever
2026-09-15 21:45:07,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 21:45:07,961 INFO core: _init_accounts coroutine started
2026-09-15 21:45:07,962 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 21:45:07,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 21:50:10,814 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-15 21:50:10,822 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-15 21:55:30,816 INFO core: Event loop thread started, running loop forever
2026-09-15 21:55:31,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 21:55:31,121 INFO core: _init_accounts coroutine started
2026-09-15 21:55:31,122 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 21:55:31,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:00:37,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 22:00:37,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 22:00:37,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 22:00:37,441 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 22:00:37,442 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 22:00:37,442 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 22:00:37,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 22:00:37,442 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 22:00:39,848 INFO core: Event loop thread started, running loop forever
2026-09-15 22:00:40,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 22:00:40,156 INFO core: _init_accounts coroutine started
2026-09-15 22:00:40,156 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 22:00:40,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:05:48,397 INFO core: Event loop thread started, running loop forever
2026-09-15 22:05:48,699 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 22:05:48,707 INFO core: _init_accounts coroutine started
2026-09-15 22:05:48,707 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 22:05:48,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:10:39,269 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-15 22:10:39,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:15:05,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:20:10,634 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-15 22:20:10,636 INFO core: _init_accounts coroutine started
2026-09-15 22:20:10,636 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 22:20:10,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:20:10,641 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 22:20:10,642 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 22:25:06,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:30:06,545 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 22:30:06,556 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 22:30:06,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:35:39,081 INFO core: Event loop thread started, running loop forever
2026-09-15 22:35:39,382 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 22:35:39,385 INFO core: _init_accounts coroutine started
2026-09-15 22:35:39,386 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 22:35:39,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:40:29,771 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:45:52,862 INFO core: Event loop thread started, running loop forever
2026-09-15 22:45:53,162 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 22:45:53,166 INFO core: _init_accounts coroutine started
2026-09-15 22:45:53,168 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 22:45:53,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:50:30,061 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 22:50:30,061 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 22:50:30,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:55:03,623 INFO core: Event loop thread started, running loop forever
2026-09-15 22:55:03,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 22:55:03,928 INFO core: _init_accounts coroutine started
2026-09-15 22:55:03,928 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 22:55:03,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 22:55:36,659 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 22:55:36,659 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 22:55:36,660 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 22:55:36,660 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 22:55:36,660 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 22:55:36,661 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 23:00:09,976 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 23:00:09,981 INFO core: Event loop thread started, running loop forever
2026-09-15 23:00:10,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 23:00:10,285 INFO core: _init_accounts coroutine started
2026-09-15 23:00:10,286 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 23:00:10,293 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-15 23:00:10,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:05:41,956 INFO core: Event loop thread started, running loop forever
2026-09-15 23:05:42,257 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 23:05:42,263 INFO core: _init_accounts coroutine started
2026-09-15 23:05:42,263 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 23:05:42,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:10:34,163 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 23:10:34,163 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 23:10:34,174 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 23:10:34,178 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:10:34,179 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 23:15:07,148 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:20:14,413 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-15 23:20:51,362 INFO core: Event loop thread started, running loop forever
2026-09-15 23:20:51,662 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 23:20:51,666 INFO core: _init_accounts coroutine started
2026-09-15 23:20:51,666 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 23:20:51,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:25:14,662 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 23:25:14,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:25:14,663 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 23:30:05,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 23:30:05,363 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-15 23:30:05,364 INFO core: _init_accounts_inner: reloading LLM config
2026-09-15 23:30:05,364 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-15 23:30:05,364 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-15 23:30:05,364 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-15 23:30:52,933 INFO core: Event loop thread started, running loop forever
2026-09-15 23:30:53,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 23:30:53,238 INFO core: _init_accounts coroutine started
2026-09-15 23:30:53,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 23:30:53,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:35:44,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:40:43,807 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 23:40:43,807 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 23:40:43,809 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 23:40:43,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:45:52,339 INFO core: Event loop thread started, running loop forever
2026-09-15 23:45:52,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-15 23:45:52,644 INFO core: _init_accounts coroutine started
2026-09-15 23:45:52,646 INFO core: _init_accounts_inner: starting DB migrations
2026-09-15 23:45:52,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:50:52,022 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-15 23:50:52,023 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-15 23:50:52,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:55:08,700 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-15 23:55:08,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-15 23:55:08,704 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 00:00:30,616 INFO core: Event loop thread started, running loop forever
2026-09-16 00:00:30,917 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 00:00:30,920 INFO core: _init_accounts coroutine started
2026-09-16 00:00:30,923 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 00:00:30,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:05:12,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:05:12,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 00:05:12,397 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 00:10:11,181 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 00:10:11,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:15:09,624 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 00:15:09,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:20:05,134 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:25:12,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 00:25:12,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 00:25:30,235 INFO core: Event loop thread started, running loop forever
2026-09-16 00:25:30,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 00:25:30,540 INFO core: _init_accounts coroutine started
2026-09-16 00:25:30,543 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 00:25:30,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:30:37,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 00:30:45,580 INFO core: Event loop thread started, running loop forever
2026-09-16 00:30:45,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 00:30:45,887 INFO core: _init_accounts coroutine started
2026-09-16 00:30:45,888 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 00:30:45,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:35:13,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:40:26,627 INFO core: Event loop thread started, running loop forever
2026-09-16 00:40:26,928 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 00:40:26,932 INFO core: _init_accounts coroutine started
2026-09-16 00:40:26,933 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 00:40:26,939 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:45:32,404 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 00:45:32,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 00:45:32,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 00:45:32,409 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 00:45:37,715 INFO core: Event loop thread started, running loop forever
2026-09-16 00:45:38,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 00:45:38,019 INFO core: _init_accounts coroutine started
2026-09-16 00:45:38,021 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 00:45:38,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:50:15,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 00:50:15,746 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 00:50:15,746 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 00:55:21,326 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 00:55:37,715 INFO core: Event loop thread started, running loop forever
2026-09-16 00:55:38,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 00:55:38,021 INFO core: _init_accounts coroutine started
2026-09-16 00:55:38,022 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 00:55:38,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:00:44,368 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 01:00:49,207 INFO core: Event loop thread started, running loop forever
2026-09-16 01:00:49,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 01:00:49,511 INFO core: _init_accounts coroutine started
2026-09-16 01:00:49,513 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 01:00:49,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:05:34,716 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 01:05:34,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:10:27,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:15:46,996 INFO core: Event loop thread started, running loop forever
2026-09-16 01:15:47,298 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 01:15:47,301 INFO core: _init_accounts coroutine started
2026-09-16 01:15:47,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 01:15:47,308 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:20:24,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:25:30,520 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 01:25:30,521 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 01:25:30,521 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:30:15,993 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 01:30:15,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:35:15,646 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 01:35:15,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:40:21,468 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 01:40:27,462 INFO core: Event loop thread started, running loop forever
2026-09-16 01:40:27,763 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 01:40:27,766 INFO core: _init_accounts coroutine started
2026-09-16 01:40:27,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 01:40:27,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:45:02,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 01:45:11,575 INFO core: Event loop thread started, running loop forever
2026-09-16 01:45:11,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 01:45:11,884 INFO core: _init_accounts coroutine started
2026-09-16 01:45:11,884 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 01:45:11,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:50:18,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 01:50:34,091 INFO core: Event loop thread started, running loop forever
2026-09-16 01:50:34,392 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 01:50:34,395 INFO core: _init_accounts coroutine started
2026-09-16 01:50:34,396 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 01:50:34,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 01:55:06,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:00:04,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:05:11,452 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 02:05:11,453 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 02:05:11,453 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-16 02:05:11,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 02:05:11,454 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 02:05:11,454 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 02:05:11,454 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 02:05:11,455 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 02:05:11,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 02:05:43,281 INFO core: Event loop thread started, running loop forever
2026-09-16 02:05:43,582 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 02:05:43,590 INFO core: _init_accounts coroutine started
2026-09-16 02:05:43,591 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 02:05:43,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:10:22,268 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 02:10:22,268 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 02:10:22,269 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:15:25,593 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:20:32,455 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 02:20:32,458 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 02:20:35,060 INFO core: Event loop thread started, running loop forever
2026-09-16 02:20:35,361 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 02:20:35,366 INFO core: _init_accounts coroutine started
2026-09-16 02:20:35,367 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 02:20:35,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:25:42,501 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 02:25:44,963 INFO core: Event loop thread started, running loop forever
2026-09-16 02:25:45,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 02:25:45,271 INFO core: _init_accounts coroutine started
2026-09-16 02:25:45,271 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 02:25:45,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:30:06,964 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:35:12,503 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 02:35:12,505 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 02:35:12,505 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-16 02:35:12,506 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 02:35:12,506 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 02:35:12,506 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 02:35:24,413 INFO core: Event loop thread started, running loop forever
2026-09-16 02:35:24,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 02:35:24,723 INFO core: _init_accounts coroutine started
2026-09-16 02:35:24,724 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 02:35:24,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:40:28,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:45:17,142 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 02:45:17,146 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 02:45:17,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:50:24,504 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 02:50:27,093 INFO core: Event loop thread started, running loop forever
2026-09-16 02:50:27,394 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 02:50:27,400 INFO core: _init_accounts coroutine started
2026-09-16 02:50:27,401 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 02:50:27,409 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 02:55:38,460 INFO core: Event loop thread started, running loop forever
2026-09-16 02:55:38,761 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 02:55:38,764 INFO core: _init_accounts coroutine started
2026-09-16 02:55:38,766 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 02:55:38,771 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:00:37,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:00:37,065 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 03:05:28,238 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 03:05:28,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:05:28,244 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 03:10:12,512 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 03:10:12,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:15:19,515 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 03:15:29,356 INFO core: Event loop thread started, running loop forever
2026-09-16 03:15:29,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 03:15:29,662 INFO core: _init_accounts coroutine started
2026-09-16 03:15:29,663 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 03:15:29,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:20:19,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 03:20:19,366 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 03:20:19,367 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 03:20:19,368 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 03:20:19,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:25:33,074 INFO core: Event loop thread started, running loop forever
2026-09-16 03:25:33,375 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 03:25:33,378 INFO core: _init_accounts coroutine started
2026-09-16 03:25:33,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 03:25:33,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:30:27,294 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 03:30:27,294 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 03:30:27,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 03:30:27,300 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 03:30:27,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:35:34,448 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 03:35:52,490 INFO core: Event loop thread started, running loop forever
2026-09-16 03:35:52,792 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 03:35:52,797 INFO core: _init_accounts coroutine started
2026-09-16 03:35:52,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 03:35:52,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:40:13,992 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 03:40:13,992 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 03:40:13,995 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 03:40:13,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:45:27,705 INFO core: Event loop thread started, running loop forever
2026-09-16 03:45:28,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 03:45:28,010 INFO core: _init_accounts coroutine started
2026-09-16 03:45:28,011 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 03:45:28,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:50:34,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 03:50:48,213 INFO core: Event loop thread started, running loop forever
2026-09-16 03:50:48,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 03:50:48,523 INFO core: _init_accounts coroutine started
2026-09-16 03:50:48,523 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 03:50:48,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 03:55:33,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:00:03,365 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 04:00:03,367 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 04:00:03,368 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-16 04:00:03,368 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 04:00:03,368 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 04:00:03,369 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 04:00:03,369 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 04:00:03,369 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 04:00:03,369 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 04:00:47,283 INFO core: Event loop thread started, running loop forever
2026-09-16 04:00:47,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 04:00:47,594 INFO core: _init_accounts coroutine started
2026-09-16 04:00:47,594 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 04:00:47,602 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:05:21,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:10:23,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 04:10:23,432 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 04:10:23,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:15:36,696 INFO core: Event loop thread started, running loop forever
2026-09-16 04:15:36,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 04:15:37,002 INFO core: _init_accounts coroutine started
2026-09-16 04:15:37,003 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 04:15:37,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:20:05,046 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 04:20:05,046 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 04:20:05,048 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:20:05,048 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 04:25:12,371 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 04:25:12,371 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 04:25:12,371 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 04:25:12,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 04:25:48,251 INFO core: Event loop thread started, running loop forever
2026-09-16 04:25:48,552 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 04:25:48,555 INFO core: _init_accounts coroutine started
2026-09-16 04:25:48,557 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 04:25:48,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:30:22,664 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 04:30:22,664 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 04:30:22,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:35:35,785 INFO core: Event loop thread started, running loop forever
2026-09-16 04:35:36,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 04:35:36,090 INFO core: _init_accounts coroutine started
2026-09-16 04:35:36,092 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 04:35:36,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:40:16,908 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 04:40:16,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:40:16,910 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 04:45:29,633 INFO core: Event loop thread started, running loop forever
2026-09-16 04:45:29,934 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 04:45:29,945 INFO core: _init_accounts coroutine started
2026-09-16 04:45:29,945 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 04:45:29,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:50:35,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 04:50:36,378 INFO core: Event loop thread started, running loop forever
2026-09-16 04:50:36,686 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 04:50:36,693 INFO core: _init_accounts coroutine started
2026-09-16 04:50:36,694 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 04:50:36,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 04:55:50,816 INFO core: Event loop thread started, running loop forever
2026-09-16 04:55:51,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 04:55:51,120 INFO core: _init_accounts coroutine started
2026-09-16 04:55:51,122 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 04:55:51,136 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 04:55:51,136 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 04:55:51,137 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 04:55:51,139 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 04:55:51,141 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:00:35,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:05:09,209 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 05:05:09,211 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 05:05:09,215 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 05:05:09,216 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 05:05:09,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:10:04,077 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 05:10:04,079 WARNING core: Account 2: connect timed out after 35s
2026-09-16 05:10:04,079 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-16 05:10:04,079 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-16 05:10:04,080 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-16 05:10:04,081 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-16 05:10:04,081 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-16 05:10:04,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:15:11,428 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 05:15:11,429 WARNING core: Account 2: connect timed out after 35s
2026-09-16 05:15:11,429 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-16 05:15:22,112 INFO core: Event loop thread started, running loop forever
2026-09-16 05:15:22,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 05:15:22,422 INFO core: _init_accounts coroutine started
2026-09-16 05:15:22,422 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 05:15:22,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:20:29,430 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 05:20:31,406 INFO core: Event loop thread started, running loop forever
2026-09-16 05:20:31,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 05:20:31,713 INFO core: _init_accounts coroutine started
2026-09-16 05:20:31,715 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 05:20:31,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:25:38,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 05:25:50,605 INFO core: Event loop thread started, running loop forever
2026-09-16 05:25:50,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 05:25:50,911 INFO core: _init_accounts coroutine started
2026-09-16 05:25:50,913 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 05:25:50,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:30:14,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:35:35,073 INFO core: Event loop thread started, running loop forever
2026-09-16 05:35:35,374 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 05:35:35,379 INFO core: _init_accounts coroutine started
2026-09-16 05:35:35,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 05:35:35,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:40:16,805 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 05:40:16,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:45:42,740 INFO core: Event loop thread started, running loop forever
2026-09-16 05:45:43,041 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 05:45:43,045 INFO core: _init_accounts coroutine started
2026-09-16 05:45:43,045 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 05:45:43,054 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:50:18,690 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 05:50:18,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 05:55:29,941 INFO core: Event loop thread started, running loop forever
2026-09-16 05:55:30,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 05:55:30,247 INFO core: _init_accounts coroutine started
2026-09-16 05:55:30,248 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 05:55:30,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:00:23,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:05:42,618 INFO core: Event loop thread started, running loop forever
2026-09-16 06:05:42,928 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 06:05:42,930 INFO core: _init_accounts coroutine started
2026-09-16 06:05:42,932 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 06:05:42,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:10:22,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:15:02,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 06:15:26,008 INFO core: Event loop thread started, running loop forever
2026-09-16 06:15:26,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 06:15:26,313 INFO core: _init_accounts coroutine started
2026-09-16 06:15:26,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 06:15:26,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:20:03,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:25:28,272 INFO core: Event loop thread started, running loop forever
2026-09-16 06:25:28,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 06:25:28,578 INFO core: _init_accounts coroutine started
2026-09-16 06:25:28,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 06:25:28,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:30:14,586 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 06:30:14,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:35:04,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:40:04,968 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-16 06:40:04,970 INFO core: _init_accounts coroutine started
2026-09-16 06:40:04,970 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 06:40:04,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:45:10,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 06:45:43,266 INFO core: Event loop thread started, running loop forever
2026-09-16 06:45:43,567 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 06:45:43,572 INFO core: _init_accounts coroutine started
2026-09-16 06:45:43,572 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 06:45:43,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:50:05,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 06:55:11,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 06:55:11,391 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 06:55:11,391 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-16 06:55:11,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 06:55:11,392 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 06:55:11,392 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 06:55:11,392 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 06:55:11,392 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 06:55:11,392 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 06:55:45,774 INFO core: Event loop thread started, running loop forever
2026-09-16 06:55:46,076 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 06:55:46,079 INFO core: _init_accounts coroutine started
2026-09-16 06:55:46,081 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 06:55:46,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:00:40,023 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 07:00:40,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:05:22,252 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:10:48,146 INFO core: Event loop thread started, running loop forever
2026-09-16 07:10:48,448 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 07:10:48,453 INFO core: _init_accounts coroutine started
2026-09-16 07:10:48,453 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 07:10:48,458 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:15:19,309 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 07:15:19,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:20:23,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:25:23,836 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-16 07:25:23,837 INFO core: _init_accounts coroutine started
2026-09-16 07:25:23,837 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 07:25:23,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:30:09,740 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 07:30:09,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:35:45,199 INFO core: Event loop thread started, running loop forever
2026-09-16 07:35:45,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 07:35:45,507 INFO core: _init_accounts coroutine started
2026-09-16 07:35:45,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 07:35:45,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:40:30,750 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 07:40:30,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:45:12,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:50:20,127 INFO core: Event loop thread started, running loop forever
2026-09-16 07:50:20,428 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 07:50:20,436 INFO core: _init_accounts coroutine started
2026-09-16 07:50:20,437 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 07:50:20,438 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 07:55:18,664 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 07:55:18,666 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 07:55:18,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:00:24,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 08:00:24,430 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 08:00:24,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 08:00:24,431 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 08:00:24,431 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 08:00:24,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 08:00:26,526 INFO core: Event loop thread started, running loop forever
2026-09-16 08:00:26,827 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 08:00:26,832 INFO core: _init_accounts coroutine started
2026-09-16 08:00:26,832 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 08:00:26,838 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:05:25,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:05:25,834 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 08:05:25,835 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 08:10:25,238 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 08:10:25,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:15:26,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:20:28,059 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 08:20:28,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:25:13,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:30:03,365 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 08:30:03,366 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 08:30:03,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 08:30:38,714 INFO core: Event loop thread started, running loop forever
2026-09-16 08:30:39,017 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 08:30:39,021 INFO core: _init_accounts coroutine started
2026-09-16 08:30:39,022 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 08:30:39,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:35:07,271 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 08:35:07,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:40:43,481 INFO core: Event loop thread started, running loop forever
2026-09-16 08:40:43,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 08:40:43,788 INFO core: _init_accounts coroutine started
2026-09-16 08:40:43,788 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 08:40:43,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:45:24,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 08:45:24,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 08:45:24,396 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 08:45:24,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 08:45:24,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:50:31,414 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 08:50:42,562 INFO core: Event loop thread started, running loop forever
2026-09-16 08:50:42,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 08:50:42,866 INFO core: _init_accounts coroutine started
2026-09-16 08:50:42,867 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 08:50:42,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 08:55:33,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:00:35,107 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 09:00:35,124 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:05:33,305 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:10:20,723 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-16 09:10:20,725 INFO core: _init_accounts coroutine started
2026-09-16 09:10:20,725 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 09:10:20,739 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 09:10:20,739 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 09:10:20,741 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 09:10:20,743 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 09:10:20,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:15:28,848 INFO core: Event loop thread started, running loop forever
2026-09-16 09:15:29,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 09:15:29,155 INFO core: _init_accounts coroutine started
2026-09-16 09:15:29,155 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 09:15:29,161 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:20:26,238 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:25:49,941 INFO core: Event loop thread started, running loop forever
2026-09-16 09:25:50,244 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 09:25:50,247 INFO core: _init_accounts coroutine started
2026-09-16 09:25:50,249 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 09:25:50,257 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:30:24,953 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:35:53,010 INFO core: Event loop thread started, running loop forever
2026-09-16 09:35:53,311 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 09:35:53,321 INFO core: _init_accounts coroutine started
2026-09-16 09:35:53,325 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 09:35:53,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:40:22,299 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 09:40:22,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:45:29,851 INFO core: Event loop thread started, running loop forever
2026-09-16 09:45:30,152 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 09:45:30,156 INFO core: _init_accounts coroutine started
2026-09-16 09:45:30,158 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 09:45:30,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:50:36,780 INFO core: Event loop thread started, running loop forever
2026-09-16 09:50:37,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 09:50:37,084 INFO core: _init_accounts coroutine started
2026-09-16 09:50:37,087 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 09:50:37,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 09:55:43,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 09:55:52,464 INFO core: Event loop thread started, running loop forever
2026-09-16 09:55:52,765 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 09:55:52,769 INFO core: _init_accounts coroutine started
2026-09-16 09:55:52,770 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 09:55:52,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:00:50,844 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 10:00:50,845 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 10:00:50,848 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:05:33,927 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 10:05:33,932 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 10:05:33,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:10:23,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:15:14,106 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 10:15:14,107 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 10:15:14,111 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:20:15,863 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 10:20:15,864 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 10:20:15,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:25:13,818 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 10:25:13,819 WARNING core: Account 2: connect timed out after 35s
2026-09-16 10:25:13,819 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-16 10:25:13,820 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-16 10:25:13,821 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-16 10:25:13,822 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-16 10:25:13,823 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-16 10:25:13,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:30:19,366 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 10:30:19,367 WARNING core: Account 2: connect timed out after 35s
2026-09-16 10:30:19,367 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-16 10:30:19,367 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-16 10:30:19,368 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-16 10:30:19,369 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-16 10:30:19,369 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-16 10:30:47,975 INFO core: Event loop thread started, running loop forever
2026-09-16 10:30:48,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 10:30:48,283 INFO core: _init_accounts coroutine started
2026-09-16 10:30:48,284 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 10:30:48,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:35:30,445 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 10:35:30,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:35:30,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 10:40:39,575 INFO core: Event loop thread started, running loop forever
2026-09-16 10:40:39,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 10:40:39,880 INFO core: _init_accounts coroutine started
2026-09-16 10:40:39,882 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 10:40:39,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:45:47,384 INFO core: Event loop thread started, running loop forever
2026-09-16 10:45:47,685 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 10:45:47,688 INFO core: _init_accounts coroutine started
2026-09-16 10:45:47,690 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 10:45:47,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:50:11,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 10:55:06,805 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 10:55:06,805 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 10:55:06,809 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 10:55:06,810 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:00:29,855 INFO core: Event loop thread started, running loop forever
2026-09-16 11:00:30,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 11:00:30,170 INFO core: _init_accounts coroutine started
2026-09-16 11:00:30,170 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 11:00:30,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:05:36,398 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 11:05:52,501 INFO core: Event loop thread started, running loop forever
2026-09-16 11:05:52,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 11:05:52,805 INFO core: _init_accounts coroutine started
2026-09-16 11:05:52,806 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 11:05:52,814 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:10:03,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:10:03,838 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 11:10:03,840 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 11:10:03,844 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 11:10:03,846 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 11:15:46,578 INFO core: Event loop thread started, running loop forever
2026-09-16 11:15:46,882 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 11:15:46,888 INFO core: _init_accounts coroutine started
2026-09-16 11:15:46,888 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 11:15:46,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:20:26,309 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 11:20:26,309 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 11:20:26,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:25:32,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 11:25:32,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 11:25:51,033 INFO core: Event loop thread started, running loop forever
2026-09-16 11:25:51,335 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 11:25:51,338 INFO core: _init_accounts coroutine started
2026-09-16 11:25:51,341 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 11:25:51,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:30:12,211 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 11:30:12,212 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 11:30:12,214 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 11:30:12,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:35:19,382 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 11:35:19,382 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 11:35:19,382 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 11:35:19,383 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 11:35:45,254 INFO core: Event loop thread started, running loop forever
2026-09-16 11:35:45,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 11:35:45,559 INFO core: _init_accounts coroutine started
2026-09-16 11:35:45,560 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 11:35:45,579 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 11:35:45,579 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 11:35:45,580 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 11:35:45,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:40:15,204 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 11:40:15,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:45:22,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 11:45:46,372 INFO core: Event loop thread started, running loop forever
2026-09-16 11:45:46,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 11:45:46,678 INFO core: _init_accounts coroutine started
2026-09-16 11:45:46,678 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 11:45:46,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:50:51,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:55:03,196 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 11:55:03,197 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 11:55:03,198 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 12:00:09,185 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 12:00:09,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:05:16,422 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 12:05:31,934 INFO core: Event loop thread started, running loop forever
2026-09-16 12:05:32,236 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 12:05:32,239 INFO core: _init_accounts coroutine started
2026-09-16 12:05:32,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 12:05:32,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:10:07,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:15:45,934 INFO core: Event loop thread started, running loop forever
2026-09-16 12:15:46,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 12:15:46,239 INFO core: _init_accounts coroutine started
2026-09-16 12:15:46,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 12:15:46,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:20:47,764 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 12:20:47,764 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 12:20:47,765 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:25:45,770 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 12:25:45,774 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 12:25:45,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:30:18,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:35:31,701 INFO core: Event loop thread started, running loop forever
2026-09-16 12:35:32,002 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 12:35:32,006 INFO core: _init_accounts coroutine started
2026-09-16 12:35:32,007 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 12:35:32,032 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 12:35:32,033 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:35:32,033 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 12:40:35,108 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 12:40:35,122 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 12:40:35,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:45:42,387 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 12:45:42,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 12:45:42,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 12:45:43,716 INFO core: Event loop thread started, running loop forever
2026-09-16 12:45:44,017 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 12:45:44,031 INFO core: _init_accounts coroutine started
2026-09-16 12:45:44,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:45:44,039 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 12:50:34,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 12:55:13,945 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 12:55:13,945 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 12:55:13,948 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 12:55:13,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:00:29,962 INFO core: Event loop thread started, running loop forever
2026-09-16 13:00:30,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 13:00:30,266 INFO core: _init_accounts coroutine started
2026-09-16 13:00:30,268 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 13:00:30,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:05:35,745 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 13:05:35,745 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 13:05:35,751 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 13:05:35,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:10:41,356 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 13:10:41,356 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 13:10:49,195 INFO core: Event loop thread started, running loop forever
2026-09-16 13:10:49,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 13:10:49,501 INFO core: _init_accounts coroutine started
2026-09-16 13:10:49,503 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 13:10:49,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:15:44,489 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 13:15:44,489 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:15:44,490 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 13:20:28,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 13:20:28,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:25:43,203 INFO core: Event loop thread started, running loop forever
2026-09-16 13:25:43,504 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 13:25:43,510 INFO core: _init_accounts coroutine started
2026-09-16 13:25:43,510 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 13:25:43,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:30:28,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:35:12,564 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 13:35:12,565 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 13:35:12,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:35:12,569 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 13:40:15,187 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 13:40:15,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:45:35,869 INFO core: Event loop thread started, running loop forever
2026-09-16 13:45:36,170 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 13:45:36,173 INFO core: _init_accounts coroutine started
2026-09-16 13:45:36,175 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 13:45:36,180 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:50:10,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 13:55:09,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:00:14,700 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 14:00:14,701 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 14:00:14,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:05:51,950 INFO core: Event loop thread started, running loop forever
2026-09-16 14:05:52,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 14:05:52,255 INFO core: _init_accounts coroutine started
2026-09-16 14:05:52,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 14:05:52,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:10:08,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:15:15,446 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 14:15:33,993 INFO core: Event loop thread started, running loop forever
2026-09-16 14:15:34,296 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 14:15:34,301 INFO core: _init_accounts coroutine started
2026-09-16 14:15:34,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 14:15:34,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:20:03,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:20:03,520 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 14:25:05,806 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 14:25:05,810 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:30:28,624 INFO core: Event loop thread started, running loop forever
2026-09-16 14:30:28,926 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 14:30:28,929 INFO core: _init_accounts coroutine started
2026-09-16 14:30:28,931 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 14:30:28,939 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:35:15,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:40:21,498 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 14:40:32,563 INFO core: Event loop thread started, running loop forever
2026-09-16 14:40:32,864 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 14:40:32,867 INFO core: _init_accounts coroutine started
2026-09-16 14:40:32,869 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 14:40:32,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:45:19,755 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 14:45:19,755 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 14:45:19,756 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 14:45:19,757 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 14:45:19,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:50:37,639 INFO core: Event loop thread started, running loop forever
2026-09-16 14:50:37,940 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 14:50:37,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:50:37,952 INFO core: _init_accounts coroutine started
2026-09-16 14:55:41,372 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 14:55:41,384 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 14:55:41,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 14:55:41,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 14:55:41,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 14:55:41,389 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 15:00:35,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:05:12,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:05:12,637 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 15:05:12,637 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 15:10:17,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:10:17,341 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 15:15:24,401 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 15:15:43,743 INFO core: Event loop thread started, running loop forever
2026-09-16 15:15:44,045 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 15:15:44,049 INFO core: _init_accounts coroutine started
2026-09-16 15:15:44,050 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 15:15:44,061 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:20:23,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:25:07,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:30:14,344 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 15:30:14,345 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 15:30:14,352 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 15:30:14,352 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 15:30:14,353 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 15:30:14,353 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 15:30:14,354 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 15:30:14,354 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 15:30:36,348 INFO core: Event loop thread started, running loop forever
2026-09-16 15:30:36,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 15:30:36,652 INFO core: _init_accounts coroutine started
2026-09-16 15:30:36,652 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 15:30:36,663 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:35:37,060 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 15:35:37,060 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 15:35:37,063 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 15:35:37,067 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:40:05,041 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 15:40:05,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:45:12,381 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 15:45:39,457 INFO core: Event loop thread started, running loop forever
2026-09-16 15:45:39,758 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 15:45:39,762 INFO core: _init_accounts coroutine started
2026-09-16 15:45:39,763 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 15:45:39,769 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:50:48,523 INFO core: Event loop thread started, running loop forever
2026-09-16 15:50:48,824 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 15:50:48,829 INFO core: _init_accounts coroutine started
2026-09-16 15:50:48,830 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 15:50:48,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:55:45,506 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 15:55:45,506 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 15:55:45,507 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 16:00:08,965 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 16:00:08,967 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 16:00:08,979 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:05:14,393 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 16:05:21,990 INFO core: Event loop thread started, running loop forever
2026-09-16 16:05:22,293 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 16:05:22,297 INFO core: _init_accounts coroutine started
2026-09-16 16:05:22,298 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 16:05:22,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:10:27,158 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 16:10:27,158 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 16:10:27,160 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 16:10:27,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:15:21,182 INFO core: Event loop thread started, running loop forever
2026-09-16 16:15:21,483 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 16:15:21,486 INFO core: _init_accounts coroutine started
2026-09-16 16:15:21,488 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 16:15:21,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:20:08,736 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 16:20:08,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:25:32,867 INFO core: Event loop thread started, running loop forever
2026-09-16 16:25:33,168 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 16:25:33,174 INFO core: _init_accounts coroutine started
2026-09-16 16:25:33,174 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 16:25:33,180 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:30:54,183 INFO core: Event loop thread started, running loop forever
2026-09-16 16:30:54,484 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 16:30:54,489 INFO core: _init_accounts coroutine started
2026-09-16 16:30:54,490 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 16:30:54,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:35:49,763 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 16:35:49,764 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 16:35:49,765 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:35:49,766 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 16:40:47,093 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 16:40:47,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:45:13,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:50:20,355 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 16:50:28,757 INFO core: Event loop thread started, running loop forever
2026-09-16 16:50:29,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 16:50:29,064 INFO core: _init_accounts coroutine started
2026-09-16 16:50:29,064 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 16:50:29,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 16:55:13,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:00:20,390 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 17:00:52,613 INFO core: Event loop thread started, running loop forever
2026-09-16 17:00:52,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 17:00:52,919 INFO core: _init_accounts coroutine started
2026-09-16 17:00:52,919 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 17:00:52,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:05:36,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:10:19,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:10:19,882 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 17:10:19,882 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 17:15:05,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 17:15:05,393 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-16 17:15:05,393 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 17:15:05,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 17:15:05,394 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 17:15:05,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 17:15:11,008 INFO core: Event loop thread started, running loop forever
2026-09-16 17:15:11,315 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 17:15:11,321 INFO core: _init_accounts coroutine started
2026-09-16 17:15:11,321 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 17:15:11,337 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:20:17,430 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 17:20:17,430 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 17:20:17,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 17:20:17,434 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 17:20:17,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 17:20:17,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 17:20:17,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 17:20:45,196 INFO core: Event loop thread started, running loop forever
2026-09-16 17:20:45,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 17:20:45,500 INFO core: _init_accounts coroutine started
2026-09-16 17:20:45,502 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 17:20:45,506 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:25:18,531 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 17:25:18,531 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 17:25:18,538 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 17:25:18,541 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 17:25:18,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:30:48,168 INFO core: Event loop thread started, running loop forever
2026-09-16 17:30:48,470 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 17:30:48,478 INFO core: _init_accounts coroutine started
2026-09-16 17:30:48,479 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 17:30:48,480 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:35:20,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:40:26,645 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 17:40:26,645 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 17:40:26,649 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 17:40:26,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:40:26,651 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 17:45:07,043 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:50:14,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 17:50:22,291 INFO core: Event loop thread started, running loop forever
2026-09-16 17:50:22,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 17:50:22,598 INFO core: _init_accounts coroutine started
2026-09-16 17:50:22,599 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 17:50:22,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 17:55:37,850 INFO core: Event loop thread started, running loop forever
2026-09-16 17:55:38,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 17:55:38,154 INFO core: _init_accounts coroutine started
2026-09-16 17:55:38,155 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 17:55:38,161 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:00:25,797 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 18:00:25,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:05:40,608 INFO core: Event loop thread started, running loop forever
2026-09-16 18:05:40,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 18:05:40,914 INFO core: _init_accounts coroutine started
2026-09-16 18:05:40,915 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 18:05:40,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:10:23,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:15:40,659 INFO core: Event loop thread started, running loop forever
2026-09-16 18:15:40,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 18:15:40,965 INFO core: _init_accounts coroutine started
2026-09-16 18:15:40,966 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 18:15:40,977 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:20:49,592 INFO core: Event loop thread started, running loop forever
2026-09-16 18:20:49,893 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 18:20:49,899 INFO core: _init_accounts coroutine started
2026-09-16 18:20:49,899 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 18:20:49,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:25:27,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:30:07,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:35:14,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 18:35:24,790 INFO core: Event loop thread started, running loop forever
2026-09-16 18:35:25,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 18:35:25,102 INFO core: _init_accounts coroutine started
2026-09-16 18:35:25,102 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 18:35:25,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:40:24,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:45:26,283 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 18:45:26,284 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 18:45:26,287 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 18:45:26,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:50:33,376 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 18:50:33,379 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-16 18:50:38,544 INFO core: Event loop thread started, running loop forever
2026-09-16 18:50:38,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 18:50:38,848 INFO core: _init_accounts coroutine started
2026-09-16 18:50:38,850 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 18:50:38,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 18:55:46,724 INFO core: Event loop thread started, running loop forever
2026-09-16 18:55:47,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 18:55:47,034 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:00:21,341 INFO core: _init_accounts coroutine started
2026-09-16 19:00:21,341 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 19:00:21,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:05:28,379 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 19:05:33,307 INFO core: Event loop thread started, running loop forever
2026-09-16 19:05:33,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 19:05:33,613 INFO core: _init_accounts coroutine started
2026-09-16 19:05:33,617 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 19:05:33,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:10:35,935 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 19:10:35,935 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 19:10:35,936 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 19:10:35,937 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 19:10:35,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:15:08,907 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:20:13,660 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 19:20:13,661 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 19:20:13,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:25:17,816 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 19:25:17,817 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 19:25:17,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:30:04,368 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 19:30:04,368 WARNING core: Account 2: connect timed out after 35s
2026-09-16 19:30:04,369 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-16 19:30:04,369 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-16 19:30:04,370 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-16 19:30:04,371 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-16 19:30:04,371 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-16 19:30:43,150 INFO core: Event loop thread started, running loop forever
2026-09-16 19:30:43,451 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 19:30:43,455 INFO core: _init_accounts coroutine started
2026-09-16 19:30:43,456 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 19:30:43,460 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:35:26,896 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 19:35:26,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:40:45,832 INFO core: Event loop thread started, running loop forever
2026-09-16 19:40:46,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 19:40:46,137 INFO core: _init_accounts coroutine started
2026-09-16 19:40:46,137 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 19:40:46,144 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 19:40:46,144 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 19:40:46,145 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 19:40:46,145 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 19:40:46,153 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 19:40:46,153 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 19:40:46,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:40:46,158 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 19:40:46,159 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 19:45:07,198 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 19:45:07,199 WARNING core: Account 2: connect timed out after 35s
2026-09-16 19:45:07,200 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-16 19:45:07,200 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-16 19:45:07,201 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-16 19:45:07,202 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-16 19:45:07,202 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-16 19:45:07,204 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:50:14,446 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 19:50:14,447 WARNING core: Account 2: connect timed out after 35s
2026-09-16 19:50:14,448 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-16 19:50:14,448 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-16 19:50:14,449 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-16 19:50:14,451 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-16 19:50:47,860 INFO core: Event loop thread started, running loop forever
2026-09-16 19:50:48,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 19:50:48,165 INFO core: _init_accounts coroutine started
2026-09-16 19:50:48,167 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 19:50:48,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 19:55:28,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:00:35,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 20:00:52,341 INFO core: Event loop thread started, running loop forever
2026-09-16 20:00:52,642 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 20:00:52,646 INFO core: _init_accounts coroutine started
2026-09-16 20:00:52,649 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 20:00:52,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:05:27,860 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 20:05:27,860 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 20:05:27,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:05:27,862 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 20:10:13,821 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 20:10:13,825 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:15:42,513 INFO core: Event loop thread started, running loop forever
2026-09-16 20:15:42,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 20:15:42,817 INFO core: _init_accounts coroutine started
2026-09-16 20:15:42,818 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 20:15:42,826 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:20:24,893 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 20:20:24,894 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 20:20:24,898 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 20:20:24,899 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 20:20:24,899 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:25:10,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:30:11,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:35:07,126 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 20:35:07,127 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 20:35:07,131 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:40:13,213 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 20:40:13,215 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 20:40:13,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:45:20,352 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 20:45:26,742 INFO core: Event loop thread started, running loop forever
2026-09-16 20:45:27,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 20:45:27,048 INFO core: _init_accounts coroutine started
2026-09-16 20:45:27,049 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 20:45:27,054 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:50:14,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 20:55:50,251 INFO core: Event loop thread started, running loop forever
2026-09-16 20:55:50,552 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 20:55:50,555 INFO core: _init_accounts coroutine started
2026-09-16 20:55:50,557 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 20:55:50,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:00:38,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:05:44,725 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 21:05:44,726 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 21:05:44,735 INFO core: Event loop thread started, running loop forever
2026-09-16 21:05:45,036 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 21:05:45,042 INFO core: _init_accounts coroutine started
2026-09-16 21:05:45,042 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 21:05:45,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:10:39,904 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 21:10:39,904 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 21:10:39,906 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 21:10:39,908 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 21:10:39,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:15:50,898 INFO core: Event loop thread started, running loop forever
2026-09-16 21:15:51,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 21:15:51,205 INFO core: _init_accounts coroutine started
2026-09-16 21:15:51,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 21:15:51,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:20:43,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:25:50,362 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 21:25:51,596 INFO core: Event loop thread started, running loop forever
2026-09-16 21:25:51,897 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 21:25:51,903 INFO core: _init_accounts coroutine started
2026-09-16 21:25:51,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 21:25:51,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:30:46,726 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:35:31,726 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 21:35:31,726 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 21:35:31,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:35:31,731 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 21:40:32,151 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 21:40:32,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:45:24,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:50:19,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 21:55:12,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:00:19,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 22:00:48,260 INFO core: Event loop thread started, running loop forever
2026-09-16 22:00:48,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 22:00:48,565 INFO core: _init_accounts coroutine started
2026-09-16 22:00:48,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 22:00:48,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:05:45,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:10:34,352 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 22:10:34,353 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 22:10:34,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:15:07,339 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 22:15:07,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:20:31,952 INFO core: Event loop thread started, running loop forever
2026-09-16 22:20:32,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 22:20:32,259 INFO core: _init_accounts coroutine started
2026-09-16 22:20:32,259 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 22:20:32,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:25:18,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:30:25,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 22:30:49,586 INFO core: Event loop thread started, running loop forever
2026-09-16 22:30:49,886 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 22:30:49,889 INFO core: _init_accounts coroutine started
2026-09-16 22:30:49,891 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 22:30:49,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:35:26,643 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 22:35:26,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:40:36,644 INFO core: Event loop thread started, running loop forever
2026-09-16 22:40:36,945 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 22:40:36,952 INFO core: _init_accounts coroutine started
2026-09-16 22:40:36,955 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 22:40:36,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:45:04,050 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 22:45:04,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:45:04,051 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 22:50:30,414 INFO core: Event loop thread started, running loop forever
2026-09-16 22:50:30,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 22:50:30,722 INFO core: _init_accounts coroutine started
2026-09-16 22:50:30,722 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 22:50:30,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:55:08,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 22:55:08,345 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 22:55:08,345 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 23:00:14,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 23:00:22,623 INFO core: Event loop thread started, running loop forever
2026-09-16 23:00:22,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 23:00:22,928 INFO core: _init_accounts coroutine started
2026-09-16 23:00:22,928 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 23:00:22,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:05:28,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-16 23:05:48,512 INFO core: Event loop thread started, running loop forever
2026-09-16 23:05:48,813 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 23:05:48,817 INFO core: _init_accounts coroutine started
2026-09-16 23:05:48,819 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 23:05:48,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:10:21,465 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-16 23:10:21,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:15:34,607 INFO core: Event loop thread started, running loop forever
2026-09-16 23:15:34,909 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 23:15:34,912 INFO core: _init_accounts coroutine started
2026-09-16 23:15:34,912 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 23:15:34,941 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 23:15:34,941 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 23:15:34,942 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 23:15:34,944 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 23:15:34,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:20:36,268 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 23:20:36,268 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 23:20:36,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:25:28,716 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 23:25:28,718 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 23:25:28,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:30:26,760 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 23:30:26,761 WARNING core: Account 2: connect timed out after 35s
2026-09-16 23:30:26,762 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-16 23:30:26,763 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-16 23:30:26,763 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-16 23:30:26,765 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-16 23:30:26,765 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-16 23:30:26,768 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:35:32,356 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-16 23:35:32,358 WARNING core: Account 2: connect timed out after 35s
2026-09-16 23:35:46,396 INFO core: Event loop thread started, running loop forever
2026-09-16 23:35:46,697 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 23:35:46,700 INFO core: _init_accounts coroutine started
2026-09-16 23:35:46,702 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 23:35:46,711 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 23:35:46,711 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 23:35:46,712 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 23:35:46,714 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 23:35:46,716 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:40:03,662 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-16 23:40:03,664 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-16 23:40:03,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:45:09,385 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-16 23:45:09,386 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-16 23:45:42,692 INFO core: Event loop thread started, running loop forever
2026-09-16 23:45:42,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-16 23:45:43,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:50:39,093 INFO core: _init_accounts coroutine started
2026-09-16 23:50:39,094 INFO core: _init_accounts_inner: starting DB migrations
2026-09-16 23:50:39,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-16 23:55:17,017 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-16 23:55:17,017 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-16 23:55:17,020 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-16 23:55:17,021 INFO core: _init_accounts_inner: reloading LLM config
2026-09-16 23:55:17,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:00:09,405 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 00:00:09,405 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 00:00:09,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 00:00:48,443 INFO core: Event loop thread started, running loop forever
2026-09-17 00:00:48,743 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 00:00:48,747 INFO core: _init_accounts coroutine started
2026-09-17 00:00:48,748 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 00:00:48,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:05:52,314 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 00:05:52,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:10:03,663 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:15:07,876 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-17 00:15:07,877 INFO core: _init_accounts coroutine started
2026-09-17 00:15:07,877 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 00:15:07,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:20:13,408 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 00:20:37,769 INFO core: Event loop thread started, running loop forever
2026-09-17 00:20:38,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 00:20:38,074 INFO core: _init_accounts coroutine started
2026-09-17 00:20:38,075 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 00:20:38,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:25:10,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 00:25:10,493 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 00:25:10,495 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 00:25:10,498 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 00:25:10,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:30:52,870 INFO core: Event loop thread started, running loop forever
2026-09-17 00:30:53,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 00:30:53,179 INFO core: _init_accounts coroutine started
2026-09-17 00:30:53,183 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 00:30:53,190 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:35:46,034 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 00:35:46,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:40:48,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:45:31,467 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-17 00:45:31,469 INFO core: _init_accounts coroutine started
2026-09-17 00:45:31,469 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 00:45:31,478 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:50:38,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 00:50:42,276 INFO core: Event loop thread started, running loop forever
2026-09-17 00:50:42,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 00:50:42,582 INFO core: _init_accounts coroutine started
2026-09-17 00:50:42,584 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 00:50:42,588 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:55:32,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 00:55:32,655 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 01:00:38,423 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 01:00:53,630 INFO core: Event loop thread started, running loop forever
2026-09-17 01:00:53,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 01:00:53,936 INFO core: _init_accounts coroutine started
2026-09-17 01:00:53,938 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 01:00:53,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:05:15,700 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 01:05:15,700 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 01:05:15,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:10:43,364 INFO core: Event loop thread started, running loop forever
2026-09-17 01:10:43,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 01:10:43,668 INFO core: _init_accounts coroutine started
2026-09-17 01:10:43,671 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 01:10:43,682 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:15:47,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:20:42,233 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 01:20:42,233 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 01:20:42,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:25:13,987 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 01:25:13,989 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 01:25:13,992 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 01:25:13,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:30:41,731 INFO core: Event loop thread started, running loop forever
2026-09-17 01:30:42,032 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 01:30:42,036 INFO core: _init_accounts coroutine started
2026-09-17 01:30:42,037 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 01:30:42,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:35:17,707 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 01:35:17,707 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 01:35:17,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:35:17,712 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 01:40:45,019 INFO core: Event loop thread started, running loop forever
2026-09-17 01:40:45,319 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 01:40:45,322 INFO core: _init_accounts coroutine started
2026-09-17 01:40:45,324 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 01:40:45,330 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 01:40:45,330 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 01:40:45,331 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 01:40:45,332 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 01:40:45,340 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 01:40:45,340 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 01:40:45,344 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 01:40:45,344 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 01:40:45,347 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:45:40,061 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 01:45:40,062 WARNING core: Account 2: connect timed out after 35s
2026-09-17 01:45:40,062 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-17 01:45:40,063 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-17 01:45:40,063 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-17 01:45:40,064 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-17 01:45:40,065 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-17 01:45:40,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:50:06,086 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 01:50:06,087 WARNING core: Account 2: connect timed out after 35s
2026-09-17 01:50:06,088 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-17 01:50:06,088 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-17 01:50:06,089 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-17 01:50:06,090 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-17 01:50:06,091 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-17 01:50:06,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 01:55:12,950 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 01:55:12,950 WARNING core: Account 2: connect timed out after 35s
2026-09-17 01:55:12,951 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-17 01:55:12,962 INFO core: Event loop thread started, running loop forever
2026-09-17 01:55:13,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 01:55:13,273 INFO core: _init_accounts coroutine started
2026-09-17 01:55:13,276 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 01:55:13,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:00:20,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 02:00:32,014 INFO core: Event loop thread started, running loop forever
2026-09-17 02:00:32,316 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 02:00:32,321 INFO core: _init_accounts coroutine started
2026-09-17 02:00:32,323 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 02:00:32,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:05:17,583 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:10:38,003 INFO core: Event loop thread started, running loop forever
2026-09-17 02:10:38,304 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 02:10:38,309 INFO core: _init_accounts coroutine started
2026-09-17 02:10:38,310 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 02:10:38,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:15:45,422 INFO core: Event loop thread started, running loop forever
2026-09-17 02:15:45,723 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 02:15:45,728 INFO core: _init_accounts coroutine started
2026-09-17 02:15:45,729 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 02:15:45,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:20:34,014 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:20:34,015 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 02:20:34,015 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 02:25:41,344 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 02:25:41,345 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 02:25:41,346 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 02:25:41,346 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 02:25:41,346 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 02:25:41,346 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 02:25:46,794 INFO core: Event loop thread started, running loop forever
2026-09-17 02:25:47,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 02:25:47,107 INFO core: _init_accounts coroutine started
2026-09-17 02:25:47,108 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 02:25:47,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:30:24,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:30:24,592 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 02:30:24,593 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 02:35:31,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 02:35:31,378 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 02:35:31,379 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 02:35:31,379 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 02:35:31,379 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 02:35:31,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 02:35:46,804 INFO core: Event loop thread started, running loop forever
2026-09-17 02:35:47,105 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 02:35:47,108 INFO core: _init_accounts coroutine started
2026-09-17 02:35:47,111 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 02:35:47,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:40:36,697 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 02:40:36,697 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 02:40:36,699 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 02:40:36,701 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 02:40:36,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:45:26,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:50:30,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 02:55:12,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:00:19,123 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 03:00:19,125 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 03:00:19,125 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 03:00:33,728 INFO core: Event loop thread started, running loop forever
2026-09-17 03:00:34,034 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 03:00:34,037 INFO core: _init_accounts coroutine started
2026-09-17 03:00:34,038 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 03:00:34,045 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:05:40,392 ERROR sqlalchemy.pool.impl.QueuePool: Exception during reset or similar
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 986, in _finalize_fairy
    fairy._reset(
    ~~~~~~~~~~~~^
        pool,
        ^^^^^
    ...<2 lines>...
        asyncio_safe=can_manipulate_connection,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1441, in _reset
    pool._dialect.do_rollback(self)
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 123, in do_rollback
    dbapi_connection.rollback()
    ~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 512, in rollback
    self._read_ok_packet()
    ~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 472, in _read_ok_packet
    pkt = self._read_packet()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 772, in _read_packet
    packet_header = self._read_bytes(4)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 826, in _read_bytes
    raise err.OperationalError(
        CR.CR_SERVER_LOST, "Lost connection to MySQL server during query"
    )
pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')
2026-09-17 03:05:53,417 INFO core: Event loop thread started, running loop forever
2026-09-17 03:05:53,718 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 03:05:53,724 INFO core: _init_accounts coroutine started
2026-09-17 03:05:53,725 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 03:05:53,742 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:10:50,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:15:03,286 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 03:15:53,595 INFO core: Event loop thread started, running loop forever
2026-09-17 03:15:53,895 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 03:15:53,900 INFO core: _init_accounts coroutine started
2026-09-17 03:15:53,901 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 03:15:53,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:20:08,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:25:08,028 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:30:15,379 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 03:30:38,771 INFO core: Event loop thread started, running loop forever
2026-09-17 03:30:39,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 03:30:39,080 INFO core: _init_accounts coroutine started
2026-09-17 03:30:39,080 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 03:30:39,087 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:35:06,508 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:40:14,270 INFO core: Event loop thread started, running loop forever
2026-09-17 03:40:14,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 03:40:14,575 INFO core: _init_accounts coroutine started
2026-09-17 03:40:14,577 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 03:40:14,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:45:36,230 INFO core: Event loop thread started, running loop forever
2026-09-17 03:45:36,531 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 03:45:36,535 INFO core: _init_accounts coroutine started
2026-09-17 03:45:36,538 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 03:45:36,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:50:51,449 INFO core: Event loop thread started, running loop forever
2026-09-17 03:50:51,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 03:50:51,756 INFO core: _init_accounts coroutine started
2026-09-17 03:50:51,757 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 03:50:51,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:55:08,323 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 03:55:08,323 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 03:55:08,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 03:55:08,346 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 04:00:27,791 INFO core: Event loop thread started, running loop forever
2026-09-17 04:00:28,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 04:00:28,099 INFO core: _init_accounts coroutine started
2026-09-17 04:00:28,100 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 04:00:28,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:05:07,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:05:07,725 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 04:05:07,726 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 04:10:28,897 INFO core: Event loop thread started, running loop forever
2026-09-17 04:10:29,198 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 04:10:29,202 INFO core: _init_accounts coroutine started
2026-09-17 04:10:29,202 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 04:10:29,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:15:20,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:20:27,377 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 04:20:36,174 INFO core: Event loop thread started, running loop forever
2026-09-17 04:20:36,475 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 04:20:36,482 INFO core: _init_accounts coroutine started
2026-09-17 04:20:36,482 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 04:20:36,487 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:25:43,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 04:25:46,182 INFO core: Event loop thread started, running loop forever
2026-09-17 04:25:46,483 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 04:25:46,489 INFO core: _init_accounts coroutine started
2026-09-17 04:25:46,491 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 04:25:46,496 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:30:29,212 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 04:30:29,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:35:12,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:40:24,292 INFO core: Event loop thread started, running loop forever
2026-09-17 04:40:24,594 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 04:40:24,597 INFO core: _init_accounts coroutine started
2026-09-17 04:40:24,598 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 04:40:24,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:45:33,548 INFO core: Event loop thread started, running loop forever
2026-09-17 04:45:33,849 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 04:45:33,855 INFO core: _init_accounts coroutine started
2026-09-17 04:45:33,855 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 04:45:33,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:45:33,866 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 04:45:33,868 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 04:50:40,451 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 04:50:40,452 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 04:50:40,452 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 04:50:40,452 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 04:50:40,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 04:50:40,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 04:50:41,912 INFO core: Event loop thread started, running loop forever
2026-09-17 04:50:42,213 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 04:50:42,217 INFO core: _init_accounts coroutine started
2026-09-17 04:50:42,219 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 04:50:42,224 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 04:55:08,775 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 04:55:08,789 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:00:12,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:05:53,007 INFO core: Event loop thread started, running loop forever
2026-09-17 05:05:53,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 05:05:53,312 INFO core: _init_accounts coroutine started
2026-09-17 05:05:53,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 05:05:53,324 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:10:29,933 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 05:10:29,933 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 05:10:29,938 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 05:10:29,940 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 05:10:29,962 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 05:10:29,963 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 05:10:29,967 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 05:10:29,969 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 05:10:29,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:15:36,490 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 05:15:36,491 WARNING core: Account 2: connect timed out after 35s
2026-09-17 05:15:36,492 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-17 05:15:36,492 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-17 05:15:36,493 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-17 05:15:36,495 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-17 05:15:36,495 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-17 05:15:42,681 INFO core: Event loop thread started, running loop forever
2026-09-17 05:15:42,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 05:15:42,986 INFO core: _init_accounts coroutine started
2026-09-17 05:15:42,986 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 05:15:42,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:20:16,251 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 05:20:16,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:25:40,651 INFO core: Event loop thread started, running loop forever
2026-09-17 05:25:40,952 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 05:25:40,964 INFO core: _init_accounts coroutine started
2026-09-17 05:25:40,965 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 05:25:40,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:30:03,341 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 05:30:03,341 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 05:30:03,342 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-17 05:30:03,342 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 05:30:03,342 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 05:30:03,342 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 05:30:03,343 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 05:30:03,343 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 05:30:03,343 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 05:30:30,196 INFO core: Event loop thread started, running loop forever
2026-09-17 05:30:30,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 05:30:30,501 INFO core: _init_accounts coroutine started
2026-09-17 05:30:30,503 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 05:30:30,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:35:36,244 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 05:35:36,244 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 05:35:36,247 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 05:35:36,249 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 05:35:36,249 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:40:43,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 05:40:48,490 INFO core: Event loop thread started, running loop forever
2026-09-17 05:40:48,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 05:40:48,795 INFO core: _init_accounts coroutine started
2026-09-17 05:40:48,796 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 05:40:48,804 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:45:38,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:50:14,959 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 05:50:14,960 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 05:50:14,963 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 05:50:14,965 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 05:50:14,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 05:55:29,258 INFO core: Event loop thread started, running loop forever
2026-09-17 05:55:29,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 05:55:29,563 INFO core: _init_accounts coroutine started
2026-09-17 05:55:29,564 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 05:55:29,570 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:00:36,368 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 06:00:45,492 INFO core: Event loop thread started, running loop forever
2026-09-17 06:00:45,793 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 06:00:45,796 INFO core: _init_accounts coroutine started
2026-09-17 06:00:45,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 06:00:45,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:05:08,061 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 06:05:08,062 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 06:05:08,213 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 06:05:08,218 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 06:05:08,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:10:06,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:15:11,026 INFO core: Event loop thread started, running loop forever
2026-09-17 06:15:11,327 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 06:15:11,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:15:13,021 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 06:20:18,406 INFO core: _init_accounts coroutine started
2026-09-17 06:20:18,407 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 06:20:18,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 06:20:30,863 INFO core: Event loop thread started, running loop forever
2026-09-17 06:20:31,164 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 06:20:31,167 INFO core: _init_accounts coroutine started
2026-09-17 06:20:31,168 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 06:20:31,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:25:36,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:30:35,371 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:35:27,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 06:35:27,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 06:35:27,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 06:35:27,447 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 06:35:27,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:40:10,097 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:40:10,098 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 06:40:10,099 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 06:45:16,373 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 06:45:16,375 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 06:45:50,937 INFO core: Event loop thread started, running loop forever
2026-09-17 06:45:51,238 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 06:45:51,242 INFO core: _init_accounts coroutine started
2026-09-17 06:45:51,244 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 06:45:51,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:50:35,103 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 06:50:35,104 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 06:50:35,105 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 06:50:35,106 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 06:55:20,302 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 06:55:20,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:00:27,436 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 07:00:50,882 INFO core: Event loop thread started, running loop forever
2026-09-17 07:00:51,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 07:00:51,187 INFO core: _init_accounts coroutine started
2026-09-17 07:00:51,190 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 07:00:51,197 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:05:34,618 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 07:05:34,623 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:10:42,489 INFO core: Event loop thread started, running loop forever
2026-09-17 07:10:42,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 07:10:42,794 INFO core: _init_accounts coroutine started
2026-09-17 07:10:42,794 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 07:10:42,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:15:25,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:20:25,994 INFO core: Event loop thread started, running loop forever
2026-09-17 07:20:26,295 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 07:20:26,300 INFO core: _init_accounts coroutine started
2026-09-17 07:20:26,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 07:20:26,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:25:33,382 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-09-17 07:25:52,040 INFO core: Event loop thread started, running loop forever
2026-09-17 07:25:52,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 07:25:52,345 INFO core: _init_accounts coroutine started
2026-09-17 07:25:52,345 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 07:25:52,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:30:40,154 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 07:30:40,155 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 07:30:40,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:30:40,160 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 07:35:13,947 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 07:35:13,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:40:03,854 INFO core: Event loop thread started, running loop forever
2026-09-17 07:40:04,155 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 07:40:04,159 INFO core: _init_accounts coroutine started
2026-09-17 07:40:04,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 07:40:04,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:45:42,230 INFO core: Event loop thread started, running loop forever
2026-09-17 07:45:42,531 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 07:45:42,534 INFO core: _init_accounts coroutine started
2026-09-17 07:45:42,536 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 07:45:42,543 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:50:08,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 07:55:08,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:00:15,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 08:00:34,514 INFO core: Event loop thread started, running loop forever
2026-09-17 08:00:34,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 08:00:34,818 INFO core: _init_accounts coroutine started
2026-09-17 08:00:34,820 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 08:00:34,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:05:10,774 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 08:05:10,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:10:36,677 INFO core: Event loop thread started, running loop forever
2026-09-17 08:10:36,978 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 08:10:36,983 INFO core: _init_accounts coroutine started
2026-09-17 08:10:36,986 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 08:10:36,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:15:42,371 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 08:15:45,209 INFO core: Event loop thread started, running loop forever
2026-09-17 08:15:45,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 08:15:45,514 INFO core: _init_accounts coroutine started
2026-09-17 08:15:45,516 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 08:15:45,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:20:38,603 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 08:20:38,604 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 08:20:38,618 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 08:20:38,625 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 08:20:38,639 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:25:45,413 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 08:25:48,176 INFO core: Event loop thread started, running loop forever
2026-09-17 08:25:48,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 08:25:48,489 INFO core: _init_accounts coroutine started
2026-09-17 08:25:48,492 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 08:25:48,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:30:27,419 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:35:38,161 INFO core: Event loop thread started, running loop forever
2026-09-17 08:35:38,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 08:35:38,472 INFO core: _init_accounts coroutine started
2026-09-17 08:35:38,472 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 08:35:38,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:40:12,647 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:40:12,648 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 08:40:12,649 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 08:45:04,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 08:45:04,409 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:50:11,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 08:50:25,746 INFO core: Event loop thread started, running loop forever
2026-09-17 08:50:26,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 08:50:26,053 INFO core: _init_accounts coroutine started
2026-09-17 08:50:26,054 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 08:50:26,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:55:27,668 INFO core: Event loop thread started, running loop forever
2026-09-17 08:55:27,969 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 08:55:27,975 INFO core: _init_accounts coroutine started
2026-09-17 08:55:27,976 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 08:55:27,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 08:55:33,670 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 09:00:16,555 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 09:00:16,556 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 09:00:16,558 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 09:00:16,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:00:16,561 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 09:05:52,844 INFO core: Event loop thread started, running loop forever
2026-09-17 09:05:53,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 09:05:53,151 INFO core: _init_accounts coroutine started
2026-09-17 09:05:53,152 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 09:05:53,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:10:18,364 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 09:10:18,365 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 09:10:18,366 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:15:25,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 09:15:25,384 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 09:15:36,399 INFO core: Event loop thread started, running loop forever
2026-09-17 09:15:36,700 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 09:15:36,703 INFO core: _init_accounts coroutine started
2026-09-17 09:15:36,705 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 09:15:36,710 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:20:13,384 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:25:09,506 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 09:25:09,507 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 09:25:09,511 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:30:54,756 INFO core: Event loop thread started, running loop forever
2026-09-17 09:30:55,058 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 09:30:55,063 INFO core: _init_accounts coroutine started
2026-09-17 09:30:55,064 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 09:30:55,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:30:55,072 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 09:30:55,073 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 09:35:06,162 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 09:35:06,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:40:13,214 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 09:40:13,215 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 09:40:13,216 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 09:40:13,222 INFO core: Event loop thread started, running loop forever
2026-09-17 09:40:13,216 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 09:40:13,524 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 09:40:13,527 INFO core: _init_accounts coroutine started
2026-09-17 09:40:13,530 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 09:40:13,539 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-17 09:40:13,540 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-17 09:45:39,024 INFO core: Event loop thread started, running loop forever
2026-09-17 09:45:39,325 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 09:45:39,331 INFO core: _init_accounts coroutine started
2026-09-17 09:45:39,331 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 09:45:39,337 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:50:46,412 INFO core: Event loop thread started, running loop forever
2026-09-17 09:50:46,714 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 09:50:46,716 INFO core: _init_accounts coroutine started
2026-09-17 09:50:46,718 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 09:50:46,750 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 09:55:51,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:00:28,041 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 10:00:28,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:00:28,042 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 10:05:20,576 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 10:05:20,577 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 10:05:20,579 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:10:27,448 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 10:10:43,478 INFO core: Event loop thread started, running loop forever
2026-09-17 10:10:43,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 10:10:43,784 INFO core: _init_accounts coroutine started
2026-09-17 10:10:43,785 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 10:10:43,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:15:34,400 INFO core: Event loop thread started, running loop forever
2026-09-17 10:15:34,704 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 10:15:34,707 INFO core: _init_accounts coroutine started
2026-09-17 10:15:34,708 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 10:15:34,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:20:43,870 INFO core: Event loop thread started, running loop forever
2026-09-17 10:20:44,171 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 10:20:44,176 INFO core: _init_accounts coroutine started
2026-09-17 10:20:44,177 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 10:20:44,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:25:09,348 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 10:25:09,349 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 10:25:09,352 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 10:25:09,353 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 10:25:09,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:30:40,280 INFO core: Event loop thread started, running loop forever
2026-09-17 10:30:40,581 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 10:30:40,588 INFO core: _init_accounts coroutine started
2026-09-17 10:30:40,589 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 10:30:40,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:35:51,275 INFO core: Event loop thread started, running loop forever
2026-09-17 10:35:51,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 10:35:51,579 INFO core: _init_accounts coroutine started
2026-09-17 10:35:51,581 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 10:35:51,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:40:28,974 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 10:40:28,975 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 10:40:28,979 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 10:40:28,981 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 10:40:28,984 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:45:19,584 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 10:45:19,585 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 10:45:19,592 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 10:45:19,593 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 10:45:19,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:50:10,982 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 10:50:10,982 WARNING core: Account 2: connect timed out after 35s
2026-09-17 10:50:10,983 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-17 10:50:10,984 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-17 10:50:10,985 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-17 10:50:10,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 10:50:10,988 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-17 10:55:16,365 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-17 10:55:21,831 INFO core: Event loop thread started, running loop forever
2026-09-17 10:55:22,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 10:55:22,136 INFO core: _init_accounts coroutine started
2026-09-17 10:55:22,137 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 10:55:22,144 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:00:23,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:05:42,484 INFO core: Event loop thread started, running loop forever
2026-09-17 11:05:42,784 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 11:05:42,788 INFO core: _init_accounts coroutine started
2026-09-17 11:05:42,789 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 11:05:42,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:10:37,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:15:07,574 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 11:15:07,574 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 11:15:07,577 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 11:15:07,578 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:15:07,579 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 11:20:12,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:25:17,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:30:23,414 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 11:30:23,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 11:30:23,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 11:30:42,155 INFO core: Event loop thread started, running loop forever
2026-09-17 11:30:42,456 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 11:30:42,460 INFO core: _init_accounts coroutine started
2026-09-17 11:30:42,462 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 11:30:42,471 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 11:30:42,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 11:30:42,475 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 11:30:42,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:35:17,735 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 11:35:17,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:40:42,457 INFO core: Event loop thread started, running loop forever
2026-09-17 11:40:42,759 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 11:40:42,765 INFO core: _init_accounts coroutine started
2026-09-17 11:40:42,765 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 11:40:42,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:45:16,245 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 11:45:16,246 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 11:45:16,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:50:18,142 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 11:50:18,195 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 11:50:18,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 11:55:24,690 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 11:55:24,702 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 11:55:34,266 INFO core: Event loop thread started, running loop forever
2026-09-17 11:55:34,572 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 11:55:34,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:00:41,451 INFO core: _init_accounts coroutine started
2026-09-17 12:00:58,252 INFO core: Event loop thread started, running loop forever
2026-09-17 12:00:58,553 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 12:00:58,557 INFO core: _init_accounts coroutine started
2026-09-17 12:00:58,558 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 12:00:58,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:05:50,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:10:40,244 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 12:10:40,249 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:15:19,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:20:32,828 INFO core: Event loop thread started, running loop forever
2026-09-17 12:20:33,129 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 12:20:33,135 INFO core: _init_accounts coroutine started
2026-09-17 12:20:33,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:20:33,140 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 12:25:24,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:30:31,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 12:30:44,426 INFO core: Event loop thread started, running loop forever
2026-09-17 12:30:44,728 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 12:30:44,732 INFO core: _init_accounts coroutine started
2026-09-17 12:30:44,735 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 12:30:44,742 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:35:08,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:40:04,990 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 12:40:04,990 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 12:40:05,007 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 12:40:05,026 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 12:40:05,031 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:45:29,496 INFO core: Event loop thread started, running loop forever
2026-09-17 12:45:29,800 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 12:45:29,806 INFO core: _init_accounts coroutine started
2026-09-17 12:45:29,806 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 12:45:29,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:50:03,735 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 12:50:03,736 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 12:50:03,737 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 12:50:03,738 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 12:50:03,746 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 12:50:03,746 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 12:50:03,754 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 12:50:03,755 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 12:50:03,760 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:55:09,440 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 12:55:09,441 WARNING core: Account 2: connect timed out after 35s
2026-09-17 12:55:09,441 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-17 12:55:09,441 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-17 12:55:09,442 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-17 12:55:09,443 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-17 12:55:09,443 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-17 12:55:30,655 INFO core: Event loop thread started, running loop forever
2026-09-17 12:55:30,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 12:55:30,960 INFO core: _init_accounts coroutine started
2026-09-17 12:55:30,962 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 12:55:30,971 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 12:55:30,972 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 12:55:30,972 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 12:55:30,973 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 12:55:30,974 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 13:00:14,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:05:20,453 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 13:05:20,454 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 13:05:20,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 13:05:42,484 INFO core: Event loop thread started, running loop forever
2026-09-17 13:05:42,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 13:05:42,789 INFO core: _init_accounts coroutine started
2026-09-17 13:05:42,789 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 13:05:42,798 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:10:06,253 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 13:10:06,253 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 13:10:06,256 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 13:10:06,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:15:18,562 INFO core: Event loop thread started, running loop forever
2026-09-17 13:15:18,864 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 13:15:18,870 INFO core: _init_accounts coroutine started
2026-09-17 13:15:18,870 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 13:15:18,884 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 13:15:18,884 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 13:15:18,885 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 13:15:18,886 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 13:15:18,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:20:25,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 13:20:25,406 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 13:20:25,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 13:20:45,852 INFO core: Event loop thread started, running loop forever
2026-09-17 13:20:46,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 13:20:46,156 INFO core: _init_accounts coroutine started
2026-09-17 13:20:46,157 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 13:20:46,165 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:25:47,523 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 13:25:47,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:30:04,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:35:09,920 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-17 13:35:09,921 INFO core: _init_accounts coroutine started
2026-09-17 13:35:09,922 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 13:35:09,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:40:14,092 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 13:40:14,092 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 13:40:14,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:40:14,095 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 13:40:14,096 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 13:45:09,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:50:41,950 INFO core: Event loop thread started, running loop forever
2026-09-17 13:50:42,251 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 13:50:42,258 INFO core: _init_accounts coroutine started
2026-09-17 13:50:42,258 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 13:50:42,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 13:55:27,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:00:22,385 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 14:00:22,385 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 14:00:22,388 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:05:26,449 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 14:05:26,453 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 14:05:26,463 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:10:12,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:15:30,857 INFO core: Event loop thread started, running loop forever
2026-09-17 14:15:31,158 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 14:15:31,161 INFO core: _init_accounts coroutine started
2026-09-17 14:15:31,164 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 14:15:31,171 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:20:37,389 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 14:20:37,389 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 14:20:37,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 14:20:37,395 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 14:20:37,396 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 14:20:37,396 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 14:20:37,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 14:20:37,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 14:20:48,816 INFO core: Event loop thread started, running loop forever
2026-09-17 14:20:49,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 14:20:49,122 INFO core: _init_accounts coroutine started
2026-09-17 14:20:49,122 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 14:20:49,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:25:29,514 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 14:25:29,514 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 14:25:29,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:25:29,517 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 14:30:34,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:35:40,391 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 14:35:40,391 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 14:35:40,393 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 14:35:40,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 14:35:49,386 INFO core: Event loop thread started, running loop forever
2026-09-17 14:35:49,691 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 14:35:49,704 INFO core: _init_accounts coroutine started
2026-09-17 14:35:49,704 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 14:35:49,714 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:40:28,666 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 14:40:28,667 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 14:40:28,668 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 14:40:28,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:40:28,669 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 14:45:15,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:50:26,698 INFO core: Event loop thread started, running loop forever
2026-09-17 14:50:26,999 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 14:50:27,002 INFO core: _init_accounts coroutine started
2026-09-17 14:50:27,004 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 14:50:27,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:55:32,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 14:55:32,331 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 14:55:32,331 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 15:00:11,360 INFO core: Event loop thread started, running loop forever
2026-09-17 15:00:11,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 15:00:11,669 INFO core: _init_accounts coroutine started
2026-09-17 15:00:11,671 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 15:00:11,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:05:22,769 INFO core: Event loop thread started, running loop forever
2026-09-17 15:05:23,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 15:05:23,073 INFO core: _init_accounts coroutine started
2026-09-17 15:05:23,075 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 15:05:23,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:10:46,678 INFO core: Event loop thread started, running loop forever
2026-09-17 15:10:46,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 15:10:46,985 INFO core: _init_accounts coroutine started
2026-09-17 15:10:46,985 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 15:10:46,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:15:51,873 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 15:15:51,873 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 15:15:51,878 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 15:15:51,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:20:50,100 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 15:20:50,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:25:20,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:30:26,414 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 15:30:52,483 INFO core: Event loop thread started, running loop forever
2026-09-17 15:30:52,792 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 15:30:52,797 INFO core: _init_accounts coroutine started
2026-09-17 15:30:52,798 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 15:30:52,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:35:06,577 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 15:35:06,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:40:52,907 INFO core: Event loop thread started, running loop forever
2026-09-17 15:40:53,208 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 15:40:53,211 INFO core: _init_accounts coroutine started
2026-09-17 15:40:53,213 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 15:40:53,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:45:24,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:50:31,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 15:50:31,409 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 15:50:31,410 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-17 15:50:31,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 15:50:31,411 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 15:50:31,411 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 15:50:31,411 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 15:50:31,411 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 15:50:31,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 15:50:50,310 INFO core: Event loop thread started, running loop forever
2026-09-17 15:50:50,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 15:50:50,615 INFO core: _init_accounts coroutine started
2026-09-17 15:50:50,618 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 15:50:50,629 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 15:50:50,629 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 15:50:50,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 15:50:50,631 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 15:55:46,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 15:55:46,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:00:53,551 INFO core: Event loop thread started, running loop forever
2026-09-17 16:00:53,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 16:00:53,857 INFO core: _init_accounts coroutine started
2026-09-17 16:00:53,858 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 16:00:53,866 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:00:53,868 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-17 16:05:51,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:10:31,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:15:10,344 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-17 16:15:10,345 INFO core: _init_accounts coroutine started
2026-09-17 16:15:10,346 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 16:15:10,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:20:44,310 INFO core: Event loop thread started, running loop forever
2026-09-17 16:20:44,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 16:20:44,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:25:18,657 INFO core: _init_accounts coroutine started
2026-09-17 16:25:18,659 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 16:25:18,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:25:18,667 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 16:25:18,667 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 16:30:24,410 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 16:30:24,412 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 16:30:24,412 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 16:30:24,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 16:30:24,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 16:30:24,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 16:30:55,104 INFO core: Event loop thread started, running loop forever
2026-09-17 16:30:55,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 16:30:55,412 INFO core: _init_accounts coroutine started
2026-09-17 16:30:55,429 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 16:30:55,448 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:35:39,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 16:35:39,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 16:35:39,389 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 16:35:39,393 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 16:35:39,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:40:34,903 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 16:40:34,904 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 16:40:34,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:45:29,991 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 16:45:29,992 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 16:45:29,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:50:36,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 16:50:36,395 WARNING core: Account 2: connect timed out after 35s
2026-09-17 16:50:36,395 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-17 16:50:36,395 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-17 16:50:36,396 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-17 16:50:36,397 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-17 16:50:36,398 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-17 16:50:37,449 INFO core: Event loop thread started, running loop forever
2026-09-17 16:50:37,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 16:50:37,763 INFO core: _init_accounts coroutine started
2026-09-17 16:50:37,763 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 16:50:37,769 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 16:50:37,769 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 16:50:37,771 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 16:50:37,772 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 16:50:37,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 16:55:32,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:00:30,095 INFO core: Event loop thread started, running loop forever
2026-09-17 17:00:30,396 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 17:00:30,401 INFO core: _init_accounts coroutine started
2026-09-17 17:00:30,401 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 17:00:30,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:05:36,386 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 17:05:36,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 17:05:36,395 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 17:05:36,395 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 17:05:36,396 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 17:05:36,396 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 17:05:36,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 17:05:36,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 17:05:51,587 INFO core: Event loop thread started, running loop forever
2026-09-17 17:05:51,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 17:05:51,892 INFO core: _init_accounts coroutine started
2026-09-17 17:05:51,893 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 17:05:51,901 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:10:09,800 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:10:09,801 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 17:10:09,801 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 17:15:03,369 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 17:15:03,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 17:15:03,417 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 17:15:03,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 17:15:03,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 17:15:34,444 INFO core: Event loop thread started, running loop forever
2026-09-17 17:15:34,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 17:15:34,748 INFO core: _init_accounts coroutine started
2026-09-17 17:15:34,748 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 17:15:34,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:20:22,026 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 17:20:22,026 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 17:20:22,032 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:25:16,910 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 17:25:16,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:30:22,528 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 17:30:22,529 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 17:30:22,530 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 17:30:22,530 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 17:30:26,947 INFO core: Event loop thread started, running loop forever
2026-09-17 17:30:27,248 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 17:30:27,253 INFO core: _init_accounts coroutine started
2026-09-17 17:30:27,254 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 17:30:27,260 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:35:22,685 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 17:35:22,693 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:40:25,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:45:51,910 INFO core: Event loop thread started, running loop forever
2026-09-17 17:45:52,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 17:45:52,217 INFO core: _init_accounts coroutine started
2026-09-17 17:45:52,217 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 17:45:52,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:50:34,703 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 17:50:34,703 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 17:50:34,704 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 17:50:34,705 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 17:50:34,708 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 17:55:26,789 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 17:55:26,790 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 17:55:26,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:00:05,903 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 18:00:05,905 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 18:00:05,914 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:05:12,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 18:05:12,383 WARNING core: Account 2: connect timed out after 35s
2026-09-17 18:05:18,776 INFO core: Event loop thread started, running loop forever
2026-09-17 18:05:19,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 18:05:19,082 INFO core: _init_accounts coroutine started
2026-09-17 18:05:19,083 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 18:05:19,088 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:10:37,432 INFO core: Event loop thread started, running loop forever
2026-09-17 18:10:37,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 18:10:37,745 INFO core: _init_accounts coroutine started
2026-09-17 18:10:37,746 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 18:10:37,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:10:37,752 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 18:10:37,752 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 18:10:37,753 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 18:15:18,569 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 18:15:18,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:20:16,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:25:11,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:30:16,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:35:38,141 INFO core: Event loop thread started, running loop forever
2026-09-17 18:35:38,443 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 18:35:38,449 INFO core: _init_accounts coroutine started
2026-09-17 18:35:38,451 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 18:35:38,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:40:22,405 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 18:40:22,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:45:24,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:50:52,992 INFO core: Event loop thread started, running loop forever
2026-09-17 18:50:53,294 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 18:50:53,297 INFO core: _init_accounts coroutine started
2026-09-17 18:50:53,299 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 18:50:53,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 18:55:33,898 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 18:55:33,898 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 18:55:33,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:00:40,447 INFO core: Event loop thread started, running loop forever
2026-09-17 19:00:40,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 19:00:40,753 INFO core: _init_accounts coroutine started
2026-09-17 19:00:40,755 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 19:00:40,760 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:05:26,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:10:33,399 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 19:10:33,401 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 19:10:50,291 INFO core: Event loop thread started, running loop forever
2026-09-17 19:10:50,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 19:10:50,598 INFO core: _init_accounts coroutine started
2026-09-17 19:10:50,598 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 19:10:50,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:15:23,096 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 19:15:23,097 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 19:15:23,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:20:30,435 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 19:20:30,435 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 19:20:30,436 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 19:20:30,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 19:20:30,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 19:20:30,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 19:20:33,118 INFO core: Event loop thread started, running loop forever
2026-09-17 19:20:33,419 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 19:20:33,427 INFO core: _init_accounts coroutine started
2026-09-17 19:20:33,427 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 19:20:33,435 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:25:41,116 INFO core: Event loop thread started, running loop forever
2026-09-17 19:25:41,417 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 19:25:41,419 INFO core: _init_accounts coroutine started
2026-09-17 19:25:41,421 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 19:25:41,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:30:42,276 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 19:30:42,276 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 19:30:42,279 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 19:30:42,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:35:08,374 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 19:35:08,379 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:40:09,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:45:28,724 INFO core: Event loop thread started, running loop forever
2026-09-17 19:45:29,025 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 19:45:29,030 INFO core: _init_accounts coroutine started
2026-09-17 19:45:29,030 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 19:45:29,045 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:50:21,723 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 19:50:21,724 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 19:50:21,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 19:50:21,729 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 19:55:20,114 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 19:55:20,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:00:12,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:05:05,730 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 20:05:05,731 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 20:05:05,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:10:12,397 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 20:10:24,748 INFO core: Event loop thread started, running loop forever
2026-09-17 20:10:25,049 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 20:10:25,055 INFO core: _init_accounts coroutine started
2026-09-17 20:10:25,056 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 20:10:25,062 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:15:10,187 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:20:17,394 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 20:20:52,433 INFO core: Event loop thread started, running loop forever
2026-09-17 20:20:52,735 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 20:20:52,739 INFO core: _init_accounts coroutine started
2026-09-17 20:20:52,740 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 20:20:52,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:25:31,098 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 20:25:31,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:30:07,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:35:27,604 INFO core: Event loop thread started, running loop forever
2026-09-17 20:35:27,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 20:35:27,909 INFO core: _init_accounts coroutine started
2026-09-17 20:35:27,914 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:35:27,915 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 20:40:27,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:45:28,667 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 20:45:28,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:50:24,615 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 20:55:27,951 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-17 20:55:27,952 INFO core: _init_accounts coroutine started
2026-09-17 20:55:27,952 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 20:55:27,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:00:34,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 21:00:43,444 INFO core: Event loop thread started, running loop forever
2026-09-17 21:00:43,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 21:00:43,750 INFO core: _init_accounts coroutine started
2026-09-17 21:00:43,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 21:00:43,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:05:20,850 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 21:05:20,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:10:38,368 INFO core: Event loop thread started, running loop forever
2026-09-17 21:10:38,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 21:10:38,672 INFO core: _init_accounts coroutine started
2026-09-17 21:10:38,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 21:10:38,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:15:27,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:15:27,164 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 21:20:34,357 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 21:20:34,357 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-17 21:20:34,358 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 21:20:34,358 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 21:20:34,358 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 21:20:34,358 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 21:20:34,358 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 21:20:34,358 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 21:20:45,377 INFO core: Event loop thread started, running loop forever
2026-09-17 21:20:45,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 21:20:45,687 INFO core: _init_accounts coroutine started
2026-09-17 21:20:45,687 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:20:45,688 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 21:25:07,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:30:25,844 INFO core: Event loop thread started, running loop forever
2026-09-17 21:30:26,145 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 21:30:26,152 INFO core: _init_accounts coroutine started
2026-09-17 21:30:26,152 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 21:30:26,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:35:32,366 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 21:35:51,616 INFO core: Event loop thread started, running loop forever
2026-09-17 21:35:51,916 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 21:35:51,921 INFO core: _init_accounts coroutine started
2026-09-17 21:35:51,922 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 21:35:51,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:40:11,912 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 21:40:11,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:45:16,160 INFO core: Event loop thread started, running loop forever
2026-09-17 21:45:16,461 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 21:45:16,466 INFO core: _init_accounts coroutine started
2026-09-17 21:45:16,466 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 21:45:16,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:50:09,295 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 21:50:09,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 21:55:40,570 INFO core: Event loop thread started, running loop forever
2026-09-17 21:55:40,870 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 21:55:40,876 INFO core: _init_accounts coroutine started
2026-09-17 21:55:40,876 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 21:55:40,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:00:07,384 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 22:00:41,929 INFO core: Event loop thread started, running loop forever
2026-09-17 22:00:42,230 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 22:00:42,233 INFO core: _init_accounts coroutine started
2026-09-17 22:00:42,233 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 22:00:42,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:05:08,775 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 22:05:08,775 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 22:05:08,778 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 22:05:08,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:05:08,780 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 22:10:07,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:15:13,436 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 22:15:13,444 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 22:15:29,488 INFO core: Event loop thread started, running loop forever
2026-09-17 22:15:29,789 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 22:15:29,792 INFO core: _init_accounts coroutine started
2026-09-17 22:15:29,793 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 22:15:29,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:20:30,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:25:36,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 22:25:36,422 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 22:25:44,246 INFO core: Event loop thread started, running loop forever
2026-09-17 22:25:44,547 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 22:25:44,550 INFO core: _init_accounts coroutine started
2026-09-17 22:25:44,553 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 22:25:44,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:30:26,448 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 22:30:26,448 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 22:30:26,449 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 22:30:26,451 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 22:30:26,458 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:35:32,473 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 22:35:41,115 INFO core: Event loop thread started, running loop forever
2026-09-17 22:35:41,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 22:35:41,420 INFO core: _init_accounts coroutine started
2026-09-17 22:35:41,421 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 22:35:41,427 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:40:25,191 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 22:40:25,191 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 22:40:25,192 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 22:40:25,193 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 22:40:25,202 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-17 22:40:25,203 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 22:40:25,209 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-17 22:40:25,210 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-17 22:40:25,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:45:32,374 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-17 22:45:32,375 WARNING core: Account 2: connect timed out after 35s
2026-09-17 22:45:32,376 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-17 22:45:32,376 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-17 22:45:32,377 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-17 22:45:32,378 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-17 22:45:32,378 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-17 22:45:51,255 INFO core: Event loop thread started, running loop forever
2026-09-17 22:45:51,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 22:45:51,560 INFO core: _init_accounts coroutine started
2026-09-17 22:45:51,562 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 22:45:51,568 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:50:48,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 22:50:48,438 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 22:50:48,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:55:05,837 INFO core: Event loop thread started, running loop forever
2026-09-17 22:55:06,138 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 22:55:06,144 INFO core: _init_accounts coroutine started
2026-09-17 22:55:06,144 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 22:55:06,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 22:55:55,900 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 22:55:55,901 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-17 22:55:55,901 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 22:55:55,902 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-17 22:55:55,902 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-17 22:55:55,902 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 23:00:13,382 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 23:00:49,817 INFO core: Event loop thread started, running loop forever
2026-09-17 23:00:50,118 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 23:00:50,121 INFO core: _init_accounts coroutine started
2026-09-17 23:00:50,123 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 23:00:50,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:05:22,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:05:22,923 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 23:05:22,923 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 23:10:31,088 INFO core: Event loop thread started, running loop forever
2026-09-17 23:10:31,389 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 23:10:31,394 INFO core: _init_accounts coroutine started
2026-09-17 23:10:31,395 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 23:10:31,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:15:38,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-17 23:15:42,947 INFO core: Event loop thread started, running loop forever
2026-09-17 23:15:43,249 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 23:15:43,254 INFO core: _init_accounts coroutine started
2026-09-17 23:15:43,254 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 23:15:43,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:20:10,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:25:17,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 23:25:49,044 INFO core: Event loop thread started, running loop forever
2026-09-17 23:25:49,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 23:25:49,349 INFO core: _init_accounts coroutine started
2026-09-17 23:25:49,352 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 23:25:49,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:30:26,722 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-17 23:30:26,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:35:28,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:40:34,372 INFO core: Event loop thread started, running loop forever
2026-09-17 23:40:34,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 23:40:34,676 INFO core: _init_accounts coroutine started
2026-09-17 23:40:34,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 23:40:34,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:45:22,788 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-17 23:45:22,788 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-17 23:45:22,791 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-17 23:45:22,797 INFO core: _init_accounts_inner: reloading LLM config
2026-09-17 23:45:22,801 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:50:53,562 INFO core: Event loop thread started, running loop forever
2026-09-17 23:50:53,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-17 23:50:53,872 INFO core: _init_accounts coroutine started
2026-09-17 23:50:53,873 INFO core: _init_accounts_inner: starting DB migrations
2026-09-17 23:50:53,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-17 23:55:30,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:00:16,100 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 00:00:16,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:05:47,817 INFO core: Event loop thread started, running loop forever
2026-09-18 00:05:48,118 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 00:05:48,123 INFO core: _init_accounts coroutine started
2026-09-18 00:05:48,123 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 00:05:48,134 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:10:46,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:15:46,297 INFO core: Event loop thread started, running loop forever
2026-09-18 00:15:46,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 00:15:46,601 INFO core: _init_accounts coroutine started
2026-09-18 00:15:46,602 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 00:15:46,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:20:13,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:25:19,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 00:25:26,574 INFO core: Event loop thread started, running loop forever
2026-09-18 00:25:26,875 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 00:25:26,879 INFO core: _init_accounts coroutine started
2026-09-18 00:25:26,882 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 00:25:26,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:30:12,347 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:30:12,348 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 00:30:12,348 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 00:35:19,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 00:35:19,432 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-18 00:35:19,433 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 00:35:19,433 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 00:35:19,433 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 00:35:19,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 00:35:45,785 INFO core: Event loop thread started, running loop forever
2026-09-18 00:35:46,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 00:35:46,091 INFO core: _init_accounts coroutine started
2026-09-18 00:35:46,091 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 00:35:46,098 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:40:05,797 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 00:40:05,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:45:23,803 INFO core: Event loop thread started, running loop forever
2026-09-18 00:45:24,104 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 00:45:24,109 INFO core: _init_accounts coroutine started
2026-09-18 00:45:24,111 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 00:45:24,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:50:30,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 00:50:48,723 INFO core: Event loop thread started, running loop forever
2026-09-18 00:50:49,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 00:50:49,048 INFO core: _init_accounts coroutine started
2026-09-18 00:50:49,051 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 00:50:49,061 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:55:46,979 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 00:55:46,980 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 00:55:46,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 00:55:46,984 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 01:00:39,545 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 01:00:39,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:05:29,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:10:31,836 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 01:10:31,836 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 01:10:31,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:15:14,108 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 01:15:14,110 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 01:15:14,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:20:20,348 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 01:20:20,348 WARNING core: Account 2: connect timed out after 35s
2026-09-18 01:20:20,349 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 01:20:20,349 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 01:20:20,350 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 01:20:20,350 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 01:20:20,351 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 01:20:30,484 INFO core: Event loop thread started, running loop forever
2026-09-18 01:20:30,786 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 01:20:30,799 INFO core: _init_accounts coroutine started
2026-09-18 01:20:30,800 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 01:20:30,800 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:25:07,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:30:36,331 INFO core: Event loop thread started, running loop forever
2026-09-18 01:30:36,632 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 01:30:36,637 INFO core: _init_accounts coroutine started
2026-09-18 01:30:36,637 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 01:30:36,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:35:19,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:40:19,161 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 01:40:19,161 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 01:40:19,166 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 01:40:19,169 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 01:40:19,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:45:23,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:50:37,266 INFO core: Event loop thread started, running loop forever
2026-09-18 01:50:37,567 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 01:50:37,570 INFO core: _init_accounts coroutine started
2026-09-18 01:50:37,571 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 01:50:37,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 01:50:37,582 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 01:50:37,583 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 01:50:37,585 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 01:50:37,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 01:55:41,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:00:21,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:00:21,227 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 02:00:21,227 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 02:05:06,065 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 02:05:06,066 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 02:05:06,069 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:10:13,374 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 02:10:13,376 WARNING core: Account 2: connect timed out after 35s
2026-09-18 02:10:22,915 INFO core: Event loop thread started, running loop forever
2026-09-18 02:10:23,217 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 02:10:23,222 INFO core: _init_accounts coroutine started
2026-09-18 02:10:23,223 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 02:10:23,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:15:26,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:20:32,378 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 02:20:33,857 INFO core: Event loop thread started, running loop forever
2026-09-18 02:20:34,158 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 02:20:34,161 INFO core: _init_accounts coroutine started
2026-09-18 02:20:34,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 02:20:34,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:25:14,006 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 02:25:14,029 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:30:54,640 INFO core: Event loop thread started, running loop forever
2026-09-18 02:30:54,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 02:30:54,945 INFO core: _init_accounts coroutine started
2026-09-18 02:30:54,946 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 02:30:54,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:35:33,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:40:11,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:45:18,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 02:45:32,978 INFO core: Event loop thread started, running loop forever
2026-09-18 02:45:33,280 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 02:45:33,284 INFO core: _init_accounts coroutine started
2026-09-18 02:45:33,285 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 02:45:33,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:50:28,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 02:50:28,071 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 02:50:28,071 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 02:55:29,669 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 02:55:29,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:00:35,747 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 03:00:35,748 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 03:00:47,927 INFO core: Event loop thread started, running loop forever
2026-09-18 03:00:48,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 03:00:48,233 INFO core: _init_accounts coroutine started
2026-09-18 03:00:48,235 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 03:00:48,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:05:14,504 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 03:05:14,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:10:44,269 INFO core: Event loop thread started, running loop forever
2026-09-18 03:10:44,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 03:10:44,575 INFO core: _init_accounts coroutine started
2026-09-18 03:10:44,575 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 03:10:44,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:15:27,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:20:29,260 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 03:20:29,261 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 03:20:29,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:20:29,265 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 03:25:20,194 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 03:25:20,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:30:25,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:35:07,761 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 03:35:07,770 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 03:35:07,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:40:13,380 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 03:40:14,331 INFO core: Event loop thread started, running loop forever
2026-09-18 03:40:14,632 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 03:40:14,636 INFO core: _init_accounts coroutine started
2026-09-18 03:40:14,638 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 03:40:14,644 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:45:21,338 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 03:45:23,043 INFO core: Event loop thread started, running loop forever
2026-09-18 03:45:23,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 03:45:23,348 INFO core: _init_accounts coroutine started
2026-09-18 03:45:23,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 03:45:23,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:50:11,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 03:50:11,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 03:50:11,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 03:50:11,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:55:12,619 INFO core: Event loop thread started, running loop forever
2026-09-18 03:55:12,920 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 03:55:12,931 INFO core: _init_accounts coroutine started
2026-09-18 03:55:12,931 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 03:55:12,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 03:55:18,619 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 04:00:19,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 04:00:29,494 INFO core: Event loop thread started, running loop forever
2026-09-18 04:00:29,796 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 04:00:29,799 INFO core: _init_accounts coroutine started
2026-09-18 04:00:29,802 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 04:00:29,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:05:48,602 INFO core: Event loop thread started, running loop forever
2026-09-18 04:05:48,903 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 04:05:48,908 INFO core: _init_accounts coroutine started
2026-09-18 04:05:48,909 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 04:05:48,916 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:10:22,999 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:15:08,256 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 04:15:08,309 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:20:34,708 INFO core: Event loop thread started, running loop forever
2026-09-18 04:20:35,010 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 04:20:35,013 INFO core: _init_accounts coroutine started
2026-09-18 04:20:35,016 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 04:20:35,022 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:25:41,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 04:25:51,562 INFO core: Event loop thread started, running loop forever
2026-09-18 04:25:51,865 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 04:25:51,870 INFO core: _init_accounts coroutine started
2026-09-18 04:25:51,871 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 04:25:51,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:30:32,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:30:32,968 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 04:30:32,969 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 04:35:05,502 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 04:35:05,508 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 04:35:05,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:35:05,528 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 04:35:05,528 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 04:40:12,402 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 04:40:12,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 04:40:27,434 INFO core: Event loop thread started, running loop forever
2026-09-18 04:40:27,736 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 04:40:27,741 INFO core: _init_accounts coroutine started
2026-09-18 04:40:27,743 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 04:40:27,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:45:45,297 INFO core: Event loop thread started, running loop forever
2026-09-18 04:45:45,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 04:45:45,603 INFO core: _init_accounts coroutine started
2026-09-18 04:45:45,605 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 04:45:45,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:50:27,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 04:55:33,395 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 04:55:43,488 INFO core: Event loop thread started, running loop forever
2026-09-18 04:55:43,789 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 04:55:43,793 INFO core: _init_accounts coroutine started
2026-09-18 04:55:43,793 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 04:55:43,816 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:00:51,385 INFO core: Event loop thread started, running loop forever
2026-09-18 05:00:51,688 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 05:00:51,691 INFO core: _init_accounts coroutine started
2026-09-18 05:00:51,693 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 05:00:51,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:05:09,605 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 05:05:09,611 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 05:05:09,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:10:15,506 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 05:10:15,520 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 05:10:15,521 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 05:10:15,522 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 05:10:15,522 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 05:10:54,171 INFO core: Event loop thread started, running loop forever
2026-09-18 05:10:54,472 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 05:10:54,481 INFO core: _init_accounts coroutine started
2026-09-18 05:10:54,484 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 05:10:54,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:15:35,075 INFO core: Event loop thread started, running loop forever
2026-09-18 05:15:35,377 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 05:15:35,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:15:35,386 INFO core: _init_accounts coroutine started
2026-09-18 05:20:14,750 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 05:20:14,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:25:20,477 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 05:25:20,477 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 05:25:20,478 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-18 05:25:20,478 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 05:25:20,478 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-18 05:25:20,478 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 05:25:20,479 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 05:25:20,479 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 05:25:20,479 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 05:25:40,071 INFO core: Event loop thread started, running loop forever
2026-09-18 05:25:40,372 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 05:25:40,380 INFO core: _init_accounts coroutine started
2026-09-18 05:25:40,381 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 05:25:40,382 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:30:46,819 INFO core: Event loop thread started, running loop forever
2026-09-18 05:30:46,813 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-18 05:30:47,120 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 05:30:47,124 INFO core: _init_accounts coroutine started
2026-09-18 05:30:47,127 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 05:30:47,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:35:47,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:35:47,133 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 05:35:47,134 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 05:40:03,849 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 05:40:03,856 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 05:40:03,856 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:45:25,178 INFO core: Event loop thread started, running loop forever
2026-09-18 05:45:25,479 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 05:45:25,482 INFO core: _init_accounts coroutine started
2026-09-18 05:45:25,483 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 05:45:25,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:50:27,281 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 05:50:27,289 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 05:50:27,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:55:34,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 05:55:44,567 INFO core: Event loop thread started, running loop forever
2026-09-18 05:55:44,869 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 05:55:44,873 INFO core: _init_accounts coroutine started
2026-09-18 05:55:44,873 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 05:55:44,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 05:55:44,889 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 05:55:44,890 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 06:00:35,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:05:40,774 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 06:05:40,780 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 06:05:40,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:10:37,366 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:15:36,803 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:20:36,308 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 06:20:36,310 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 06:20:36,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:25:33,789 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 06:25:33,791 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 06:25:33,801 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:30:13,181 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 06:30:13,182 WARNING core: Account 2: connect timed out after 35s
2026-09-18 06:30:13,182 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 06:30:13,183 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 06:30:13,185 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 06:30:13,187 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 06:30:13,187 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 06:30:13,190 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:35:04,293 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 06:35:04,293 WARNING core: Account 2: connect timed out after 35s
2026-09-18 06:35:04,294 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-18 06:35:04,294 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-18 06:35:04,294 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 06:35:04,295 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-18 06:35:04,296 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-18 06:35:04,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:40:11,384 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 06:40:11,384 WARNING core: Account 2: connect timed out after 35s
2026-09-18 06:40:11,385 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-18 06:40:11,385 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-18 06:40:11,385 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 06:40:11,386 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-18 06:40:11,386 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-18 06:40:51,461 INFO core: Event loop thread started, running loop forever
2026-09-18 06:40:51,762 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 06:40:51,766 INFO core: _init_accounts coroutine started
2026-09-18 06:40:51,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 06:40:51,775 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 06:40:51,775 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 06:40:51,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:45:06,604 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 06:45:06,609 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 06:45:06,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:50:12,399 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 06:50:40,144 INFO core: Event loop thread started, running loop forever
2026-09-18 06:50:40,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 06:50:40,449 INFO core: _init_accounts coroutine started
2026-09-18 06:50:40,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 06:50:40,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 06:55:34,584 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 06:55:34,584 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 06:55:34,585 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 06:55:34,587 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 06:55:34,597 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 06:55:34,597 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 06:55:34,602 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 06:55:34,602 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 06:55:34,608 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:00:27,872 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 07:00:27,874 WARNING core: Account 2: connect timed out after 35s
2026-09-18 07:00:27,874 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 07:00:27,875 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 07:00:27,876 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 07:00:27,877 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 07:00:27,877 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 07:00:27,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:05:42,865 INFO core: Event loop thread started, running loop forever
2026-09-18 07:05:43,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 07:05:43,171 INFO core: _init_accounts coroutine started
2026-09-18 07:05:43,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 07:05:43,180 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:10:49,396 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 07:10:52,287 INFO core: Event loop thread started, running loop forever
2026-09-18 07:10:52,588 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 07:10:52,592 INFO core: _init_accounts coroutine started
2026-09-18 07:10:52,594 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 07:10:52,605 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 07:10:52,605 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 07:10:52,606 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 07:10:52,608 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 07:10:52,615 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:15:24,562 INFO core: Event loop thread started, running loop forever
2026-09-18 07:15:24,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 07:15:24,869 INFO core: _init_accounts coroutine started
2026-09-18 07:15:24,871 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 07:15:24,875 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:20:31,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 07:20:36,432 INFO core: Event loop thread started, running loop forever
2026-09-18 07:20:36,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 07:20:36,736 INFO core: _init_accounts coroutine started
2026-09-18 07:20:36,737 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 07:20:36,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:25:42,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:30:22,622 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 07:30:22,623 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 07:30:22,657 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 07:30:22,679 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 07:30:22,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:35:21,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:40:28,412 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 07:40:38,590 INFO core: Event loop thread started, running loop forever
2026-09-18 07:40:38,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 07:40:38,895 INFO core: _init_accounts coroutine started
2026-09-18 07:40:38,895 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 07:40:38,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:45:05,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:50:11,555 INFO core: Event loop thread started, running loop forever
2026-09-18 07:50:11,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 07:50:11,860 INFO core: _init_accounts coroutine started
2026-09-18 07:50:11,862 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 07:50:11,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 07:50:12,549 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 07:50:12,550 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 07:50:12,550 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-18 07:50:12,551 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 07:50:12,551 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-18 07:50:12,551 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 07:50:12,551 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 07:50:12,551 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 07:50:12,551 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 07:55:18,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 07:55:38,156 INFO core: Event loop thread started, running loop forever
2026-09-18 07:55:38,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 07:55:38,460 INFO core: _init_accounts coroutine started
2026-09-18 07:55:38,463 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 07:55:38,469 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:00:45,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 08:00:46,368 INFO core: Event loop thread started, running loop forever
2026-09-18 08:00:46,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 08:00:46,672 INFO core: _init_accounts coroutine started
2026-09-18 08:00:46,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 08:00:46,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:05:23,939 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 08:05:23,954 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:10:32,674 INFO core: Event loop thread started, running loop forever
2026-09-18 08:10:32,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 08:10:32,979 INFO core: _init_accounts coroutine started
2026-09-18 08:10:32,980 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 08:10:32,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:10:32,998 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 08:10:32,998 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 08:15:34,145 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 08:15:34,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:15:34,149 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 08:20:33,953 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:25:03,835 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 08:25:03,836 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 08:25:03,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:25:03,842 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 08:25:03,844 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 08:30:09,436 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 08:30:32,776 INFO core: Event loop thread started, running loop forever
2026-09-18 08:30:33,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 08:30:33,081 INFO core: _init_accounts coroutine started
2026-09-18 08:30:33,083 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 08:30:33,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:35:24,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:40:11,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:40:11,065 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 08:45:09,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:50:35,926 INFO core: Event loop thread started, running loop forever
2026-09-18 08:50:36,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 08:50:36,232 INFO core: _init_accounts coroutine started
2026-09-18 08:50:36,233 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 08:50:36,240 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 08:55:42,425 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 08:55:50,270 INFO core: Event loop thread started, running loop forever
2026-09-18 08:55:50,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 08:55:50,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:00:15,815 INFO core: _init_accounts coroutine started
2026-09-18 09:00:15,815 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 09:00:15,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:05:21,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 09:05:36,654 INFO core: Event loop thread started, running loop forever
2026-09-18 09:05:36,955 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 09:05:36,959 INFO core: _init_accounts coroutine started
2026-09-18 09:05:36,961 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 09:05:36,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:10:10,773 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 09:10:10,773 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 09:10:10,774 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 09:10:10,775 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 09:10:10,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:15:24,479 INFO core: Event loop thread started, running loop forever
2026-09-18 09:15:24,780 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 09:15:24,785 INFO core: _init_accounts coroutine started
2026-09-18 09:15:24,785 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 09:15:24,791 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:20:27,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:25:33,360 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 09:25:33,360 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 09:25:33,360 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-18 09:25:33,361 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 09:25:33,361 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-18 09:25:33,361 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 09:25:33,361 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 09:25:33,361 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 09:25:33,362 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 09:25:45,973 INFO core: Event loop thread started, running loop forever
2026-09-18 09:25:46,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 09:25:46,279 INFO core: _init_accounts coroutine started
2026-09-18 09:25:46,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 09:25:46,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:30:20,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:30:20,314 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 09:30:20,314 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 09:35:26,244 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 09:35:26,248 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 09:35:26,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:40:32,388 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 09:40:32,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 09:40:32,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 09:40:48,902 INFO core: Event loop thread started, running loop forever
2026-09-18 09:40:49,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 09:40:49,208 INFO core: _init_accounts coroutine started
2026-09-18 09:40:49,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 09:40:49,213 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:45:43,210 INFO core: Event loop thread started, running loop forever
2026-09-18 09:45:43,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 09:45:43,516 INFO core: _init_accounts coroutine started
2026-09-18 09:45:43,517 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 09:45:43,522 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 09:45:43,523 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 09:45:43,524 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 09:45:43,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:50:47,933 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 09:50:47,937 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 09:55:40,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:00:03,522 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 10:00:03,522 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 10:00:03,522 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 10:00:36,550 INFO core: Event loop thread started, running loop forever
2026-09-18 10:00:36,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 10:00:36,855 INFO core: _init_accounts coroutine started
2026-09-18 10:00:36,856 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 10:00:36,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:05:22,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:10:14,095 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 10:10:14,096 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 10:10:14,103 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 10:10:14,106 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 10:10:14,107 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:15:14,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:20:04,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:25:06,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:30:05,858 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 10:30:05,859 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 10:30:06,015 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:35:13,367 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 10:35:13,368 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 10:35:46,037 INFO core: Event loop thread started, running loop forever
2026-09-18 10:35:46,338 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 10:35:46,343 INFO core: _init_accounts coroutine started
2026-09-18 10:35:46,343 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 10:35:46,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:40:40,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:45:47,384 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 10:45:49,190 INFO core: Event loop thread started, running loop forever
2026-09-18 10:45:49,492 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 10:45:49,496 INFO core: _init_accounts coroutine started
2026-09-18 10:45:49,498 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 10:45:49,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:45:49,506 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 10:45:49,510 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 10:45:49,511 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 10:45:49,512 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 10:50:44,316 INFO core: Event loop thread started, running loop forever
2026-09-18 10:50:44,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 10:50:44,622 INFO core: _init_accounts coroutine started
2026-09-18 10:50:44,622 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 10:50:44,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 10:50:55,342 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 10:50:55,342 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 10:50:55,342 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 10:55:08,356 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 10:55:08,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:00:16,022 INFO core: Event loop thread started, running loop forever
2026-09-18 11:00:16,323 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 11:00:16,326 INFO core: _init_accounts coroutine started
2026-09-18 11:00:16,329 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 11:00:16,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:05:23,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 11:05:39,592 INFO core: Event loop thread started, running loop forever
2026-09-18 11:05:39,893 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 11:05:39,897 INFO core: _init_accounts coroutine started
2026-09-18 11:05:39,899 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 11:05:39,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:10:50,493 INFO core: Event loop thread started, running loop forever
2026-09-18 11:10:50,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 11:10:50,801 INFO core: _init_accounts coroutine started
2026-09-18 11:10:50,801 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 11:10:50,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:15:15,050 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 11:15:15,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:20:33,751 INFO core: Event loop thread started, running loop forever
2026-09-18 11:20:34,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 11:20:34,057 INFO core: _init_accounts coroutine started
2026-09-18 11:20:34,059 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 11:20:34,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:25:40,364 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 11:25:42,731 INFO core: Event loop thread started, running loop forever
2026-09-18 11:25:43,034 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 11:25:43,038 INFO core: _init_accounts coroutine started
2026-09-18 11:25:43,040 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 11:25:43,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:30:38,834 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 11:30:38,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:35:46,247 INFO core: Event loop thread started, running loop forever
2026-09-18 11:35:46,549 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 11:35:46,554 INFO core: _init_accounts coroutine started
2026-09-18 11:35:46,555 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 11:35:46,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:40:34,384 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:45:06,825 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 11:45:06,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:50:50,321 INFO core: Event loop thread started, running loop forever
2026-09-18 11:50:50,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 11:50:50,626 INFO core: _init_accounts coroutine started
2026-09-18 11:50:50,627 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 11:50:50,639 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 11:50:50,639 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 11:50:50,640 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 11:50:50,642 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 11:50:50,645 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 11:55:26,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:00:15,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:05:35,746 INFO core: Event loop thread started, running loop forever
2026-09-18 12:05:36,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 12:05:36,052 INFO core: _init_accounts coroutine started
2026-09-18 12:05:36,056 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 12:05:36,063 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 12:05:36,063 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 12:05:36,064 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 12:05:36,066 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 12:05:36,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:05:36,081 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 12:05:36,081 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 12:05:36,085 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 12:10:42,425 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 12:10:49,925 INFO core: Event loop thread started, running loop forever
2026-09-18 12:10:50,225 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 12:10:50,232 INFO core: _init_accounts coroutine started
2026-09-18 12:10:50,232 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 12:10:50,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:15:50,475 INFO core: Event loop thread started, running loop forever
2026-09-18 12:15:50,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 12:15:50,778 INFO core: _init_accounts coroutine started
2026-09-18 12:15:50,780 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 12:15:50,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:20:47,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:25:12,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:30:19,178 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 12:30:42,112 INFO core: Event loop thread started, running loop forever
2026-09-18 12:30:42,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 12:30:42,417 INFO core: _init_accounts coroutine started
2026-09-18 12:30:42,418 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 12:30:42,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:35:39,222 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 12:35:39,222 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 12:35:39,224 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 12:35:39,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:35:39,226 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 12:40:18,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:45:25,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 12:45:30,314 INFO core: Event loop thread started, running loop forever
2026-09-18 12:45:30,616 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 12:45:30,619 INFO core: _init_accounts coroutine started
2026-09-18 12:45:30,622 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 12:45:30,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:50:37,399 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-18 12:50:47,389 INFO core: Event loop thread started, running loop forever
2026-09-18 12:50:47,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 12:50:47,693 INFO core: _init_accounts coroutine started
2026-09-18 12:50:47,694 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 12:50:47,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 12:55:52,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 12:55:52,474 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 12:55:52,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:00:06,913 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 13:00:06,928 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 13:00:06,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:05:12,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 13:05:14,723 INFO core: Event loop thread started, running loop forever
2026-09-18 13:05:15,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 13:05:15,029 INFO core: _init_accounts coroutine started
2026-09-18 13:05:15,030 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 13:05:15,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:10:15,682 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 13:10:15,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:15:16,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:20:30,466 INFO core: Event loop thread started, running loop forever
2026-09-18 13:20:30,767 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 13:20:30,770 INFO core: _init_accounts coroutine started
2026-09-18 13:20:30,771 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 13:20:30,782 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 13:20:30,782 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 13:20:30,783 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 13:20:30,784 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 13:20:30,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:25:40,341 INFO core: Event loop thread started, running loop forever
2026-09-18 13:25:40,642 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 13:25:40,645 INFO core: _init_accounts coroutine started
2026-09-18 13:25:40,646 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 13:25:40,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:30:17,347 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 13:30:17,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:35:37,332 INFO core: Event loop thread started, running loop forever
2026-09-18 13:35:37,634 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 13:35:37,637 INFO core: _init_accounts coroutine started
2026-09-18 13:35:37,638 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 13:35:37,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:40:35,890 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 13:40:35,890 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 13:40:35,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:45:52,845 INFO core: Event loop thread started, running loop forever
2026-09-18 13:45:53,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 13:45:53,149 INFO core: _init_accounts coroutine started
2026-09-18 13:45:53,150 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 13:45:53,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:50:37,909 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 13:50:37,909 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 13:50:37,910 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 13:50:37,912 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 13:50:37,921 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 13:50:37,921 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 13:50:37,925 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 13:50:37,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 13:50:37,926 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 13:55:04,310 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 13:55:04,310 WARNING core: Account 2: connect timed out after 35s
2026-09-18 13:55:04,311 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 13:55:04,311 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 13:55:04,312 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 13:55:04,313 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 13:55:04,314 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 13:55:04,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:00:11,405 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 14:00:21,628 INFO core: Event loop thread started, running loop forever
2026-09-18 14:00:21,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 14:00:21,933 INFO core: _init_accounts coroutine started
2026-09-18 14:00:21,933 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 14:00:21,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:05:27,400 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 14:05:27,400 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 14:05:27,400 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-18 14:05:27,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 14:05:27,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-18 14:05:27,401 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 14:05:27,401 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 14:05:27,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 14:05:27,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 14:05:52,888 INFO core: Event loop thread started, running loop forever
2026-09-18 14:05:53,189 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 14:05:53,197 INFO core: _init_accounts coroutine started
2026-09-18 14:05:53,198 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 14:05:53,205 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:10:49,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:15:12,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:20:18,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 14:20:23,901 INFO core: Event loop thread started, running loop forever
2026-09-18 14:20:24,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 14:20:24,214 INFO core: _init_accounts coroutine started
2026-09-18 14:20:24,216 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 14:20:24,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:25:36,115 INFO core: Event loop thread started, running loop forever
2026-09-18 14:25:36,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 14:25:36,421 INFO core: _init_accounts coroutine started
2026-09-18 14:25:36,423 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 14:25:36,428 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:30:05,351 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 14:30:13,587 INFO core: Event loop thread started, running loop forever
2026-09-18 14:30:13,888 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 14:30:13,894 INFO core: _init_accounts coroutine started
2026-09-18 14:30:13,896 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 14:30:13,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:35:17,045 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:40:46,196 INFO core: Event loop thread started, running loop forever
2026-09-18 14:40:46,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 14:40:46,500 INFO core: _init_accounts coroutine started
2026-09-18 14:40:46,501 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 14:40:46,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:45:05,414 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 14:45:05,415 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 14:45:05,416 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:45:05,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 14:50:33,715 INFO core: Event loop thread started, running loop forever
2026-09-18 14:50:34,018 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 14:50:34,022 INFO core: _init_accounts coroutine started
2026-09-18 14:50:34,023 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 14:50:34,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 14:55:24,116 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 14:55:24,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:00:46,198 INFO core: Event loop thread started, running loop forever
2026-09-18 15:00:46,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 15:00:46,505 INFO core: _init_accounts coroutine started
2026-09-18 15:00:46,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 15:00:46,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:05:22,874 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 15:05:22,875 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 15:05:22,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:10:20,943 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 15:10:20,947 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 15:10:20,956 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 15:10:20,956 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 15:10:20,960 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 15:10:20,961 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 15:10:20,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:15:13,778 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 15:15:13,779 WARNING core: Account 2: connect timed out after 35s
2026-09-18 15:15:13,779 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 15:15:13,780 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 15:15:13,780 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 15:15:13,781 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 15:15:13,782 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 15:15:13,784 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:20:19,375 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 15:20:27,859 INFO core: Event loop thread started, running loop forever
2026-09-18 15:20:28,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 15:20:28,164 INFO core: _init_accounts coroutine started
2026-09-18 15:20:28,165 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 15:20:28,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:25:38,345 INFO core: Event loop thread started, running loop forever
2026-09-18 15:25:38,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 15:25:38,650 INFO core: _init_accounts coroutine started
2026-09-18 15:25:38,650 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 15:25:38,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:30:40,859 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 15:30:40,859 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 15:30:40,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:35:03,885 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 15:35:03,885 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 15:35:03,897 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 15:35:03,907 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:40:09,410 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 15:40:34,190 INFO core: Event loop thread started, running loop forever
2026-09-18 15:40:34,491 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 15:40:34,497 INFO core: _init_accounts coroutine started
2026-09-18 15:40:34,497 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 15:40:34,503 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:45:15,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:50:21,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 15:50:27,540 INFO core: Event loop thread started, running loop forever
2026-09-18 15:50:27,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 15:50:27,847 INFO core: _init_accounts coroutine started
2026-09-18 15:50:27,847 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 15:50:27,858 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 15:55:34,442 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 15:55:37,192 INFO core: Event loop thread started, running loop forever
2026-09-18 15:55:37,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 15:55:37,496 INFO core: _init_accounts coroutine started
2026-09-18 15:55:37,498 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 15:55:37,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:00:44,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 16:00:46,277 INFO core: Event loop thread started, running loop forever
2026-09-18 16:00:46,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 16:00:46,584 INFO core: _init_accounts coroutine started
2026-09-18 16:00:46,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:00:46,593 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 16:05:36,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:10:12,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:15:50,210 INFO core: Event loop thread started, running loop forever
2026-09-18 16:15:50,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 16:15:50,514 INFO core: _init_accounts coroutine started
2026-09-18 16:15:50,520 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:15:50,524 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 16:20:10,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:25:36,165 INFO core: Event loop thread started, running loop forever
2026-09-18 16:25:36,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 16:25:36,469 INFO core: _init_accounts coroutine started
2026-09-18 16:25:36,471 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 16:25:36,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:30:22,394 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 16:30:22,429 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:35:17,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:40:06,158 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-18 16:40:06,159 INFO core: _init_accounts coroutine started
2026-09-18 16:40:06,159 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 16:40:06,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:45:02,430 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 16:45:02,431 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 16:45:02,431 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-18 16:45:02,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 16:45:02,431 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-18 16:45:02,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 16:45:02,432 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 16:45:02,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 16:45:02,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 16:45:26,031 INFO core: Event loop thread started, running loop forever
2026-09-18 16:45:26,332 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 16:45:26,335 INFO core: _init_accounts coroutine started
2026-09-18 16:45:26,336 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 16:45:26,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:50:33,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 16:50:51,980 INFO core: Event loop thread started, running loop forever
2026-09-18 16:50:52,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 16:50:52,284 INFO core: _init_accounts coroutine started
2026-09-18 16:50:52,285 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 16:50:52,302 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 16:50:52,302 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 16:50:52,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:50:52,303 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 16:50:52,307 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 16:55:35,942 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 16:55:35,945 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 17:00:14,153 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 17:00:14,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:05:30,892 INFO core: Event loop thread started, running loop forever
2026-09-18 17:05:31,193 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 17:05:31,197 INFO core: _init_accounts coroutine started
2026-09-18 17:05:31,199 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 17:05:31,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:10:25,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:15:23,108 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 17:15:23,108 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 17:15:23,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 17:15:23,111 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 17:15:23,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:20:30,396 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 17:20:30,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 17:20:30,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 17:20:39,110 INFO core: Event loop thread started, running loop forever
2026-09-18 17:20:39,411 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 17:20:39,414 INFO core: _init_accounts coroutine started
2026-09-18 17:20:39,416 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 17:20:39,422 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:25:16,010 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 17:25:16,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:30:35,153 INFO core: Event loop thread started, running loop forever
2026-09-18 17:30:35,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 17:30:35,458 INFO core: _init_accounts coroutine started
2026-09-18 17:30:35,460 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 17:30:35,470 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 17:30:35,470 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 17:30:35,471 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 17:30:35,473 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 17:30:35,485 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 17:30:35,485 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 17:30:35,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:35:26,467 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 17:35:26,469 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 17:35:26,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:40:33,372 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 17:40:33,373 WARNING core: Account 2: connect timed out after 35s
2026-09-18 17:40:33,374 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 17:40:33,374 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 17:40:33,374 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 17:40:33,375 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 17:40:33,375 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 17:40:40,187 INFO core: Event loop thread started, running loop forever
2026-09-18 17:40:40,488 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 17:40:40,491 INFO core: _init_accounts coroutine started
2026-09-18 17:40:40,492 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 17:40:40,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:45:41,487 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 17:45:41,495 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:50:47,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 17:55:29,332 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-18 17:55:29,333 INFO core: _init_accounts coroutine started
2026-09-18 17:55:29,334 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 17:55:29,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:00:27,588 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 18:00:27,588 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 18:00:27,589 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 18:00:27,590 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 18:00:27,602 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 18:00:27,603 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 18:00:27,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:05:25,318 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 18:05:25,319 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 18:05:25,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:10:25,098 INFO core: Event loop thread started, running loop forever
2026-09-18 18:10:25,399 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 18:10:25,402 INFO core: _init_accounts coroutine started
2026-09-18 18:10:25,404 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 18:10:25,415 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-18 18:10:25,426 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-18 18:10:32,101 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 18:15:39,650 INFO core: Event loop thread started, running loop forever
2026-09-18 18:15:39,951 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 18:15:39,954 INFO core: _init_accounts coroutine started
2026-09-18 18:15:39,956 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 18:15:39,960 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:20:35,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:25:16,124 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 18:25:16,124 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 18:25:16,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:30:21,570 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 18:30:21,571 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 18:30:21,575 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 18:30:21,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:35:12,592 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:40:06,080 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 18:40:06,080 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 18:40:06,086 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 18:40:06,086 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 18:40:06,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:45:12,420 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 18:45:12,420 WARNING core: Account 2: connect timed out after 35s
2026-09-18 18:45:12,420 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 18:45:12,421 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 18:45:12,421 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 18:45:12,422 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 18:45:12,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 18:45:14,388 INFO core: Event loop thread started, running loop forever
2026-09-18 18:45:14,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 18:45:14,695 INFO core: _init_accounts coroutine started
2026-09-18 18:45:14,696 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 18:45:14,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:50:20,971 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 18:50:31,297 INFO core: Event loop thread started, running loop forever
2026-09-18 18:50:31,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 18:50:31,601 INFO core: _init_accounts coroutine started
2026-09-18 18:50:31,604 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 18:50:31,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 18:55:44,760 INFO core: Event loop thread started, running loop forever
2026-09-18 18:55:45,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 18:55:45,065 INFO core: _init_accounts coroutine started
2026-09-18 18:55:45,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 18:55:45,073 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:00:04,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 19:00:04,415 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 19:00:04,415 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-18 19:00:04,416 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 19:00:04,416 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-18 19:00:04,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 19:00:04,416 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-18 19:00:04,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 19:00:04,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 19:00:45,769 INFO core: Event loop thread started, running loop forever
2026-09-18 19:00:46,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 19:00:46,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:05:22,598 INFO core: _init_accounts coroutine started
2026-09-18 19:05:22,599 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 19:05:22,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:10:41,567 INFO core: Event loop thread started, running loop forever
2026-09-18 19:10:41,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 19:10:41,872 INFO core: _init_accounts coroutine started
2026-09-18 19:10:41,874 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 19:10:41,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:15:14,929 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 19:15:14,942 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:20:42,151 INFO core: Event loop thread started, running loop forever
2026-09-18 19:20:42,452 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 19:20:42,455 INFO core: _init_accounts coroutine started
2026-09-18 19:20:42,457 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 19:20:42,474 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:25:36,104 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 19:25:36,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:30:45,225 INFO core: Event loop thread started, running loop forever
2026-09-18 19:30:45,527 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 19:30:45,530 INFO core: _init_accounts coroutine started
2026-09-18 19:30:45,531 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 19:30:45,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:35:38,302 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 19:35:38,302 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 19:35:38,305 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 19:35:38,306 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 19:35:38,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:40:05,002 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:45:12,371 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 19:45:12,372 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 19:45:44,024 INFO core: Event loop thread started, running loop forever
2026-09-18 19:45:44,324 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 19:45:44,328 INFO core: _init_accounts coroutine started
2026-09-18 19:45:44,330 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 19:45:44,337 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:50:41,070 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 19:50:41,071 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 19:50:41,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 19:55:41,193 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 19:55:41,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:00:34,315 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 20:00:34,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:05:07,643 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 20:05:07,643 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 20:05:07,649 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 20:05:07,650 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 20:05:07,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:10:13,369 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 20:10:26,449 INFO core: Event loop thread started, running loop forever
2026-09-18 20:10:26,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 20:10:26,754 INFO core: _init_accounts coroutine started
2026-09-18 20:10:26,755 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 20:10:26,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:15:15,532 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 20:15:15,533 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 20:15:15,535 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 20:15:15,537 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 20:15:15,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:20:26,248 INFO core: Event loop thread started, running loop forever
2026-09-18 20:20:26,549 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 20:20:26,552 INFO core: _init_accounts coroutine started
2026-09-18 20:20:26,554 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 20:20:26,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:20:26,564 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 20:20:26,564 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 20:20:26,565 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 20:20:26,566 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 20:25:07,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:25:07,528 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 20:25:07,528 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 20:30:14,391 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 20:30:14,392 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 20:30:30,902 INFO core: Event loop thread started, running loop forever
2026-09-18 20:30:31,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 20:30:31,207 INFO core: _init_accounts coroutine started
2026-09-18 20:30:31,209 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 20:30:31,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:35:37,367 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 20:35:46,283 INFO core: Event loop thread started, running loop forever
2026-09-18 20:35:46,585 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 20:35:46,588 INFO core: _init_accounts coroutine started
2026-09-18 20:35:46,590 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 20:35:46,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:40:33,901 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 20:40:33,901 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 20:40:33,907 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 20:40:33,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:45:34,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:50:13,755 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 20:50:13,778 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 20:50:13,778 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 20:50:13,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 20:55:05,359 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 20:55:05,361 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 20:55:05,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:00:12,401 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 21:00:12,402 WARNING core: Account 2: connect timed out after 35s
2026-09-18 21:00:12,403 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 21:00:12,403 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 21:00:12,404 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 21:00:12,405 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 21:00:12,405 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 21:00:37,815 INFO core: Event loop thread started, running loop forever
2026-09-18 21:00:38,116 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:00:38,120 INFO core: _init_accounts coroutine started
2026-09-18 21:00:38,120 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:00:38,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:05:25,372 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:10:32,469 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 21:10:46,302 INFO core: Event loop thread started, running loop forever
2026-09-18 21:10:46,603 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:10:46,607 INFO core: _init_accounts coroutine started
2026-09-18 21:10:46,608 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:10:46,616 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:15:03,325 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 21:15:10,543 INFO core: Event loop thread started, running loop forever
2026-09-18 21:15:10,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:15:10,847 INFO core: _init_accounts coroutine started
2026-09-18 21:15:10,848 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:15:10,854 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:20:52,843 INFO core: Event loop thread started, running loop forever
2026-09-18 21:20:53,144 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:20:53,147 INFO core: _init_accounts coroutine started
2026-09-18 21:20:53,148 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:20:53,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:25:48,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:30:22,656 INFO core: Event loop thread started, running loop forever
2026-09-18 21:30:22,957 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:30:22,960 INFO core: _init_accounts coroutine started
2026-09-18 21:30:22,962 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:30:22,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:30:54,704 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 21:30:54,705 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 21:30:54,706 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-18 21:35:42,623 INFO core: Event loop thread started, running loop forever
2026-09-18 21:35:42,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:35:42,929 INFO core: _init_accounts coroutine started
2026-09-18 21:35:42,930 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:35:42,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:40:48,444 INFO core: Event loop thread started, running loop forever
2026-09-18 21:40:48,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:40:48,748 INFO core: _init_accounts coroutine started
2026-09-18 21:40:48,750 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:40:48,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:45:29,268 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 21:45:29,268 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 21:45:29,270 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 21:45:29,271 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 21:45:29,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:50:44,631 INFO core: Event loop thread started, running loop forever
2026-09-18 21:50:44,932 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 21:50:44,935 INFO core: _init_accounts coroutine started
2026-09-18 21:50:44,936 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 21:50:44,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 21:55:45,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:00:36,565 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 22:00:36,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:05:40,438 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:10:36,298 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-18 22:10:36,299 INFO core: _init_accounts coroutine started
2026-09-18 22:10:36,300 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 22:10:36,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:10:36,305 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 22:10:36,309 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 22:10:36,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 22:15:42,214 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 22:15:42,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:20:12,672 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 22:20:12,673 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-18 22:20:12,677 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-18 22:20:12,677 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-18 22:20:12,683 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:25:19,377 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-18 22:25:19,378 WARNING core: Account 2: connect timed out after 35s
2026-09-18 22:25:19,378 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-18 22:25:19,378 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-18 22:25:19,379 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-18 22:25:19,380 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-18 22:25:19,380 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-18 22:25:22,136 INFO core: Event loop thread started, running loop forever
2026-09-18 22:25:22,437 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 22:25:22,441 INFO core: _init_accounts coroutine started
2026-09-18 22:25:22,442 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 22:25:22,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:30:12,484 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 22:30:12,505 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:35:21,367 INFO core: Event loop thread started, running loop forever
2026-09-18 22:35:21,668 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 22:35:21,673 INFO core: _init_accounts coroutine started
2026-09-18 22:35:21,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 22:35:21,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:40:05,204 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:40:05,205 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 22:40:05,205 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 22:45:26,338 INFO core: Event loop thread started, running loop forever
2026-09-18 22:45:26,639 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 22:45:26,645 INFO core: _init_accounts coroutine started
2026-09-18 22:45:26,646 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 22:45:26,650 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:50:33,405 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 22:50:44,260 INFO core: Event loop thread started, running loop forever
2026-09-18 22:50:44,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 22:50:44,564 INFO core: _init_accounts coroutine started
2026-09-18 22:50:44,566 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 22:50:44,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 22:55:10,019 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-18 22:55:10,031 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:00:35,855 INFO core: Event loop thread started, running loop forever
2026-09-18 23:00:36,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 23:00:36,160 INFO core: _init_accounts coroutine started
2026-09-18 23:00:36,161 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 23:00:36,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:05:29,101 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:10:34,268 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:15:51,177 INFO core: Event loop thread started, running loop forever
2026-09-18 23:15:51,478 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 23:15:51,483 INFO core: _init_accounts coroutine started
2026-09-18 23:15:51,485 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 23:15:51,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:20:37,891 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 23:20:37,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 23:20:37,893 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 23:20:37,900 INFO core: _init_accounts_inner: reloading LLM config
2026-09-18 23:20:37,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:25:44,439 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-18 23:25:47,660 INFO core: Event loop thread started, running loop forever
2026-09-18 23:25:47,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 23:25:47,965 INFO core: _init_accounts coroutine started
2026-09-18 23:25:47,966 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 23:25:47,975 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:30:05,316 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-18 23:30:10,824 INFO core: Event loop thread started, running loop forever
2026-09-18 23:30:11,126 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 23:30:11,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:35:34,495 INFO core: Event loop thread started, running loop forever
2026-09-18 23:35:34,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 23:35:34,807 INFO core: _init_accounts coroutine started
2026-09-18 23:35:34,808 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 23:35:34,813 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:40:19,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:40:19,207 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 23:40:19,208 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 23:45:13,157 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 23:45:13,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:50:43,823 INFO core: Event loop thread started, running loop forever
2026-09-18 23:50:44,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-18 23:50:44,128 INFO core: _init_accounts coroutine started
2026-09-18 23:50:44,130 INFO core: _init_accounts_inner: starting DB migrations
2026-09-18 23:50:44,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-18 23:55:28,908 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-18 23:55:28,908 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-18 23:55:28,911 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-18 23:55:28,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:00:28,171 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:05:08,735 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 00:05:08,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:10:44,344 INFO core: Event loop thread started, running loop forever
2026-09-19 00:10:44,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 00:10:44,647 INFO core: _init_accounts coroutine started
2026-09-19 00:10:44,649 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 00:10:44,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:15:43,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:20:44,291 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 00:20:44,292 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 00:20:44,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:25:45,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:30:50,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:35:32,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 00:35:32,447 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 00:35:32,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:40:37,347 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:45:14,261 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 00:45:14,261 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 00:45:14,270 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 00:45:14,271 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 00:45:14,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:50:30,602 INFO core: Event loop thread started, running loop forever
2026-09-19 00:50:30,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 00:50:30,908 INFO core: _init_accounts coroutine started
2026-09-19 00:50:30,909 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 00:50:30,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 00:50:30,925 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 00:50:30,925 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 00:50:30,926 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 00:55:36,369 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 00:55:36,369 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 00:55:36,370 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 00:55:36,370 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 00:55:36,589 INFO core: Event loop thread started, running loop forever
2026-09-19 00:55:36,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 00:55:36,895 INFO core: _init_accounts coroutine started
2026-09-19 00:55:36,895 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 00:55:36,901 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:00:38,823 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 01:00:38,824 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 01:00:38,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:05:42,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 01:05:42,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:10:49,428 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 01:10:49,429 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 01:10:49,430 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 01:10:49,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 01:10:52,357 INFO core: Event loop thread started, running loop forever
2026-09-19 01:10:52,658 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 01:10:52,662 INFO core: _init_accounts coroutine started
2026-09-19 01:10:52,665 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 01:10:52,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:15:21,851 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 01:15:21,852 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 01:15:21,855 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 01:15:21,858 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 01:15:21,873 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 01:15:21,873 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 01:15:21,878 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 01:15:21,879 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 01:15:21,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:20:27,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 01:20:27,416 WARNING core: Account 2: connect timed out after 35s
2026-09-19 01:20:27,417 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 01:20:27,417 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 01:20:27,418 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 01:20:27,419 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 01:20:27,419 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 01:20:51,444 INFO core: Event loop thread started, running loop forever
2026-09-19 01:20:51,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 01:20:51,749 INFO core: _init_accounts coroutine started
2026-09-19 01:20:51,751 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 01:20:51,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:25:45,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:30:22,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:35:16,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:40:12,583 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 01:40:12,583 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 01:40:12,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:45:04,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 01:45:04,421 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-19 01:45:04,423 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 01:45:04,423 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 01:45:04,423 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 01:45:04,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 01:45:52,708 INFO core: Event loop thread started, running loop forever
2026-09-19 01:45:53,009 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 01:45:53,013 INFO core: _init_accounts coroutine started
2026-09-19 01:45:53,014 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 01:45:53,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:50:50,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 01:55:06,020 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:00:18,423 INFO core: Event loop thread started, running loop forever
2026-09-19 02:00:18,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 02:00:18,728 INFO core: _init_accounts coroutine started
2026-09-19 02:00:18,730 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 02:00:18,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:05:24,411 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:10:30,510 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 02:10:40,889 INFO core: Event loop thread started, running loop forever
2026-09-19 02:10:41,190 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 02:10:41,195 INFO core: _init_accounts coroutine started
2026-09-19 02:10:41,199 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 02:10:41,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:15:09,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:20:07,342 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 02:20:07,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:25:34,196 INFO core: Event loop thread started, running loop forever
2026-09-19 02:25:34,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 02:25:34,502 INFO core: _init_accounts coroutine started
2026-09-19 02:25:34,505 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 02:25:34,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:30:19,939 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 02:30:19,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:35:24,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:40:13,474 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 02:40:13,476 INFO core: _init_accounts coroutine started
2026-09-19 02:40:13,477 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 02:40:13,480 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:45:20,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 02:45:22,180 INFO core: Event loop thread started, running loop forever
2026-09-19 02:45:22,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 02:45:22,486 INFO core: _init_accounts coroutine started
2026-09-19 02:45:22,489 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 02:45:22,503 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:45:22,512 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 02:45:22,512 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 02:45:22,513 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 02:45:22,517 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 02:50:18,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 02:55:25,404 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 02:55:42,685 INFO core: Event loop thread started, running loop forever
2026-09-19 02:55:42,986 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 02:55:42,989 INFO core: _init_accounts coroutine started
2026-09-19 02:55:42,990 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 02:55:43,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:00:39,487 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:05:16,597 INFO core: Event loop thread started, running loop forever
2026-09-19 03:05:16,898 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 03:05:16,906 INFO core: _init_accounts coroutine started
2026-09-19 03:05:16,906 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 03:05:16,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:10:40,112 INFO core: Event loop thread started, running loop forever
2026-09-19 03:10:40,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 03:10:40,416 INFO core: _init_accounts coroutine started
2026-09-19 03:10:40,419 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 03:10:40,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:15:23,899 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 03:15:23,899 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 03:15:23,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:20:14,932 INFO core: Event loop thread started, running loop forever
2026-09-19 03:20:15,233 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 03:20:15,237 INFO core: _init_accounts coroutine started
2026-09-19 03:20:15,238 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 03:20:15,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:20:30,939 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 03:25:22,406 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-19 03:25:28,484 INFO core: Event loop thread started, running loop forever
2026-09-19 03:25:28,785 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 03:25:28,788 INFO core: _init_accounts coroutine started
2026-09-19 03:25:28,790 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 03:25:28,796 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:30:35,200 INFO core: Event loop thread started, running loop forever
2026-09-19 03:30:35,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 03:30:35,505 INFO core: _init_accounts coroutine started
2026-09-19 03:30:35,509 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 03:30:35,516 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:35:20,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:40:27,442 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 03:40:27,444 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 03:40:27,445 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-19 03:40:27,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 03:40:46,932 INFO core: Event loop thread started, running loop forever
2026-09-19 03:40:47,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 03:40:47,238 INFO core: _init_accounts coroutine started
2026-09-19 03:40:47,238 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 03:40:47,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:45:13,004 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 03:45:13,005 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 03:45:13,006 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 03:45:13,009 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 03:45:13,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:45:13,026 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 03:45:13,026 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 03:45:13,030 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 03:45:13,031 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 03:50:50,438 INFO core: Event loop thread started, running loop forever
2026-09-19 03:50:50,745 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 03:50:50,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 03:55:11,768 INFO core: _init_accounts coroutine started
2026-09-19 03:55:11,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 03:55:11,778 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:00:04,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 04:00:29,153 INFO core: Event loop thread started, running loop forever
2026-09-19 04:00:29,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 04:00:29,458 INFO core: _init_accounts coroutine started
2026-09-19 04:00:29,458 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 04:00:29,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:05:05,026 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 04:05:05,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:10:12,621 INFO core: Event loop thread started, running loop forever
2026-09-19 04:10:12,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 04:10:12,927 INFO core: _init_accounts coroutine started
2026-09-19 04:10:12,928 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 04:10:12,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:15:09,828 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 04:15:09,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:20:13,578 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:25:19,284 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 04:25:19,285 INFO core: _init_accounts coroutine started
2026-09-19 04:25:19,286 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 04:25:19,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:30:06,436 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 04:30:06,437 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 04:30:06,457 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 04:30:06,488 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 04:30:06,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:35:12,530 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 04:35:12,531 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 04:35:12,531 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 04:35:21,673 INFO core: Event loop thread started, running loop forever
2026-09-19 04:35:21,976 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 04:35:21,986 INFO core: _init_accounts coroutine started
2026-09-19 04:35:21,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:35:21,999 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 04:40:17,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:45:16,168 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:50:23,448 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 04:50:23,448 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 04:50:23,449 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-19 04:50:23,450 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 04:50:23,450 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-19 04:50:23,450 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 04:50:23,450 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 04:50:23,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 04:50:23,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 04:50:35,098 INFO core: Event loop thread started, running loop forever
2026-09-19 04:50:35,399 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 04:50:35,404 INFO core: _init_accounts coroutine started
2026-09-19 04:50:35,405 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 04:50:35,411 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 04:55:42,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 04:55:47,536 INFO core: Event loop thread started, running loop forever
2026-09-19 04:55:47,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 04:55:47,840 INFO core: _init_accounts coroutine started
2026-09-19 04:55:47,841 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 04:55:47,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:00:36,717 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 05:00:36,717 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 05:00:36,722 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 05:00:36,724 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:00:36,724 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 05:05:09,845 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:10:40,968 INFO core: Event loop thread started, running loop forever
2026-09-19 05:10:41,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 05:10:41,273 INFO core: _init_accounts coroutine started
2026-09-19 05:10:41,275 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 05:10:41,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:10:41,286 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 05:10:41,288 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 05:15:16,518 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 05:15:16,522 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 05:15:16,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:20:50,525 INFO core: Event loop thread started, running loop forever
2026-09-19 05:20:50,826 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 05:20:50,830 INFO core: _init_accounts coroutine started
2026-09-19 05:20:50,832 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 05:20:50,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:20:50,842 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 05:20:50,844 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 05:25:43,823 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 05:25:43,826 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 05:25:43,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:30:21,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:35:09,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:40:05,894 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:45:10,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:50:17,398 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 05:50:17,399 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 05:50:17,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 05:50:36,237 INFO core: Event loop thread started, running loop forever
2026-09-19 05:50:36,538 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 05:50:36,545 INFO core: _init_accounts coroutine started
2026-09-19 05:50:36,546 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 05:50:36,557 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 05:50:36,557 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 05:50:36,564 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 05:50:36,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 05:55:19,064 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 05:55:19,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:00:33,883 INFO core: Event loop thread started, running loop forever
2026-09-19 06:00:34,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 06:00:34,187 INFO core: _init_accounts coroutine started
2026-09-19 06:00:34,189 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 06:00:34,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:05:48,188 INFO core: Event loop thread started, running loop forever
2026-09-19 06:05:48,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 06:05:48,494 INFO core: _init_accounts coroutine started
2026-09-19 06:05:48,495 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 06:05:48,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:10:07,337 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 06:10:07,337 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 06:10:07,338 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 06:10:07,340 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 06:10:07,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:15:04,374 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 06:15:18,728 INFO core: Event loop thread started, running loop forever
2026-09-19 06:15:19,029 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 06:15:19,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:20:19,896 INFO core: _init_accounts coroutine started
2026-09-19 06:20:19,897 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 06:20:19,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:25:26,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 06:25:44,517 INFO core: Event loop thread started, running loop forever
2026-09-19 06:25:44,818 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 06:25:44,827 INFO core: _init_accounts coroutine started
2026-09-19 06:25:44,827 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 06:25:44,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:30:29,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:35:35,439 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 06:35:45,237 INFO core: Event loop thread started, running loop forever
2026-09-19 06:35:45,538 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 06:35:45,544 INFO core: _init_accounts coroutine started
2026-09-19 06:35:45,544 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 06:35:45,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:35:45,561 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 06:35:45,561 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 06:40:45,272 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 06:40:45,283 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 06:40:45,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:45:29,813 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 06:45:29,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:45:29,816 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 06:50:34,907 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 06:50:34,909 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 06:50:34,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 06:55:04,218 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 06:55:04,219 WARNING core: Account 2: connect timed out after 35s
2026-09-19 06:55:04,220 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 06:55:04,220 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 06:55:04,221 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 06:55:04,223 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 06:55:04,223 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 06:55:04,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:00:11,481 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 07:00:11,485 WARNING core: Account 2: connect timed out after 35s
2026-09-19 07:00:11,485 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-19 07:00:11,486 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-19 07:00:11,486 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 07:00:11,487 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-19 07:00:11,487 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-19 07:00:19,668 INFO core: Event loop thread started, running loop forever
2026-09-19 07:00:19,969 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 07:00:19,981 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:00:19,981 INFO core: _init_accounts coroutine started
2026-09-19 07:00:19,983 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 07:05:34,344 INFO core: Event loop thread started, running loop forever
2026-09-19 07:05:34,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 07:05:34,650 INFO core: _init_accounts coroutine started
2026-09-19 07:05:34,652 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 07:05:34,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:10:39,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:15:15,937 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 07:15:15,938 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 07:15:15,950 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 07:15:15,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:20:38,276 INFO core: Event loop thread started, running loop forever
2026-09-19 07:20:38,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 07:20:38,581 INFO core: _init_accounts coroutine started
2026-09-19 07:20:38,583 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 07:20:38,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:25:10,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:30:13,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:35:07,647 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 07:35:07,650 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 07:35:07,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:40:08,924 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 07:40:08,929 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 07:40:08,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:45:53,424 INFO core: Event loop thread started, running loop forever
2026-09-19 07:45:53,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 07:45:53,729 INFO core: _init_accounts coroutine started
2026-09-19 07:45:53,734 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 07:45:53,740 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:50:52,213 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 07:50:52,214 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 07:50:52,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:55:42,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 07:55:42,568 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 08:00:30,325 INFO core: Event loop thread started, running loop forever
2026-09-19 08:00:30,626 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:00:30,630 INFO core: _init_accounts coroutine started
2026-09-19 08:00:30,632 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:00:30,638 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:00:48,349 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 08:00:48,350 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 08:00:48,350 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 08:00:48,351 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 08:05:16,184 INFO core: Event loop thread started, running loop forever
2026-09-19 08:05:16,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:05:16,491 INFO core: _init_accounts coroutine started
2026-09-19 08:05:16,500 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:05:16,501 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:10:35,918 INFO core: Event loop thread started, running loop forever
2026-09-19 08:10:36,219 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:10:36,224 INFO core: _init_accounts coroutine started
2026-09-19 08:10:36,224 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:10:36,234 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:15:42,481 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 08:15:44,109 INFO core: Event loop thread started, running loop forever
2026-09-19 08:15:44,410 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:15:44,416 INFO core: _init_accounts coroutine started
2026-09-19 08:15:44,416 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:15:44,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 08:15:44,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 08:15:44,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:20:21,472 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 08:20:21,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:25:35,552 INFO core: Event loop thread started, running loop forever
2026-09-19 08:25:35,854 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:25:35,858 INFO core: _init_accounts coroutine started
2026-09-19 08:25:35,859 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:25:35,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:30:05,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 08:30:25,093 INFO core: Event loop thread started, running loop forever
2026-09-19 08:30:25,396 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:30:25,399 INFO core: _init_accounts coroutine started
2026-09-19 08:30:25,401 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:30:25,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:35:22,480 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 08:35:22,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 08:35:22,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:40:26,688 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 08:40:26,692 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:45:32,380 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 08:45:51,608 INFO core: Event loop thread started, running loop forever
2026-09-19 08:45:51,911 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:45:51,915 INFO core: _init_accounts coroutine started
2026-09-19 08:45:51,916 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:45:51,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:45:51,932 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 08:45:51,932 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 08:50:17,857 INFO core: Event loop thread started, running loop forever
2026-09-19 08:50:18,158 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 08:50:18,161 INFO core: _init_accounts coroutine started
2026-09-19 08:50:18,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 08:50:18,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 08:55:22,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:00:37,232 INFO core: Event loop thread started, running loop forever
2026-09-19 09:00:37,533 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 09:00:37,536 INFO core: _init_accounts coroutine started
2026-09-19 09:00:37,538 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 09:00:37,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:05:25,405 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 09:05:25,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:10:38,790 INFO core: Event loop thread started, running loop forever
2026-09-19 09:10:39,092 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 09:10:39,097 INFO core: _init_accounts coroutine started
2026-09-19 09:10:39,097 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 09:10:39,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:15:18,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:20:41,574 INFO core: Event loop thread started, running loop forever
2026-09-19 09:20:41,876 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 09:20:41,879 INFO core: _init_accounts coroutine started
2026-09-19 09:20:41,881 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 09:20:41,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:25:43,399 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 09:25:43,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:30:35,592 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:35:15,114 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 09:35:15,115 INFO core: _init_accounts coroutine started
2026-09-19 09:35:15,115 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 09:35:15,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:40:13,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 09:40:13,879 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 09:40:13,883 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 09:40:13,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:45:19,452 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 09:45:43,493 INFO core: Event loop thread started, running loop forever
2026-09-19 09:45:43,794 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 09:45:43,800 INFO core: _init_accounts coroutine started
2026-09-19 09:45:43,800 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 09:45:43,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:50:48,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:50:48,080 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 09:50:48,081 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 09:55:11,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 09:55:11,734 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 10:00:17,472 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 10:00:19,797 INFO core: Event loop thread started, running loop forever
2026-09-19 10:00:20,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 10:00:20,101 INFO core: _init_accounts coroutine started
2026-09-19 10:00:20,103 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 10:00:20,111 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:05:24,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:10:08,928 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 10:10:08,928 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 10:10:08,929 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 10:10:08,931 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 10:10:08,938 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:15:15,467 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 10:15:28,084 INFO core: Event loop thread started, running loop forever
2026-09-19 10:15:28,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 10:15:28,390 INFO core: _init_accounts coroutine started
2026-09-19 10:15:28,391 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 10:15:28,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:20:08,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 10:20:08,458 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 10:20:08,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:20:08,463 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 10:25:26,202 INFO core: Event loop thread started, running loop forever
2026-09-19 10:25:26,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 10:25:26,506 INFO core: _init_accounts coroutine started
2026-09-19 10:25:26,508 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 10:25:26,513 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:30:33,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 10:30:37,157 INFO core: Event loop thread started, running loop forever
2026-09-19 10:30:37,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 10:30:37,470 INFO core: _init_accounts coroutine started
2026-09-19 10:30:37,470 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 10:30:37,472 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:35:47,874 INFO core: Event loop thread started, running loop forever
2026-09-19 10:35:48,175 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 10:35:48,180 INFO core: _init_accounts coroutine started
2026-09-19 10:35:48,181 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 10:35:48,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:40:43,784 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:45:04,335 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 10:45:48,803 INFO core: Event loop thread started, running loop forever
2026-09-19 10:45:49,104 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 10:45:49,107 INFO core: _init_accounts coroutine started
2026-09-19 10:45:49,109 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 10:45:49,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:50:19,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 10:55:26,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 10:55:26,433 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 10:55:26,434 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-19 10:55:26,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 10:55:26,434 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-19 10:55:26,434 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 10:55:26,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 10:55:26,435 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 10:55:26,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 10:55:49,762 INFO core: Event loop thread started, running loop forever
2026-09-19 10:55:50,063 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 10:55:50,068 INFO core: _init_accounts coroutine started
2026-09-19 10:55:50,069 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 10:55:50,073 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:00:20,028 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 11:00:20,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:05:23,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:10:53,748 INFO core: Event loop thread started, running loop forever
2026-09-19 11:10:54,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 11:10:54,061 INFO core: _init_accounts coroutine started
2026-09-19 11:10:54,061 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 11:10:54,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:15:48,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:20:14,096 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 11:20:14,097 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 11:20:14,099 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 11:20:14,101 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:20:14,102 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 11:25:21,422 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 11:25:51,372 INFO core: Event loop thread started, running loop forever
2026-09-19 11:25:51,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 11:25:51,679 INFO core: _init_accounts coroutine started
2026-09-19 11:25:51,680 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 11:25:51,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:30:31,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 11:30:31,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 11:30:31,478 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 11:30:31,479 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 11:30:31,484 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:35:42,654 INFO core: Event loop thread started, running loop forever
2026-09-19 11:35:42,955 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 11:35:42,958 INFO core: _init_accounts coroutine started
2026-09-19 11:35:42,960 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 11:35:42,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:40:35,295 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 11:40:35,295 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 11:40:35,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 11:40:35,298 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 11:40:35,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:45:25,964 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 11:45:25,965 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 11:45:25,970 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 11:45:25,971 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 11:45:25,977 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:50:31,496 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 11:50:31,498 WARNING core: Account 2: connect timed out after 35s
2026-09-19 11:50:32,667 INFO core: Event loop thread started, running loop forever
2026-09-19 11:50:32,969 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 11:50:32,975 INFO core: _init_accounts coroutine started
2026-09-19 11:50:32,975 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 11:50:32,980 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 11:55:38,445 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 11:55:42,165 INFO core: Event loop thread started, running loop forever
2026-09-19 11:55:42,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 11:55:42,470 INFO core: _init_accounts coroutine started
2026-09-19 11:55:42,472 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 11:55:42,478 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:00:26,336 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 12:00:26,370 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:05:23,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:10:23,712 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 12:10:23,714 INFO core: _init_accounts coroutine started
2026-09-19 12:10:23,717 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:10:23,718 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 12:15:05,264 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 12:15:05,264 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 12:15:05,266 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 12:15:05,267 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 12:15:05,283 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 12:15:05,284 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 12:15:05,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:20:12,446 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 12:20:12,449 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 12:20:34,524 INFO core: Event loop thread started, running loop forever
2026-09-19 12:20:34,826 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 12:20:34,829 INFO core: _init_accounts coroutine started
2026-09-19 12:20:34,829 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 12:20:34,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:25:20,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:25:20,791 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 12:25:20,792 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 12:25:20,793 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 12:30:44,236 INFO core: Event loop thread started, running loop forever
2026-09-19 12:30:44,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 12:30:44,541 INFO core: _init_accounts coroutine started
2026-09-19 12:30:44,545 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 12:30:44,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:35:14,876 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 12:35:14,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 12:35:14,878 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 12:35:14,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:40:20,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 12:40:42,811 INFO core: Event loop thread started, running loop forever
2026-09-19 12:40:43,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 12:40:43,122 INFO core: _init_accounts coroutine started
2026-09-19 12:40:43,123 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 12:40:43,124 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:45:27,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:50:15,527 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 12:50:15,527 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 12:50:15,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 12:50:15,532 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 12:55:44,377 INFO core: Event loop thread started, running loop forever
2026-09-19 12:55:44,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 12:55:44,682 INFO core: _init_accounts coroutine started
2026-09-19 12:55:44,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 12:55:44,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:00:39,258 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 13:00:39,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:05:42,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:10:42,082 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 13:10:42,083 INFO core: _init_accounts coroutine started
2026-09-19 13:10:42,083 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 13:10:42,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:15:22,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:20:10,022 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 13:20:10,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:25:25,321 INFO core: Event loop thread started, running loop forever
2026-09-19 13:25:25,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 13:25:25,626 INFO core: _init_accounts coroutine started
2026-09-19 13:25:25,627 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 13:25:25,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:30:20,334 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 13:30:20,334 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 13:30:20,335 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 13:30:20,337 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 13:30:20,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:35:25,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:40:31,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 13:40:31,591 INFO core: Event loop thread started, running loop forever
2026-09-19 13:40:31,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 13:40:31,896 INFO core: _init_accounts coroutine started
2026-09-19 13:40:31,896 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 13:40:31,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:45:20,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:50:26,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 13:50:26,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 13:50:26,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 13:50:26,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 13:50:26,416 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 13:50:26,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 13:50:26,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 13:50:31,223 INFO core: Event loop thread started, running loop forever
2026-09-19 13:50:31,524 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 13:50:31,528 INFO core: _init_accounts coroutine started
2026-09-19 13:50:31,530 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 13:50:31,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 13:55:38,448 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 13:55:43,958 INFO core: Event loop thread started, running loop forever
2026-09-19 13:55:44,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 13:55:44,264 INFO core: _init_accounts coroutine started
2026-09-19 13:55:44,265 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 13:55:44,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:00:46,383 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 14:00:46,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:05:20,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:10:35,457 INFO core: Event loop thread started, running loop forever
2026-09-19 14:10:35,758 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 14:10:35,764 INFO core: _init_accounts coroutine started
2026-09-19 14:10:35,764 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 14:10:35,768 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:15:42,016 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 14:15:42,027 INFO core: Event loop thread started, running loop forever
2026-09-19 14:15:42,329 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 14:15:42,333 INFO core: _init_accounts coroutine started
2026-09-19 14:15:42,333 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 14:15:42,341 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:20:38,069 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-19 14:20:38,087 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-19 14:25:44,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:30:37,556 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 14:30:37,557 INFO core: _init_accounts coroutine started
2026-09-19 14:30:37,557 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 14:30:37,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:35:44,378 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 14:35:46,642 INFO core: Event loop thread started, running loop forever
2026-09-19 14:35:46,944 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 14:35:46,950 INFO core: _init_accounts coroutine started
2026-09-19 14:35:46,950 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 14:35:46,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:40:24,282 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 14:40:24,282 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 14:40:24,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:40:24,284 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 14:45:18,444 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:50:08,115 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 14:50:08,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 14:55:08,375 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 14:55:08,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 14:55:08,382 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 14:55:08,383 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 14:55:08,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:00:15,369 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 15:00:15,370 WARNING core: Account 2: connect timed out after 35s
2026-09-19 15:00:15,370 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 15:00:15,371 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 15:00:15,371 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 15:00:15,372 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 15:00:15,373 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 15:00:28,682 INFO core: Event loop thread started, running loop forever
2026-09-19 15:00:28,983 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 15:00:28,988 INFO core: _init_accounts coroutine started
2026-09-19 15:00:28,990 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 15:00:28,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:05:42,240 INFO core: Event loop thread started, running loop forever
2026-09-19 15:05:42,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 15:05:42,544 INFO core: _init_accounts coroutine started
2026-09-19 15:05:42,545 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 15:05:42,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:10:31,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:15:22,177 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 15:15:22,177 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 15:15:22,178 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 15:15:22,179 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 15:15:22,187 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:20:18,008 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 15:20:18,009 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 15:20:18,014 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 15:20:18,015 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 15:20:18,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:25:10,897 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 15:25:10,898 WARNING core: Account 2: connect timed out after 35s
2026-09-19 15:25:10,898 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 15:25:10,898 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 15:25:10,899 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 15:25:10,901 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 15:25:10,901 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 15:25:10,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:30:16,436 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 15:30:16,437 WARNING core: Account 2: connect timed out after 35s
2026-09-19 15:30:16,438 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-19 15:30:16,438 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-19 15:30:16,439 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 15:30:16,441 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-19 15:30:16,441 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-19 15:30:39,300 INFO core: Event loop thread started, running loop forever
2026-09-19 15:30:39,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 15:30:39,614 INFO core: _init_accounts coroutine started
2026-09-19 15:30:39,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 15:30:39,622 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:35:45,993 INFO core: Event loop thread started, running loop forever
2026-09-19 15:35:45,989 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 15:35:46,294 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 15:35:46,297 INFO core: _init_accounts coroutine started
2026-09-19 15:35:46,300 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 15:35:46,311 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 15:35:46,311 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 15:35:46,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:40:33,944 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 15:40:33,947 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:45:37,323 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 15:45:37,325 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 15:45:37,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:50:40,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 15:55:36,430 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:00:08,052 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 16:00:08,053 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 16:00:08,063 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 16:00:08,064 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 16:00:08,067 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:05:11,825 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 16:05:11,826 WARNING core: Account 2: connect timed out after 35s
2026-09-19 16:05:11,827 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 16:05:11,827 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 16:05:11,828 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 16:05:11,829 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 16:05:11,830 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 16:05:11,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:10:17,426 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 16:10:34,303 INFO core: Event loop thread started, running loop forever
2026-09-19 16:10:34,604 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 16:10:34,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:15:41,373 INFO core: _init_accounts coroutine started
2026-09-19 16:15:41,374 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 16:15:41,374 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-19 16:15:48,256 INFO core: Event loop thread started, running loop forever
2026-09-19 16:15:48,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 16:15:48,562 INFO core: _init_accounts coroutine started
2026-09-19 16:15:48,563 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 16:15:48,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:20:34,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:25:40,388 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 16:25:40,388 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 16:25:41,340 INFO core: Event loop thread started, running loop forever
2026-09-19 16:25:41,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 16:25:41,644 INFO core: _init_accounts coroutine started
2026-09-19 16:25:41,647 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 16:25:41,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:25:41,660 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 16:25:41,660 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 16:30:14,126 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 16:30:14,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:35:21,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 16:35:21,401 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 16:35:21,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 16:35:27,349 INFO core: Event loop thread started, running loop forever
2026-09-19 16:35:27,650 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 16:35:27,653 INFO core: _init_accounts coroutine started
2026-09-19 16:35:27,654 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 16:35:27,665 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:40:07,496 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 16:40:07,496 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 16:40:07,500 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 16:40:07,502 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 16:40:07,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:45:05,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:50:11,407 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 16:50:11,407 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 16:50:11,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 16:50:14,883 INFO core: Event loop thread started, running loop forever
2026-09-19 16:50:15,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 16:50:15,194 INFO core: _init_accounts coroutine started
2026-09-19 16:50:15,194 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 16:50:15,208 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 16:50:15,208 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 16:50:15,211 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 16:50:15,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:55:21,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 16:55:21,418 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 16:55:21,419 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 16:55:25,339 INFO core: Event loop thread started, running loop forever
2026-09-19 16:55:25,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 16:55:25,643 INFO core: _init_accounts coroutine started
2026-09-19 16:55:25,645 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 16:55:25,661 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 16:55:25,673 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 16:55:25,673 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 16:55:25,676 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 16:55:25,678 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 17:00:51,680 INFO core: Event loop thread started, running loop forever
2026-09-19 17:00:51,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 17:00:51,987 INFO core: _init_accounts coroutine started
2026-09-19 17:00:51,988 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 17:00:51,993 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:05:42,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:10:31,554 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 17:10:31,554 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 17:10:31,558 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 17:10:31,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:15:37,409 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 17:15:37,410 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 17:15:37,410 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 17:15:37,411 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 17:15:48,187 INFO core: Event loop thread started, running loop forever
2026-09-19 17:15:48,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 17:15:48,492 INFO core: _init_accounts coroutine started
2026-09-19 17:15:48,495 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 17:15:48,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:20:07,921 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 17:20:07,921 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 17:20:07,922 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 17:20:07,923 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 17:20:07,930 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:25:42,185 INFO core: Event loop thread started, running loop forever
2026-09-19 17:25:42,486 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 17:25:42,489 INFO core: _init_accounts coroutine started
2026-09-19 17:25:42,492 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 17:25:42,500 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 17:25:42,501 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 17:25:42,501 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 17:25:42,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:25:42,503 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 17:30:39,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:35:18,210 INFO core: Event loop thread started, running loop forever
2026-09-19 17:35:18,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 17:35:18,514 INFO core: _init_accounts coroutine started
2026-09-19 17:35:18,516 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 17:35:18,521 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:40:52,728 INFO core: Event loop thread started, running loop forever
2026-09-19 17:40:53,038 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 17:40:53,041 INFO core: _init_accounts coroutine started
2026-09-19 17:40:53,044 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 17:40:53,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:45:20,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:50:17,052 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 17:50:17,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 17:55:07,960 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:00:10,811 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 18:00:10,815 INFO core: _init_accounts coroutine started
2026-09-19 18:00:10,815 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 18:00:10,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:05:17,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 18:05:25,575 INFO core: Event loop thread started, running loop forever
2026-09-19 18:05:25,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 18:05:25,884 INFO core: _init_accounts coroutine started
2026-09-19 18:05:25,884 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 18:05:25,894 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:10:10,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 18:10:10,430 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 18:10:10,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 18:10:10,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:15:49,687 INFO core: Event loop thread started, running loop forever
2026-09-19 18:15:49,988 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 18:15:49,991 INFO core: _init_accounts coroutine started
2026-09-19 18:15:49,995 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 18:15:49,999 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:20:43,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:25:50,364 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 18:25:51,338 INFO core: Event loop thread started, running loop forever
2026-09-19 18:25:51,638 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 18:25:51,642 INFO core: _init_accounts coroutine started
2026-09-19 18:25:51,644 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 18:25:51,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:30:20,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 18:30:20,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 18:30:20,423 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 18:30:20,425 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 18:30:20,427 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:35:21,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:40:27,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 18:40:27,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 18:40:36,857 INFO core: Event loop thread started, running loop forever
2026-09-19 18:40:37,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 18:40:37,164 INFO core: _init_accounts coroutine started
2026-09-19 18:40:37,165 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 18:40:37,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:45:32,141 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:50:36,968 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 18:50:36,968 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 18:50:36,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 18:50:36,971 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 18:55:49,461 INFO core: Event loop thread started, running loop forever
2026-09-19 18:55:49,762 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 18:55:49,765 INFO core: _init_accounts coroutine started
2026-09-19 18:55:49,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 18:55:49,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:00:46,687 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 19:00:46,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:05:46,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:10:41,876 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-19 19:10:41,877 INFO core: _init_accounts coroutine started
2026-09-19 19:10:41,877 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 19:10:41,882 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 19:10:41,882 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 19:10:41,884 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 19:10:41,885 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 19:10:41,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:15:08,921 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:20:14,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 19:20:48,922 INFO core: Event loop thread started, running loop forever
2026-09-19 19:20:49,223 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 19:20:49,227 INFO core: _init_accounts coroutine started
2026-09-19 19:20:49,229 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 19:20:49,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:25:42,700 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 19:25:42,701 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 19:25:42,701 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:30:49,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 19:30:49,365 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-19 19:30:51,949 INFO core: Event loop thread started, running loop forever
2026-09-19 19:30:52,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 19:30:52,254 INFO core: _init_accounts coroutine started
2026-09-19 19:30:52,255 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 19:30:52,270 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 19:30:52,271 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 19:30:52,272 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 19:30:52,273 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 19:30:52,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:35:51,196 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 19:35:51,197 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 19:35:51,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:35:51,202 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 19:35:51,203 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 19:40:49,170 WARNING core: Account 2: connect timed out after 35s
2026-09-19 19:40:49,171 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 19:40:49,171 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 19:40:49,172 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 19:40:49,173 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 19:40:49,174 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 19:40:49,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:45:30,626 INFO core: Event loop thread started, running loop forever
2026-09-19 19:45:30,927 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 19:45:30,930 INFO core: _init_accounts coroutine started
2026-09-19 19:45:30,933 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 19:45:30,940 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-19 19:45:30,942 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-19 19:45:56,647 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 19:45:56,648 WARNING core: Account 2: connect timed out after 35s
2026-09-19 19:45:56,649 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-19 19:45:56,649 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-19 19:45:56,650 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 19:45:56,651 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-19 19:45:56,652 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-19 19:50:51,385 INFO core: Event loop thread started, running loop forever
2026-09-19 19:50:51,686 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 19:50:51,691 INFO core: _init_accounts coroutine started
2026-09-19 19:50:51,692 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 19:50:51,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:55:24,440 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 19:55:24,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 20:00:30,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 20:00:30,412 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-19 20:00:30,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 20:00:30,413 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-19 20:00:30,413 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 20:00:30,413 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-19 20:00:30,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 20:00:30,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 20:00:37,730 INFO core: Event loop thread started, running loop forever
2026-09-19 20:00:38,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 20:00:38,036 INFO core: _init_accounts coroutine started
2026-09-19 20:00:38,039 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 20:00:38,047 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 20:00:38,047 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 20:00:38,049 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 20:00:38,052 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 20:00:38,062 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:05:40,498 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 20:05:40,499 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 20:05:40,503 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 20:05:40,504 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 20:05:40,515 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:10:34,580 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 20:10:34,582 WARNING core: Account 2: connect timed out after 35s
2026-09-19 20:10:34,583 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 20:10:34,583 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 20:10:34,584 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 20:10:34,586 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 20:10:34,586 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 20:10:34,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:15:05,200 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 20:15:05,200 WARNING core: Account 2: connect timed out after 35s
2026-09-19 20:15:05,201 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-19 20:15:05,201 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-19 20:15:05,202 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 20:15:05,203 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-19 20:15:05,203 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-19 20:15:05,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:15:07,225 INFO telethon.network.mtprotosender: Connection to 91.108.56.182:443/TcpAbridged complete!
2026-09-19 20:20:13,122 INFO core: Event loop thread started, running loop forever
2026-09-19 20:20:13,423 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 20:20:13,430 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:20:13,431 INFO core: _init_accounts coroutine started
2026-09-19 20:25:18,634 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 20:25:18,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:30:30,478 INFO core: Event loop thread started, running loop forever
2026-09-19 20:30:30,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 20:30:30,782 INFO core: _init_accounts coroutine started
2026-09-19 20:30:30,784 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 20:30:30,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:35:25,990 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 20:35:25,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:40:51,091 INFO core: Event loop thread started, running loop forever
2026-09-19 20:40:51,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 20:40:51,401 INFO core: _init_accounts coroutine started
2026-09-19 20:40:51,402 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 20:40:51,409 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:45:11,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:50:18,405 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 20:50:18,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 20:50:30,864 INFO core: Event loop thread started, running loop forever
2026-09-19 20:50:31,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 20:50:31,170 INFO core: _init_accounts coroutine started
2026-09-19 20:50:31,171 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 20:50:31,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 20:55:11,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:00:18,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 21:00:39,034 INFO core: Event loop thread started, running loop forever
2026-09-19 21:00:39,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 21:00:39,340 INFO core: _init_accounts coroutine started
2026-09-19 21:00:39,341 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 21:00:39,347 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:05:39,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:10:46,415 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 21:10:47,960 INFO core: Event loop thread started, running loop forever
2026-09-19 21:10:48,262 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 21:10:48,267 INFO core: _init_accounts coroutine started
2026-09-19 21:10:48,267 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 21:10:48,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:15:30,650 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:20:08,741 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 21:20:08,741 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 21:20:08,744 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 21:20:08,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:20:08,746 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 21:25:51,167 INFO core: Event loop thread started, running loop forever
2026-09-19 21:25:51,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 21:25:51,473 INFO core: _init_accounts coroutine started
2026-09-19 21:25:51,473 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 21:25:51,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:30:38,583 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 21:30:38,583 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 21:30:38,585 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 21:30:38,590 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 21:30:38,594 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:35:04,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:40:10,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 21:40:29,129 INFO core: Event loop thread started, running loop forever
2026-09-19 21:40:29,431 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 21:40:29,435 INFO core: _init_accounts coroutine started
2026-09-19 21:40:29,436 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 21:40:29,444 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 21:40:29,444 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 21:40:29,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:45:44,123 INFO core: Event loop thread started, running loop forever
2026-09-19 21:45:44,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 21:45:44,426 INFO core: _init_accounts coroutine started
2026-09-19 21:45:44,429 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 21:45:44,435 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:50:52,255 INFO core: Event loop thread started, running loop forever
2026-09-19 21:50:52,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 21:50:52,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:55:36,612 INFO core: _init_accounts coroutine started
2026-09-19 21:55:36,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 21:55:36,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 21:55:36,622 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 21:55:36,622 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 21:55:36,623 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 21:55:36,624 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 21:55:36,632 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 21:55:36,632 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 21:55:36,636 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 21:55:36,637 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 22:00:12,911 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 22:00:12,913 WARNING core: Account 2: connect timed out after 35s
2026-09-19 22:00:12,913 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-19 22:00:12,914 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-19 22:00:12,915 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-19 22:00:12,916 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-19 22:00:12,916 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-19 22:00:12,919 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:05:40,928 INFO core: Event loop thread started, running loop forever
2026-09-19 22:05:41,229 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 22:05:41,235 INFO core: _init_accounts coroutine started
2026-09-19 22:05:41,236 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 22:05:41,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:10:45,705 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:15:23,378 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:15:23,379 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 22:15:23,379 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 22:20:10,341 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 22:20:10,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:25:27,512 INFO core: Event loop thread started, running loop forever
2026-09-19 22:25:27,814 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 22:25:27,821 INFO core: _init_accounts coroutine started
2026-09-19 22:25:27,827 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 22:25:27,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:30:32,556 INFO core: Event loop thread started, running loop forever
2026-09-19 22:30:32,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 22:30:32,871 INFO core: _init_accounts coroutine started
2026-09-19 22:30:32,872 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 22:30:32,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:30:32,891 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 22:30:32,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 22:30:32,893 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 22:30:32,894 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 22:35:11,677 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 22:35:11,677 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 22:35:11,683 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-19 22:35:11,685 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-19 22:35:11,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:40:17,460 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-19 22:40:17,460 WARNING core: Account 2: connect timed out after 35s
2026-09-19 22:40:50,402 INFO core: Event loop thread started, running loop forever
2026-09-19 22:40:50,703 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 22:40:50,706 INFO core: _init_accounts coroutine started
2026-09-19 22:40:50,708 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 22:40:50,716 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:45:18,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:50:17,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 22:55:22,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:00:20,768 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 23:00:20,768 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 23:00:20,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:05:20,779 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 23:05:20,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:05:20,784 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 23:10:19,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:15:08,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:20:45,242 INFO core: Event loop thread started, running loop forever
2026-09-19 23:20:45,543 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 23:20:45,547 INFO core: _init_accounts coroutine started
2026-09-19 23:20:45,547 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 23:20:45,554 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:25:51,338 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-19 23:25:51,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:30:16,588 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:35:34,741 INFO core: Event loop thread started, running loop forever
2026-09-19 23:35:35,042 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 23:35:35,046 INFO core: _init_accounts coroutine started
2026-09-19 23:35:35,049 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 23:35:35,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:40:51,486 INFO core: Event loop thread started, running loop forever
2026-09-19 23:40:51,787 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 23:40:51,791 INFO core: _init_accounts coroutine started
2026-09-19 23:40:51,794 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 23:40:51,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:45:47,493 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 23:45:47,493 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-19 23:45:47,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:49:36,538 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-19 23:49:36,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:49:36,556 INFO core: _init_accounts_inner: reloading LLM config
2026-09-19 23:50:11,853 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:55:17,422 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-19 23:55:17,423 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-19 23:55:17,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-19 23:55:49,945 INFO core: Event loop thread started, running loop forever
2026-09-19 23:55:50,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-19 23:55:50,250 INFO core: _init_accounts coroutine started
2026-09-19 23:55:50,252 INFO core: _init_accounts_inner: starting DB migrations
2026-09-19 23:55:50,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-19 23:55:50,265 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-19 23:55:50,265 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 00:00:42,094 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 00:00:42,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:05:13,014 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 00:05:13,031 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 00:05:13,031 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 00:05:13,032 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:10:20,420 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 00:10:20,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 00:10:38,952 INFO core: Event loop thread started, running loop forever
2026-09-20 00:10:39,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 00:10:39,256 INFO core: _init_accounts coroutine started
2026-09-20 00:10:39,258 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 00:10:39,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:15:19,578 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:20:26,472 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 00:20:46,844 INFO core: Event loop thread started, running loop forever
2026-09-20 00:20:47,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 00:20:47,149 INFO core: _init_accounts coroutine started
2026-09-20 00:20:47,150 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 00:20:47,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:25:22,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:30:42,891 INFO core: Event loop thread started, running loop forever
2026-09-20 00:30:43,194 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 00:30:43,200 INFO core: _init_accounts coroutine started
2026-09-20 00:30:43,201 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 00:30:43,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:35:16,750 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 00:35:16,751 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 00:35:16,752 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:35:16,752 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 00:40:08,697 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 00:40:08,701 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:45:47,178 INFO core: Event loop thread started, running loop forever
2026-09-20 00:45:47,481 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 00:45:47,484 INFO core: _init_accounts coroutine started
2026-09-20 00:45:47,485 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 00:45:47,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:50:22,093 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 00:50:22,094 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 00:50:22,095 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 00:55:20,683 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 00:55:20,688 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 00:55:20,699 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 00:55:20,699 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 00:55:20,703 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 00:55:20,703 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 00:55:20,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:00:52,261 INFO core: Event loop thread started, running loop forever
2026-09-20 01:00:52,564 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 01:00:52,571 INFO core: _init_accounts coroutine started
2026-09-20 01:00:52,571 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 01:00:52,583 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:05:40,185 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 01:05:40,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:10:04,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:15:41,530 INFO core: Event loop thread started, running loop forever
2026-09-20 01:15:41,831 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 01:15:41,834 INFO core: _init_accounts coroutine started
2026-09-20 01:15:41,836 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 01:15:41,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:20:46,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:25:53,399 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 01:25:53,401 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 01:25:54,160 INFO core: Event loop thread started, running loop forever
2026-09-20 01:25:54,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 01:25:54,470 INFO core: _init_accounts coroutine started
2026-09-20 01:25:54,471 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 01:25:54,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:30:12,997 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 01:30:13,019 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:35:16,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:40:51,390 INFO core: Event loop thread started, running loop forever
2026-09-20 01:40:51,691 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 01:40:51,696 INFO core: _init_accounts coroutine started
2026-09-20 01:40:51,698 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 01:40:51,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:45:42,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 01:45:42,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 01:45:42,479 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 01:45:42,480 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 01:45:42,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:50:49,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 01:50:49,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 01:50:49,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 01:50:51,952 INFO core: Event loop thread started, running loop forever
2026-09-20 01:50:52,253 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 01:50:52,259 INFO core: _init_accounts coroutine started
2026-09-20 01:50:52,259 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 01:50:52,267 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 01:55:42,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:00:40,620 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 02:00:40,621 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 02:00:40,623 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:05:19,744 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 02:05:19,752 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 02:05:19,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:10:19,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 02:10:19,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 02:10:19,423 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 02:10:19,424 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 02:10:19,431 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:15:26,447 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 02:15:34,996 INFO core: Event loop thread started, running loop forever
2026-09-20 02:15:35,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 02:15:35,303 INFO core: _init_accounts coroutine started
2026-09-20 02:15:35,305 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 02:15:35,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:20:19,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:25:22,778 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 02:25:22,797 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:30:50,822 INFO core: Event loop thread started, running loop forever
2026-09-20 02:30:51,123 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 02:30:51,129 INFO core: _init_accounts coroutine started
2026-09-20 02:30:51,130 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 02:30:51,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:35:07,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:35:07,448 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 02:35:07,448 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 02:40:14,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 02:40:14,426 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 02:40:51,919 INFO core: Event loop thread started, running loop forever
2026-09-20 02:40:52,220 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 02:40:52,225 INFO core: _init_accounts coroutine started
2026-09-20 02:40:52,226 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 02:40:52,254 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:45:25,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:50:32,479 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 02:50:37,564 INFO core: Event loop thread started, running loop forever
2026-09-20 02:50:37,866 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 02:50:37,871 INFO core: _init_accounts coroutine started
2026-09-20 02:50:37,873 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 02:50:37,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 02:50:37,894 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 02:50:37,894 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 02:55:44,449 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 02:55:44,449 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 02:55:44,450 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 02:55:44,450 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 02:55:44,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 02:55:44,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 02:55:49,468 INFO core: Event loop thread started, running loop forever
2026-09-20 02:55:49,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 02:55:49,772 INFO core: _init_accounts coroutine started
2026-09-20 02:55:49,774 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 02:55:49,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:00:07,372 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 03:00:40,887 INFO core: Event loop thread started, running loop forever
2026-09-20 03:00:41,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 03:00:41,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:05:09,226 INFO core: _init_accounts coroutine started
2026-09-20 03:05:09,227 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 03:05:09,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:10:16,524 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 03:10:28,557 INFO core: Event loop thread started, running loop forever
2026-09-20 03:10:28,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 03:10:28,861 INFO core: _init_accounts coroutine started
2026-09-20 03:10:28,862 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 03:10:28,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:15:13,489 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:20:07,130 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 03:20:07,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:25:12,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:30:25,669 INFO core: Event loop thread started, running loop forever
2026-09-20 03:30:25,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 03:30:25,977 INFO core: _init_accounts coroutine started
2026-09-20 03:30:25,977 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 03:30:25,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:35:31,454 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 03:35:38,030 INFO core: Event loop thread started, running loop forever
2026-09-20 03:35:38,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 03:35:38,336 INFO core: _init_accounts coroutine started
2026-09-20 03:35:38,336 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 03:35:38,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:40:12,226 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 03:40:12,227 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 03:40:12,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:40:12,230 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 03:45:50,124 INFO core: Event loop thread started, running loop forever
2026-09-20 03:45:50,425 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 03:45:50,431 INFO core: _init_accounts coroutine started
2026-09-20 03:45:50,432 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 03:45:50,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:50:45,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 03:55:35,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:00:45,473 INFO core: Event loop thread started, running loop forever
2026-09-20 04:00:45,774 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 04:00:45,778 INFO core: _init_accounts coroutine started
2026-09-20 04:00:45,778 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 04:00:45,786 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:05:34,122 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 04:05:34,122 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 04:05:34,127 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 04:05:34,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:10:16,825 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 04:10:16,875 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:15:22,457 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 04:15:22,460 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 04:15:22,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 04:15:45,361 INFO core: Event loop thread started, running loop forever
2026-09-20 04:15:45,671 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 04:15:45,680 INFO core: _init_accounts coroutine started
2026-09-20 04:15:45,682 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:15:45,685 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 04:20:11,034 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:25:18,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 04:25:30,592 INFO core: Event loop thread started, running loop forever
2026-09-20 04:25:30,893 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 04:25:30,897 INFO core: _init_accounts coroutine started
2026-09-20 04:25:30,898 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 04:25:30,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:30:37,408 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-20 04:30:54,503 INFO core: Event loop thread started, running loop forever
2026-09-20 04:30:54,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 04:30:54,811 INFO core: _init_accounts coroutine started
2026-09-20 04:30:54,812 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 04:30:54,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:35:23,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:40:29,449 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 04:40:29,451 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 04:40:29,451 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-20 04:40:29,452 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 04:40:29,452 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 04:40:29,452 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 04:40:29,452 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 04:40:29,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 04:40:29,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 04:40:29,999 INFO core: Event loop thread started, running loop forever
2026-09-20 04:40:30,300 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 04:40:30,304 INFO core: _init_accounts coroutine started
2026-09-20 04:40:30,305 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 04:40:30,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:45:52,253 INFO core: Event loop thread started, running loop forever
2026-09-20 04:45:52,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 04:45:52,562 INFO core: _init_accounts coroutine started
2026-09-20 04:45:52,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:45:52,573 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 04:50:20,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 04:55:13,626 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 04:55:13,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:00:31,942 INFO core: Event loop thread started, running loop forever
2026-09-20 05:00:32,254 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 05:00:32,263 INFO core: _init_accounts coroutine started
2026-09-20 05:00:32,263 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 05:00:32,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:05:27,113 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 05:05:27,114 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 05:05:27,116 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 05:05:27,121 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 05:05:27,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:10:32,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:15:45,910 INFO core: Event loop thread started, running loop forever
2026-09-20 05:15:46,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 05:15:46,216 INFO core: _init_accounts coroutine started
2026-09-20 05:15:46,216 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 05:15:46,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:20:17,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:25:20,578 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:30:26,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 05:30:26,425 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 05:30:39,347 INFO core: Event loop thread started, running loop forever
2026-09-20 05:30:39,648 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 05:30:39,657 INFO core: _init_accounts coroutine started
2026-09-20 05:30:39,657 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:30:39,659 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 05:35:30,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:40:24,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 05:40:24,462 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 05:40:24,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:45:31,450 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 05:45:31,452 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 05:45:55,533 INFO core: Event loop thread started, running loop forever
2026-09-20 05:45:55,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 05:45:55,854 INFO core: _init_accounts coroutine started
2026-09-20 05:45:55,854 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 05:45:55,863 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:50:49,914 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 05:50:49,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 05:55:15,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:00:48,542 INFO core: Event loop thread started, running loop forever
2026-09-20 06:00:48,844 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 06:00:48,847 INFO core: _init_accounts coroutine started
2026-09-20 06:00:48,850 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 06:00:48,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:05:17,914 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 06:05:17,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:10:35,806 INFO core: Event loop thread started, running loop forever
2026-09-20 06:10:36,107 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 06:10:36,111 INFO core: _init_accounts coroutine started
2026-09-20 06:10:36,114 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 06:10:36,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:15:33,313 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 06:15:33,313 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 06:15:33,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:20:29,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:20:29,085 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 06:25:36,439 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 06:25:37,152 INFO core: Event loop thread started, running loop forever
2026-09-20 06:25:37,453 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 06:25:37,456 INFO core: _init_accounts coroutine started
2026-09-20 06:25:37,459 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 06:25:37,466 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 06:25:37,466 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 06:25:37,468 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 06:25:37,469 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 06:25:37,472 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:30:22,144 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:35:09,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:40:16,452 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 06:40:16,453 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 06:40:16,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 06:40:30,794 INFO core: Event loop thread started, running loop forever
2026-09-20 06:40:31,100 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 06:40:31,104 INFO core: _init_accounts coroutine started
2026-09-20 06:40:31,105 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 06:40:31,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:45:08,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:50:06,230 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 06:50:06,231 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 06:50:06,233 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 06:50:06,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 06:50:06,236 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 06:55:12,412 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-20 06:55:12,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 06:55:12,413 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-20 06:55:38,160 INFO core: Event loop thread started, running loop forever
2026-09-20 06:55:38,461 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 06:55:38,465 INFO core: _init_accounts coroutine started
2026-09-20 06:55:38,467 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 06:55:38,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:00:55,091 INFO core: Event loop thread started, running loop forever
2026-09-20 07:00:55,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 07:00:55,398 INFO core: _init_accounts coroutine started
2026-09-20 07:00:55,400 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 07:00:55,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:05:13,212 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 07:05:13,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:05:13,212 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 07:10:36,672 INFO core: Event loop thread started, running loop forever
2026-09-20 07:10:36,973 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 07:10:36,977 INFO core: _init_accounts coroutine started
2026-09-20 07:10:36,979 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 07:10:36,992 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:15:18,585 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 07:15:18,593 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:20:35,450 INFO core: Event loop thread started, running loop forever
2026-09-20 07:20:35,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 07:20:35,754 INFO core: _init_accounts coroutine started
2026-09-20 07:20:35,756 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 07:20:35,761 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:25:16,344 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 07:25:16,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:30:26,100 INFO core: Event loop thread started, running loop forever
2026-09-20 07:30:26,401 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 07:30:26,404 INFO core: _init_accounts coroutine started
2026-09-20 07:30:26,405 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 07:30:26,416 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:35:33,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 07:35:46,545 INFO core: Event loop thread started, running loop forever
2026-09-20 07:35:46,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 07:35:46,854 INFO core: _init_accounts coroutine started
2026-09-20 07:35:46,855 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 07:35:46,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:40:10,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:45:16,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 07:45:32,255 INFO core: Event loop thread started, running loop forever
2026-09-20 07:45:32,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 07:45:32,560 INFO core: _init_accounts coroutine started
2026-09-20 07:45:32,560 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 07:45:32,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:45:32,571 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 07:45:32,571 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 07:50:31,563 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 07:50:31,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 07:55:35,413 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 07:55:35,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:00:40,152 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 08:00:40,153 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 08:00:40,159 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 08:00:40,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:00:40,161 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 08:05:21,515 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 08:05:21,516 WARNING core: Account 2: connect timed out after 35s
2026-09-20 08:05:21,517 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-20 08:05:21,518 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-20 08:05:21,519 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 08:05:21,520 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-20 08:05:21,520 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-20 08:05:21,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:10:27,479 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 08:10:27,480 WARNING core: Account 2: connect timed out after 35s
2026-09-20 08:10:27,481 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-20 08:10:38,427 INFO core: Event loop thread started, running loop forever
2026-09-20 08:10:38,729 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 08:10:38,736 INFO core: _init_accounts coroutine started
2026-09-20 08:10:38,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 08:10:38,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:15:26,206 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:20:12,696 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 08:20:12,697 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 08:20:12,698 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 08:20:12,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:20:12,699 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 08:25:27,216 INFO core: Event loop thread started, running loop forever
2026-09-20 08:25:27,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 08:25:27,522 INFO core: _init_accounts coroutine started
2026-09-20 08:25:27,525 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 08:25:27,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:30:17,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:35:40,181 INFO core: Event loop thread started, running loop forever
2026-09-20 08:35:40,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 08:35:40,486 INFO core: _init_accounts coroutine started
2026-09-20 08:35:40,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 08:35:40,495 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:40:43,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:45:28,001 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 08:45:28,002 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 08:45:28,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:50:29,268 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 08:50:29,277 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 08:50:29,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 08:55:23,797 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:00:22,255 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:05:44,619 INFO core: Event loop thread started, running loop forever
2026-09-20 09:05:44,920 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 09:05:44,926 INFO core: _init_accounts coroutine started
2026-09-20 09:05:44,927 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 09:05:44,932 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:10:13,530 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 09:10:13,530 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 09:10:13,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:10:13,535 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 09:15:19,451 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 09:15:52,867 INFO core: Event loop thread started, running loop forever
2026-09-20 09:15:53,168 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 09:15:53,174 INFO core: _init_accounts coroutine started
2026-09-20 09:15:53,175 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 09:15:53,180 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:20:17,973 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:25:13,443 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 09:25:13,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:30:48,463 INFO core: Event loop thread started, running loop forever
2026-09-20 09:30:48,764 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 09:30:48,769 INFO core: _init_accounts coroutine started
2026-09-20 09:30:48,771 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 09:30:48,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:35:26,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:40:32,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 09:40:32,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 09:40:32,434 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-20 09:40:32,435 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 09:40:32,435 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 09:40:32,435 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 09:40:32,435 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 09:40:32,435 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 09:40:32,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 09:40:52,007 INFO core: Event loop thread started, running loop forever
2026-09-20 09:40:52,309 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 09:40:52,313 INFO core: _init_accounts coroutine started
2026-09-20 09:40:52,317 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 09:40:52,324 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 09:40:52,325 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 09:40:52,326 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 09:40:52,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:40:52,330 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 09:45:16,061 INFO core: Event loop thread started, running loop forever
2026-09-20 09:45:16,362 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 09:45:16,366 INFO core: _init_accounts coroutine started
2026-09-20 09:45:16,366 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 09:45:16,373 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:50:10,265 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 09:50:10,266 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 09:50:10,268 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 09:50:10,272 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 09:50:10,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:50:10,284 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 09:50:10,284 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 09:55:15,364 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 09:55:15,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 09:55:15,366 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 10:00:21,440 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 10:00:21,441 WARNING core: Account 2: connect timed out after 35s
2026-09-20 10:00:34,126 INFO core: Event loop thread started, running loop forever
2026-09-20 10:00:34,427 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 10:00:34,431 INFO core: _init_accounts coroutine started
2026-09-20 10:00:34,431 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 10:00:34,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:05:31,688 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 10:05:31,688 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 10:05:31,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:10:50,332 INFO core: Event loop thread started, running loop forever
2026-09-20 10:10:50,634 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 10:10:50,637 INFO core: _init_accounts coroutine started
2026-09-20 10:10:50,639 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 10:10:50,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:15:44,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 10:15:44,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 10:15:44,429 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:20:15,358 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 10:20:15,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:25:20,170 INFO core: Event loop thread started, running loop forever
2026-09-20 10:25:20,472 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 10:25:20,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:25:22,172 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 10:25:22,172 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 10:25:22,173 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 10:25:22,173 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 10:30:21,378 INFO core: _init_accounts coroutine started
2026-09-20 10:30:21,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 10:30:21,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:35:28,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 10:35:52,526 INFO core: Event loop thread started, running loop forever
2026-09-20 10:35:52,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 10:35:52,831 INFO core: _init_accounts coroutine started
2026-09-20 10:35:52,832 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 10:35:52,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:40:47,248 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 10:40:47,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:45:28,380 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:50:29,463 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-20 10:50:29,464 INFO core: _init_accounts coroutine started
2026-09-20 10:50:29,464 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 10:50:29,470 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 10:50:29,470 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 10:50:29,471 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 10:50:29,472 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 10:50:29,487 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 10:55:18,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:00:25,364 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 11:00:25,369 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 11:00:47,506 INFO core: Event loop thread started, running loop forever
2026-09-20 11:00:47,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 11:00:47,816 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:05:50,655 INFO core: _init_accounts coroutine started
2026-09-20 11:05:50,657 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 11:05:50,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:10:28,087 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 11:10:28,088 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 11:10:28,089 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 11:10:28,091 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 11:10:28,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:15:29,100 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 11:15:29,100 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 11:15:29,105 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 11:15:29,106 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 11:15:29,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:20:31,428 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 11:20:31,429 WARNING core: Account 2: connect timed out after 35s
2026-09-20 11:20:31,430 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-20 11:20:31,430 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-20 11:20:31,430 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 11:20:31,431 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-20 11:20:31,432 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-20 11:20:31,435 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:25:38,450 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 11:25:38,451 WARNING core: Account 2: connect timed out after 35s
2026-09-20 11:25:38,452 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-20 11:25:38,452 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-20 11:25:38,452 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 11:25:38,454 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-20 11:25:38,454 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-20 11:25:41,031 INFO core: Event loop thread started, running loop forever
2026-09-20 11:25:41,332 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 11:25:41,334 INFO core: _init_accounts coroutine started
2026-09-20 11:25:41,336 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 11:25:41,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:30:38,904 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:35:45,422 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 11:35:45,424 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 11:35:45,425 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-20 11:35:45,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 11:35:45,425 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 11:35:45,425 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 11:35:45,425 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 11:35:45,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 11:35:45,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 11:35:51,873 INFO core: Event loop thread started, running loop forever
2026-09-20 11:35:52,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 11:35:52,178 INFO core: _init_accounts coroutine started
2026-09-20 11:35:52,179 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 11:35:52,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:40:36,244 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 11:40:36,246 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 11:40:36,249 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 11:40:36,250 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 11:40:36,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:45:04,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:50:10,062 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 11:55:17,432 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 11:55:34,939 INFO core: Event loop thread started, running loop forever
2026-09-20 11:55:35,240 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 11:55:35,245 INFO core: _init_accounts coroutine started
2026-09-20 11:55:35,246 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 11:55:35,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:00:04,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 12:00:12,258 INFO core: Event loop thread started, running loop forever
2026-09-20 12:00:12,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 12:00:12,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:05:19,449 INFO core: _init_accounts coroutine started
2026-09-20 12:05:19,449 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 12:05:19,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 12:05:27,921 INFO core: Event loop thread started, running loop forever
2026-09-20 12:05:28,222 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 12:05:28,227 INFO core: _init_accounts coroutine started
2026-09-20 12:05:28,229 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 12:05:28,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:10:34,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 12:10:52,388 INFO core: Event loop thread started, running loop forever
2026-09-20 12:10:52,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 12:10:52,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:15:21,966 INFO core: _init_accounts coroutine started
2026-09-20 12:15:21,966 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 12:15:21,979 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 12:15:21,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 12:15:21,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:20:27,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 12:20:27,431 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 12:20:27,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 12:20:27,431 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 12:20:36,361 INFO core: Event loop thread started, running loop forever
2026-09-20 12:20:36,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 12:20:36,666 INFO core: _init_accounts coroutine started
2026-09-20 12:20:36,668 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 12:20:36,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:25:17,834 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 12:25:17,834 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 12:25:17,836 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 12:25:17,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:30:08,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 12:30:08,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:35:44,531 INFO core: Event loop thread started, running loop forever
2026-09-20 12:35:44,832 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 12:35:44,837 INFO core: _init_accounts coroutine started
2026-09-20 12:35:44,840 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 12:35:44,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:40:06,772 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 12:40:06,772 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 12:40:06,773 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 12:40:06,776 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 12:40:06,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:45:12,425 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 12:45:14,035 INFO core: Event loop thread started, running loop forever
2026-09-20 12:45:14,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 12:45:14,346 INFO core: _init_accounts coroutine started
2026-09-20 12:45:14,348 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 12:45:14,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:50:30,213 INFO core: Event loop thread started, running loop forever
2026-09-20 12:50:30,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 12:50:30,518 INFO core: _init_accounts coroutine started
2026-09-20 12:50:30,520 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 12:50:30,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 12:55:21,331 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:00:28,545 INFO core: Event loop thread started, running loop forever
2026-09-20 13:00:28,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 13:00:28,849 INFO core: _init_accounts coroutine started
2026-09-20 13:00:28,849 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 13:00:28,870 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:05:27,564 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 13:05:27,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:05:27,586 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 13:10:20,343 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 13:10:20,348 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 13:10:20,359 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:15:04,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:15:04,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 13:15:04,409 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 13:15:04,413 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 13:15:04,414 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 13:20:43,233 INFO core: Event loop thread started, running loop forever
2026-09-20 13:20:43,534 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 13:20:43,537 INFO core: _init_accounts coroutine started
2026-09-20 13:20:43,539 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 13:20:43,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:25:50,731 INFO core: Event loop thread started, running loop forever
2026-09-20 13:25:51,036 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 13:25:51,039 INFO core: _init_accounts coroutine started
2026-09-20 13:25:51,043 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 13:25:51,048 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:30:22,065 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 13:30:22,067 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 13:30:22,069 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 13:30:22,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:35:29,495 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 13:35:29,544 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 13:35:29,544 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 13:35:29,545 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 13:35:39,057 INFO core: Event loop thread started, running loop forever
2026-09-20 13:35:39,358 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 13:35:39,364 INFO core: _init_accounts coroutine started
2026-09-20 13:35:39,364 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 13:35:39,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:40:34,130 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:40:34,130 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 13:40:34,131 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 13:45:48,839 INFO core: Event loop thread started, running loop forever
2026-09-20 13:45:49,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 13:45:49,143 INFO core: _init_accounts coroutine started
2026-09-20 13:45:49,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 13:45:49,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:50:04,916 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 13:50:04,916 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 13:55:10,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 13:55:30,883 INFO core: Event loop thread started, running loop forever
2026-09-20 13:55:31,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 13:55:31,187 INFO core: _init_accounts coroutine started
2026-09-20 13:55:31,189 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 13:55:31,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:00:23,611 INFO core: Event loop thread started, running loop forever
2026-09-20 14:00:23,912 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 14:00:23,915 INFO core: _init_accounts coroutine started
2026-09-20 14:00:23,917 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 14:00:23,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:00:38,631 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 14:05:18,987 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 14:05:18,987 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 14:05:18,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:05:18,991 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 14:10:24,405 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 14:10:50,929 INFO core: Event loop thread started, running loop forever
2026-09-20 14:10:51,230 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 14:10:51,232 INFO core: _init_accounts coroutine started
2026-09-20 14:10:51,234 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 14:10:51,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:15:06,228 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 14:15:06,230 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 14:15:06,231 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 14:15:06,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:20:12,993 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 14:20:13,005 INFO core: Event loop thread started, running loop forever
2026-09-20 14:20:13,307 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 14:20:13,317 INFO core: _init_accounts coroutine started
2026-09-20 14:20:13,317 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 14:20:13,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:25:11,438 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 14:25:11,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 14:25:11,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 14:25:11,441 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 14:25:11,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:30:25,168 INFO core: Event loop thread started, running loop forever
2026-09-20 14:30:25,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 14:30:25,476 INFO core: _init_accounts coroutine started
2026-09-20 14:30:25,477 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 14:30:25,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:35:33,535 INFO core: Event loop thread started, running loop forever
2026-09-20 14:35:33,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 14:35:33,839 INFO core: _init_accounts coroutine started
2026-09-20 14:35:33,842 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 14:35:33,851 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:40:40,985 INFO core: Event loop thread started, running loop forever
2026-09-20 14:40:41,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 14:40:41,291 INFO core: _init_accounts coroutine started
2026-09-20 14:40:41,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 14:40:41,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:45:10,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:45:10,091 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 14:50:17,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 14:50:17,388 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-20 14:50:47,368 INFO core: Event loop thread started, running loop forever
2026-09-20 14:50:47,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 14:50:47,676 INFO core: _init_accounts coroutine started
2026-09-20 14:50:47,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 14:50:47,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 14:55:50,943 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 14:55:50,943 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 14:55:50,944 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 14:55:50,945 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 14:55:50,954 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 14:55:50,954 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 14:55:50,957 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 14:55:50,958 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 14:55:50,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:00:14,144 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 15:00:14,146 WARNING core: Account 2: connect timed out after 35s
2026-09-20 15:00:14,146 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-20 15:00:14,146 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-20 15:00:14,147 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 15:00:14,148 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-20 15:00:14,148 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-20 15:00:14,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:05:21,413 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 15:05:21,415 WARNING core: Account 2: connect timed out after 35s
2026-09-20 15:05:52,811 INFO core: Event loop thread started, running loop forever
2026-09-20 15:05:53,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 15:05:53,116 INFO core: _init_accounts coroutine started
2026-09-20 15:05:53,118 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 15:05:53,126 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:10:33,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:10:33,607 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 15:10:33,607 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 15:15:10,588 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 15:15:10,597 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 15:15:10,602 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:20:05,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:25:35,515 INFO core: Event loop thread started, running loop forever
2026-09-20 15:25:35,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 15:25:35,820 INFO core: _init_accounts coroutine started
2026-09-20 15:25:35,823 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 15:25:35,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:30:28,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:35:28,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:40:16,357 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 15:40:16,360 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 15:40:16,365 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:45:23,440 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 15:45:23,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 15:45:23,442 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-20 15:45:23,442 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 15:45:23,443 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 15:45:23,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 15:45:23,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 15:45:44,872 INFO core: Event loop thread started, running loop forever
2026-09-20 15:45:45,173 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 15:45:45,182 INFO core: _init_accounts coroutine started
2026-09-20 15:45:45,182 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 15:45:45,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:50:12,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 15:55:19,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 15:55:20,429 INFO core: Event loop thread started, running loop forever
2026-09-20 15:55:20,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 15:55:20,738 INFO core: _init_accounts coroutine started
2026-09-20 15:55:20,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 15:55:20,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:00:15,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:05:22,390 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-20 16:05:42,384 INFO core: Event loop thread started, running loop forever
2026-09-20 16:05:42,685 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 16:05:42,688 INFO core: _init_accounts coroutine started
2026-09-20 16:05:42,689 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 16:05:42,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:10:34,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:15:39,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 16:15:39,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 16:15:39,879 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 16:15:39,880 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 16:15:39,885 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:20:45,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 16:20:50,457 INFO core: Event loop thread started, running loop forever
2026-09-20 16:20:50,758 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 16:20:50,764 INFO core: _init_accounts coroutine started
2026-09-20 16:20:50,764 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 16:20:50,769 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:25:50,883 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 16:25:50,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:30:17,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:35:47,205 INFO core: Event loop thread started, running loop forever
2026-09-20 16:35:47,506 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 16:35:47,511 INFO core: _init_accounts coroutine started
2026-09-20 16:35:47,514 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 16:35:47,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:40:31,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:45:28,401 INFO core: Event loop thread started, running loop forever
2026-09-20 16:45:28,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 16:45:28,706 INFO core: _init_accounts coroutine started
2026-09-20 16:45:28,706 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 16:45:28,724 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:50:30,260 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-20 16:50:30,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 16:55:34,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:00:15,374 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-20 17:00:15,376 INFO core: _init_accounts coroutine started
2026-09-20 17:00:15,376 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 17:00:15,380 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:05:19,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 17:05:19,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 17:05:19,463 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:10:50,740 INFO core: Event loop thread started, running loop forever
2026-09-20 17:10:51,042 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 17:10:51,048 INFO core: _init_accounts coroutine started
2026-09-20 17:10:51,049 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 17:10:51,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:15:19,718 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 17:15:19,724 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:20:08,726 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:25:26,713 INFO core: Event loop thread started, running loop forever
2026-09-20 17:25:27,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 17:25:27,018 INFO core: _init_accounts coroutine started
2026-09-20 17:25:27,020 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 17:25:27,045 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 17:25:27,046 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 17:25:27,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:30:15,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:35:06,842 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 17:35:06,850 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:35:06,850 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 17:40:27,997 INFO core: Event loop thread started, running loop forever
2026-09-20 17:40:28,298 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 17:40:28,303 INFO core: _init_accounts coroutine started
2026-09-20 17:40:28,305 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 17:40:28,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:45:45,266 INFO core: Event loop thread started, running loop forever
2026-09-20 17:45:45,567 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 17:45:45,571 INFO core: _init_accounts coroutine started
2026-09-20 17:45:45,572 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 17:45:45,577 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:50:44,462 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 17:50:44,462 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 17:50:44,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:50:44,466 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 17:55:51,401 INFO core: Event loop thread started, running loop forever
2026-09-20 17:55:51,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 17:55:51,705 INFO core: _init_accounts coroutine started
2026-09-20 17:55:51,706 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 17:55:51,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 17:55:51,716 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-20 18:00:18,728 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-20 18:05:28,432 INFO core: Event loop thread started, running loop forever
2026-09-20 18:05:28,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 18:05:28,736 INFO core: _init_accounts coroutine started
2026-09-20 18:05:28,738 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 18:05:28,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:10:06,917 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 18:10:06,942 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:15:11,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:20:42,727 INFO core: Event loop thread started, running loop forever
2026-09-20 18:20:43,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 18:20:43,033 INFO core: _init_accounts coroutine started
2026-09-20 18:20:43,033 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 18:20:43,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:25:33,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 18:25:33,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:25:33,482 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 18:30:23,285 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 18:30:23,293 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 18:30:23,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:35:48,613 INFO core: Event loop thread started, running loop forever
2026-09-20 18:35:48,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 18:35:48,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:35:48,926 INFO core: _init_accounts coroutine started
2026-09-20 18:35:48,926 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 18:40:22,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:45:05,547 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 18:45:05,548 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 18:45:05,550 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 18:45:05,552 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 18:45:05,560 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 18:45:05,560 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 18:45:05,564 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 18:45:05,564 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 18:45:05,578 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:50:12,485 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 18:50:12,485 WARNING core: Account 2: connect timed out after 35s
2026-09-20 18:50:12,485 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-20 18:50:12,486 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-20 18:50:12,486 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 18:50:12,487 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-20 18:50:33,450 INFO core: Event loop thread started, running loop forever
2026-09-20 18:50:33,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 18:50:33,755 INFO core: _init_accounts coroutine started
2026-09-20 18:50:33,756 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 18:50:33,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:55:04,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 18:55:04,390 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 18:55:04,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 18:55:04,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 18:55:04,397 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 18:55:04,410 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 18:55:04,411 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 18:55:04,417 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 18:55:04,418 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 19:00:51,187 INFO core: Event loop thread started, running loop forever
2026-09-20 19:00:51,488 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 19:00:51,493 INFO core: _init_accounts coroutine started
2026-09-20 19:00:51,493 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 19:00:51,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:00:51,508 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 19:00:51,508 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 19:05:05,406 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 19:05:05,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 19:05:05,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:10:10,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:15:47,422 INFO core: Event loop thread started, running loop forever
2026-09-20 19:15:47,723 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 19:15:47,733 INFO core: _init_accounts coroutine started
2026-09-20 19:15:47,734 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 19:15:47,744 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 19:15:47,744 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 19:15:47,745 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 19:15:47,747 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 19:15:47,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:20:47,054 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:25:20,287 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 19:25:20,290 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 19:25:20,303 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 19:25:20,304 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 19:25:20,308 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:30:04,796 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 19:30:04,796 WARNING core: Account 2: connect timed out after 35s
2026-09-20 19:30:04,797 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-20 19:30:04,802 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-20 19:30:04,803 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 19:30:04,804 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-20 19:30:04,805 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-20 19:30:04,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:35:10,465 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 19:35:10,466 WARNING core: Account 2: connect timed out after 35s
2026-09-20 19:35:10,466 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-20 19:35:10,466 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-20 19:35:10,467 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 19:35:10,468 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-20 19:35:10,468 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-20 19:35:19,588 INFO core: Event loop thread started, running loop forever
2026-09-20 19:35:19,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 19:35:19,907 INFO core: _init_accounts coroutine started
2026-09-20 19:35:19,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 19:35:19,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:40:36,960 INFO core: Event loop thread started, running loop forever
2026-09-20 19:40:37,261 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 19:40:37,264 INFO core: _init_accounts coroutine started
2026-09-20 19:40:37,265 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 19:40:37,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:45:30,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:50:36,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 19:55:23,484 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 19:55:23,485 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 19:55:23,492 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 19:55:23,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:00:19,390 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 20:00:19,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:05:26,400 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 20:05:47,159 INFO core: Event loop thread started, running loop forever
2026-09-20 20:05:47,460 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 20:05:47,464 INFO core: _init_accounts coroutine started
2026-09-20 20:05:47,465 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 20:05:47,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:10:27,305 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:10:27,305 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 20:10:27,306 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 20:15:08,744 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 20:15:08,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:20:03,207 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 20:20:03,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:25:28,887 INFO core: Event loop thread started, running loop forever
2026-09-20 20:25:29,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 20:25:29,191 INFO core: _init_accounts coroutine started
2026-09-20 20:25:29,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 20:25:29,201 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 20:25:29,201 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 20:25:29,202 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 20:25:29,202 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:30:35,405 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 20:30:35,405 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 20:30:35,405 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 20:30:35,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 20:30:46,550 INFO core: Event loop thread started, running loop forever
2026-09-20 20:30:46,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 20:30:46,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:35:26,111 INFO core: _init_accounts coroutine started
2026-09-20 20:35:26,111 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 20:35:26,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:40:33,413 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 20:40:41,408 INFO core: Event loop thread started, running loop forever
2026-09-20 20:40:41,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 20:40:41,714 INFO core: _init_accounts coroutine started
2026-09-20 20:40:41,715 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 20:40:41,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:45:23,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:50:37,916 INFO core: Event loop thread started, running loop forever
2026-09-20 20:50:38,217 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 20:50:38,220 INFO core: _init_accounts coroutine started
2026-09-20 20:50:38,222 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 20:50:38,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 20:55:44,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 20:55:49,269 INFO core: Event loop thread started, running loop forever
2026-09-20 20:55:49,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 20:55:49,581 INFO core: _init_accounts coroutine started
2026-09-20 20:55:49,582 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 20:55:49,588 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:00:44,857 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 21:00:44,864 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:05:42,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:10:51,951 INFO core: Event loop thread started, running loop forever
2026-09-20 21:10:52,254 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 21:10:52,259 INFO core: _init_accounts coroutine started
2026-09-20 21:10:52,260 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 21:10:52,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:15:19,255 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 21:15:19,268 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:20:40,070 INFO core: Event loop thread started, running loop forever
2026-09-20 21:20:40,379 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 21:20:40,382 INFO core: _init_accounts coroutine started
2026-09-20 21:20:40,384 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 21:20:40,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:25:39,143 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 21:25:39,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:30:21,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:35:04,670 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-20 21:35:04,671 INFO core: _init_accounts coroutine started
2026-09-20 21:35:04,671 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 21:35:04,678 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 21:35:04,678 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 21:35:04,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:35:04,679 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 21:40:11,392 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 21:40:11,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-20 21:40:14,869 INFO core: Event loop thread started, running loop forever
2026-09-20 21:40:15,171 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 21:40:15,174 INFO core: _init_accounts coroutine started
2026-09-20 21:40:15,176 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 21:40:15,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:45:21,394 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-20 21:45:34,755 INFO core: Event loop thread started, running loop forever
2026-09-20 21:45:35,056 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 21:45:35,061 INFO core: _init_accounts coroutine started
2026-09-20 21:45:35,061 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 21:45:35,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:50:12,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 21:55:19,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 21:55:50,776 INFO core: Event loop thread started, running loop forever
2026-09-20 21:55:51,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 21:55:51,084 INFO core: _init_accounts coroutine started
2026-09-20 21:55:51,084 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 21:55:51,090 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:00:45,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:05:50,621 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 22:05:50,622 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 22:05:50,624 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 22:05:50,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:10:39,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:15:32,972 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 22:15:32,977 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:20:06,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:25:12,532 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 22:25:12,541 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 22:25:42,476 INFO core: Event loop thread started, running loop forever
2026-09-20 22:25:42,778 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 22:25:42,781 INFO core: _init_accounts coroutine started
2026-09-20 22:25:42,783 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 22:25:42,788 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:30:13,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 22:30:13,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 22:30:13,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 22:30:13,395 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 22:30:13,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:35:08,153 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 22:35:08,153 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 22:35:08,157 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-20 22:35:08,158 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-20 22:35:08,161 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:40:14,468 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-20 22:40:14,469 WARNING core: Account 2: connect timed out after 35s
2026-09-20 22:40:14,470 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-20 22:40:14,470 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-20 22:40:14,471 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-20 22:40:14,472 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-20 22:40:14,473 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-20 22:40:40,394 INFO core: Event loop thread started, running loop forever
2026-09-20 22:40:40,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 22:40:40,704 INFO core: _init_accounts coroutine started
2026-09-20 22:40:40,704 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 22:40:40,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:45:47,163 INFO core: Event loop thread started, running loop forever
2026-09-20 22:45:47,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 22:45:47,468 INFO core: _init_accounts coroutine started
2026-09-20 22:45:47,468 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 22:45:47,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:50:04,339 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 22:50:04,339 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:50:04,339 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 22:55:11,374 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 22:55:50,355 INFO core: Event loop thread started, running loop forever
2026-09-20 22:55:50,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 22:55:50,659 INFO core: _init_accounts coroutine started
2026-09-20 22:55:50,660 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 22:55:50,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 22:55:50,677 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 22:55:50,677 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 23:00:12,964 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 23:00:12,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:00:12,983 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 23:05:18,492 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 23:05:18,493 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 23:05:18,493 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-20 23:05:25,845 INFO core: Event loop thread started, running loop forever
2026-09-20 23:05:26,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 23:05:26,156 INFO core: _init_accounts coroutine started
2026-09-20 23:05:26,157 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 23:05:26,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:10:22,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:15:17,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:20:15,786 INFO core: Event loop thread started, running loop forever
2026-09-20 23:20:16,087 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 23:20:16,091 INFO core: _init_accounts coroutine started
2026-09-20 23:20:16,093 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 23:20:16,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:20:24,794 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 23:20:24,794 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 23:20:24,794 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-20 23:25:50,654 INFO core: Event loop thread started, running loop forever
2026-09-20 23:25:50,954 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 23:25:50,959 INFO core: _init_accounts coroutine started
2026-09-20 23:25:50,961 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 23:25:50,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:30:33,355 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-20 23:30:33,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:35:38,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:40:07,118 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-20 23:40:07,119 INFO core: _init_accounts coroutine started
2026-09-20 23:40:07,119 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 23:40:07,126 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 23:40:07,126 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-20 23:40:07,128 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-20 23:40:07,131 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:45:06,316 INFO core: _init_accounts_inner: reloading LLM config
2026-09-20 23:45:06,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:50:07,209 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:55:14,466 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-20 23:55:14,473 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-20 23:55:30,318 INFO core: Event loop thread started, running loop forever
2026-09-20 23:55:30,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-20 23:55:30,625 INFO core: _init_accounts coroutine started
2026-09-20 23:55:30,627 INFO core: _init_accounts_inner: starting DB migrations
2026-09-20 23:55:30,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-20 23:55:30,639 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-20 23:55:30,639 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 00:00:32,477 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 00:00:32,479 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 00:00:32,492 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:05:20,820 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 00:05:20,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:05:20,822 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 00:10:18,050 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 00:10:18,051 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 00:10:18,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:15:25,448 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 00:15:25,449 WARNING core: Account 2: connect timed out after 35s
2026-09-21 00:15:26,585 INFO core: Event loop thread started, running loop forever
2026-09-21 00:15:26,886 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 00:15:26,889 INFO core: _init_accounts coroutine started
2026-09-21 00:15:26,891 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 00:15:26,903 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:20:07,992 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 00:20:07,992 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 00:20:08,009 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 00:20:08,015 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 00:20:08,016 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:25:45,537 INFO core: Event loop thread started, running loop forever
2026-09-21 00:25:45,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 00:25:45,852 INFO core: _init_accounts coroutine started
2026-09-21 00:25:45,852 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 00:25:45,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:30:38,920 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:35:32,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:40:31,213 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 00:40:31,213 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 00:40:31,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:40:31,217 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 00:45:38,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 00:45:51,871 INFO core: Event loop thread started, running loop forever
2026-09-21 00:45:52,183 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 00:45:52,202 INFO core: _init_accounts coroutine started
2026-09-21 00:45:52,202 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 00:45:52,205 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:50:17,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 00:55:46,209 INFO core: Event loop thread started, running loop forever
2026-09-21 00:55:46,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 00:55:46,516 INFO core: _init_accounts coroutine started
2026-09-21 00:55:46,517 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 00:55:46,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:00:46,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:05:12,979 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:10:19,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 01:10:19,386 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 01:10:21,827 INFO core: Event loop thread started, running loop forever
2026-09-21 01:10:22,129 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 01:10:22,136 INFO core: _init_accounts coroutine started
2026-09-21 01:10:22,136 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 01:10:22,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:15:51,921 INFO core: Event loop thread started, running loop forever
2026-09-21 01:15:52,222 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 01:15:52,227 INFO core: _init_accounts coroutine started
2026-09-21 01:15:52,228 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 01:15:52,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:20:17,586 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:25:15,083 INFO core: Event loop thread started, running loop forever
2026-09-21 01:25:15,384 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 01:25:15,389 INFO core: _init_accounts coroutine started
2026-09-21 01:25:15,389 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 01:25:15,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 01:25:15,408 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 01:25:15,409 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 01:25:15,411 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 01:25:15,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:30:50,253 INFO core: Event loop thread started, running loop forever
2026-09-21 01:30:50,554 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 01:30:50,559 INFO core: _init_accounts coroutine started
2026-09-21 01:30:50,560 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 01:30:50,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:35:09,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:40:04,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:45:43,997 INFO core: Event loop thread started, running loop forever
2026-09-21 01:45:44,297 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 01:45:44,302 INFO core: _init_accounts coroutine started
2026-09-21 01:45:44,303 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 01:45:44,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:50:38,646 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 01:50:38,646 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 01:50:38,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 01:50:38,650 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 01:55:11,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:00:17,381 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 02:00:50,361 INFO core: Event loop thread started, running loop forever
2026-09-21 02:00:50,662 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 02:00:50,668 INFO core: _init_accounts coroutine started
2026-09-21 02:00:50,668 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 02:00:50,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:05:46,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:10:39,174 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 02:10:39,175 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 02:10:39,180 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 02:10:39,182 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 02:10:39,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:15:04,750 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 02:15:04,751 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 02:15:04,772 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 02:15:04,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:15:04,774 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 02:20:04,284 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 02:20:04,286 WARNING core: Account 2: connect timed out after 35s
2026-09-21 02:20:04,286 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 02:20:04,287 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 02:20:04,288 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 02:20:04,290 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 02:20:04,290 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 02:20:04,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:25:11,484 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 02:25:11,489 WARNING core: Account 2: connect timed out after 35s
2026-09-21 02:25:53,345 INFO core: Event loop thread started, running loop forever
2026-09-21 02:25:53,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 02:25:53,650 INFO core: _init_accounts coroutine started
2026-09-21 02:25:53,650 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 02:25:53,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:30:06,571 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 02:30:06,571 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 02:30:06,575 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 02:30:06,576 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 02:30:06,586 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:35:12,475 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 02:35:43,917 INFO core: Event loop thread started, running loop forever
2026-09-21 02:35:44,219 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 02:35:44,222 INFO core: _init_accounts coroutine started
2026-09-21 02:35:44,224 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 02:35:44,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:40:10,036 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 02:40:10,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 02:40:10,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:45:17,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 02:45:36,429 INFO core: Event loop thread started, running loop forever
2026-09-21 02:45:36,729 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 02:45:36,733 INFO core: _init_accounts coroutine started
2026-09-21 02:45:36,735 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 02:45:36,742 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:50:30,656 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 02:50:30,656 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 02:50:30,662 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:55:36,419 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 02:55:51,167 INFO core: Event loop thread started, running loop forever
2026-09-21 02:55:51,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 02:55:51,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 02:55:51,480 INFO core: _init_accounts coroutine started
2026-09-21 02:55:51,480 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 03:00:13,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:05:40,537 INFO core: Event loop thread started, running loop forever
2026-09-21 03:05:40,838 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 03:05:40,850 INFO core: _init_accounts coroutine started
2026-09-21 03:05:40,850 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 03:05:40,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:10:44,995 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 03:10:45,006 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:15:46,621 INFO core: Event loop thread started, running loop forever
2026-09-21 03:15:46,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 03:15:46,926 INFO core: _init_accounts coroutine started
2026-09-21 03:15:46,927 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 03:15:46,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:20:23,100 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 03:20:23,101 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 03:20:23,102 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 03:20:23,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:20:23,105 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 03:25:15,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:30:10,644 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 03:30:10,647 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 03:30:10,654 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 03:30:10,657 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 03:30:10,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:35:34,848 INFO core: Event loop thread started, running loop forever
2026-09-21 03:35:35,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 03:35:35,163 INFO core: _init_accounts coroutine started
2026-09-21 03:35:35,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 03:35:35,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:40:37,816 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 03:40:37,817 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 03:40:37,823 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 03:40:37,826 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:40:37,827 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 03:45:42,265 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 03:45:42,266 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 03:45:42,271 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 03:45:42,272 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 03:45:42,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:50:19,399 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 03:50:19,400 WARNING core: Account 2: connect timed out after 35s
2026-09-21 03:50:19,401 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 03:50:19,401 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 03:50:19,402 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 03:50:19,403 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 03:50:19,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 03:50:19,408 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:55:24,286 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 03:55:24,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 03:55:24,288 WARNING core: Account 2: connect timed out after 35s
2026-09-21 03:55:24,288 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-21 04:00:09,065 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-21 04:00:09,077 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 04:00:09,079 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-21 04:00:09,079 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-21 04:00:09,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:05:16,409 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 04:05:16,410 WARNING core: Account 2: connect timed out after 35s
2026-09-21 04:05:16,414 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-21 04:05:35,495 INFO core: Event loop thread started, running loop forever
2026-09-21 04:05:35,797 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 04:05:35,801 INFO core: _init_accounts coroutine started
2026-09-21 04:05:35,802 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 04:05:35,825 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 04:05:35,825 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 04:05:35,827 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 04:05:35,828 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 04:05:35,829 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:10:22,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:15:28,537 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 04:15:35,265 INFO core: Event loop thread started, running loop forever
2026-09-21 04:15:35,566 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 04:15:35,569 INFO core: _init_accounts coroutine started
2026-09-21 04:15:35,571 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 04:15:35,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:20:42,493 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 04:20:47,502 INFO core: Event loop thread started, running loop forever
2026-09-21 04:20:47,803 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 04:20:47,806 INFO core: _init_accounts coroutine started
2026-09-21 04:20:47,809 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 04:20:47,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:25:20,731 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 04:25:20,981 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:30:40,530 INFO core: Event loop thread started, running loop forever
2026-09-21 04:30:40,832 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 04:30:40,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:35:35,627 INFO core: _init_accounts coroutine started
2026-09-21 04:35:35,632 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 04:35:35,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:40:52,158 INFO core: Event loop thread started, running loop forever
2026-09-21 04:40:52,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 04:40:52,472 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:45:47,418 INFO core: _init_accounts coroutine started
2026-09-21 04:45:47,420 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 04:45:47,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:50:13,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 04:50:13,614 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 04:55:19,492 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 04:55:19,525 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 04:55:19,526 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-21 04:55:19,526 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 04:55:19,526 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-21 04:55:19,527 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 04:55:19,527 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 04:55:39,852 INFO core: Event loop thread started, running loop forever
2026-09-21 04:55:40,153 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 04:55:40,157 INFO core: _init_accounts coroutine started
2026-09-21 04:55:40,157 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 04:55:40,165 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:00:23,606 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 05:00:23,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:05:48,588 INFO core: Event loop thread started, running loop forever
2026-09-21 05:05:48,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 05:05:48,894 INFO core: _init_accounts coroutine started
2026-09-21 05:05:48,895 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 05:05:48,901 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 05:05:48,902 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 05:05:48,902 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 05:05:48,903 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 05:05:48,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:10:42,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:10:42,912 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 05:10:42,912 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 05:15:12,790 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 05:15:12,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:15:12,806 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 05:20:23,911 INFO core: Event loop thread started, running loop forever
2026-09-21 05:20:24,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 05:20:24,219 INFO core: _init_accounts coroutine started
2026-09-21 05:20:24,222 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 05:20:24,232 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 05:20:24,232 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 05:20:24,233 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 05:20:24,234 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 05:20:24,237 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:25:30,497 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 05:25:43,669 INFO core: Event loop thread started, running loop forever
2026-09-21 05:25:43,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 05:25:43,974 INFO core: _init_accounts coroutine started
2026-09-21 05:25:43,976 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 05:25:43,980 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:30:06,373 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 05:30:29,437 INFO core: Event loop thread started, running loop forever
2026-09-21 05:30:29,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 05:30:29,743 INFO core: _init_accounts coroutine started
2026-09-21 05:30:29,743 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 05:30:29,758 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 05:30:29,759 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 05:30:29,761 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 05:30:29,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:30:29,764 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 05:35:26,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:40:32,400 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 05:40:36,201 INFO core: Event loop thread started, running loop forever
2026-09-21 05:40:36,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 05:40:36,505 INFO core: _init_accounts coroutine started
2026-09-21 05:40:36,506 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 05:40:36,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:45:04,700 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 05:45:04,700 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 05:45:04,702 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 05:45:04,704 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 05:45:04,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:50:45,467 INFO core: Event loop thread started, running loop forever
2026-09-21 05:50:45,769 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 05:50:45,778 INFO core: _init_accounts coroutine started
2026-09-21 05:50:45,778 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 05:50:45,788 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 05:55:25,222 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 05:55:25,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:00:07,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:05:19,558 INFO core: Event loop thread started, running loop forever
2026-09-21 06:05:19,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 06:05:19,862 INFO core: _init_accounts coroutine started
2026-09-21 06:05:19,862 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 06:05:19,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:10:05,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:15:12,380 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 06:15:30,365 INFO core: Event loop thread started, running loop forever
2026-09-21 06:15:30,666 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 06:15:30,669 INFO core: _init_accounts coroutine started
2026-09-21 06:15:30,671 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 06:15:30,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:20:46,008 INFO core: Event loop thread started, running loop forever
2026-09-21 06:20:46,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 06:20:46,314 INFO core: _init_accounts coroutine started
2026-09-21 06:20:46,314 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 06:20:46,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:25:24,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:30:17,408 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 06:30:17,408 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 06:30:17,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 06:30:17,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 06:30:17,427 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:35:18,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:40:25,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 06:40:26,148 INFO core: Event loop thread started, running loop forever
2026-09-21 06:40:26,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 06:40:26,454 INFO core: _init_accounts coroutine started
2026-09-21 06:40:26,456 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 06:40:26,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:45:15,852 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 06:45:15,855 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 06:45:15,860 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 06:45:15,861 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 06:45:15,867 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:50:21,447 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 06:50:21,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 06:50:21,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 06:50:52,352 INFO core: Event loop thread started, running loop forever
2026-09-21 06:50:52,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 06:50:52,655 INFO core: _init_accounts coroutine started
2026-09-21 06:50:52,659 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 06:50:52,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 06:55:06,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:00:37,367 INFO core: Event loop thread started, running loop forever
2026-09-21 07:00:37,668 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 07:00:37,673 INFO core: _init_accounts coroutine started
2026-09-21 07:00:37,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 07:00:37,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:05:22,310 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 07:05:22,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:05:22,332 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 07:10:12,431 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 07:10:12,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:15:51,979 INFO core: Event loop thread started, running loop forever
2026-09-21 07:15:52,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 07:15:52,301 INFO core: _init_accounts coroutine started
2026-09-21 07:15:52,301 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 07:15:52,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:20:25,877 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:20:25,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 07:20:25,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 07:25:13,552 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 07:25:13,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:30:16,013 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 07:30:16,019 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:35:48,665 INFO core: Event loop thread started, running loop forever
2026-09-21 07:35:48,966 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 07:35:48,971 INFO core: _init_accounts coroutine started
2026-09-21 07:35:48,973 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 07:35:48,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:40:45,194 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 07:40:45,195 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 07:40:45,196 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 07:40:45,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:45:05,347 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 07:45:22,154 INFO core: Event loop thread started, running loop forever
2026-09-21 07:45:22,455 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 07:45:22,462 INFO core: _init_accounts coroutine started
2026-09-21 07:45:22,463 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 07:45:22,467 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:50:41,251 INFO core: Event loop thread started, running loop forever
2026-09-21 07:50:41,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 07:50:41,562 INFO core: _init_accounts coroutine started
2026-09-21 07:50:41,564 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 07:50:41,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 07:55:34,334 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 07:55:34,334 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 07:55:34,336 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 07:55:34,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:00:41,413 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 08:00:41,414 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-21 08:00:41,414 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 08:00:41,415 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 08:00:49,601 INFO core: Event loop thread started, running loop forever
2026-09-21 08:00:49,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 08:00:49,906 INFO core: _init_accounts coroutine started
2026-09-21 08:00:49,908 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 08:00:49,914 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:05:52,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:10:34,465 INFO core: Event loop thread started, running loop forever
2026-09-21 08:10:34,767 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 08:10:34,769 INFO core: _init_accounts coroutine started
2026-09-21 08:10:34,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:10:34,789 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 08:10:58,493 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 08:15:15,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:20:11,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:25:40,042 INFO core: Event loop thread started, running loop forever
2026-09-21 08:25:40,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 08:25:40,348 INFO core: _init_accounts coroutine started
2026-09-21 08:25:40,349 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 08:25:40,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:30:17,155 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 08:30:17,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:35:32,749 INFO core: Event loop thread started, running loop forever
2026-09-21 08:35:33,050 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 08:35:33,053 INFO core: _init_accounts coroutine started
2026-09-21 08:35:33,054 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 08:35:33,074 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 08:35:33,074 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 08:35:33,075 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 08:35:33,076 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 08:35:33,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:40:12,785 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:45:45,823 INFO core: Event loop thread started, running loop forever
2026-09-21 08:45:46,124 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 08:45:46,127 INFO core: _init_accounts coroutine started
2026-09-21 08:45:46,129 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 08:45:46,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:50:14,197 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 08:50:14,197 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 08:50:14,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 08:55:19,660 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 08:55:19,664 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 08:55:19,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:00:25,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 09:00:51,893 INFO core: Event loop thread started, running loop forever
2026-09-21 09:00:52,198 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 09:00:52,203 INFO core: _init_accounts coroutine started
2026-09-21 09:00:52,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:00:52,214 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 09:05:18,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:10:20,516 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 09:10:20,516 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 09:10:20,521 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 09:10:20,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:15:10,131 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 09:15:10,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:20:11,903 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:25:41,995 INFO core: Event loop thread started, running loop forever
2026-09-21 09:25:42,296 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 09:25:42,301 INFO core: _init_accounts coroutine started
2026-09-21 09:25:42,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 09:25:42,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:30:24,811 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:35:30,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 09:35:36,746 INFO core: Event loop thread started, running loop forever
2026-09-21 09:35:37,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 09:35:37,050 INFO core: _init_accounts coroutine started
2026-09-21 09:35:37,051 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 09:35:37,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:40:42,870 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 09:40:42,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:45:47,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:50:36,153 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-21 09:50:36,154 INFO core: _init_accounts coroutine started
2026-09-21 09:50:36,154 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 09:50:36,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:55:10,202 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 09:55:10,202 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 09:55:10,204 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 09:55:10,206 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 09:55:10,215 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 09:55:10,216 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 09:55:10,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 09:55:10,220 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 09:55:10,221 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 10:00:17,441 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 10:00:17,442 WARNING core: Account 2: connect timed out after 35s
2026-09-21 10:00:17,442 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 10:00:17,442 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 10:00:17,443 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 10:00:17,444 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 10:00:17,444 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 10:00:28,672 INFO core: Event loop thread started, running loop forever
2026-09-21 10:00:28,973 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 10:00:28,980 INFO core: _init_accounts coroutine started
2026-09-21 10:00:28,980 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 10:00:28,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:05:08,750 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 10:05:08,751 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 10:05:08,754 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 10:05:08,756 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 10:05:08,766 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 10:05:08,767 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 10:05:08,771 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 10:05:08,772 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 10:05:08,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:10:15,373 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 10:10:15,374 WARNING core: Account 2: connect timed out after 35s
2026-09-21 10:10:15,374 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 10:10:15,374 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 10:10:15,375 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 10:10:15,377 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 10:10:15,377 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 10:10:26,750 INFO core: Event loop thread started, running loop forever
2026-09-21 10:10:27,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 10:10:27,057 INFO core: _init_accounts coroutine started
2026-09-21 10:10:27,059 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 10:10:27,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:15:33,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 10:15:34,296 INFO core: Event loop thread started, running loop forever
2026-09-21 10:15:34,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 10:15:34,604 INFO core: _init_accounts coroutine started
2026-09-21 10:15:34,606 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 10:15:34,617 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 10:15:34,617 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 10:15:34,617 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:20:12,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:25:07,178 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 10:25:07,185 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 10:25:07,192 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:30:27,063 INFO core: Event loop thread started, running loop forever
2026-09-21 10:30:27,364 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 10:30:27,367 INFO core: _init_accounts coroutine started
2026-09-21 10:30:27,369 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 10:30:27,378 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:35:34,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 10:35:36,283 INFO core: Event loop thread started, running loop forever
2026-09-21 10:35:36,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 10:35:36,587 INFO core: _init_accounts coroutine started
2026-09-21 10:35:36,587 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 10:35:36,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:40:13,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:45:08,449 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 10:45:08,450 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 10:45:08,488 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 10:45:08,488 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-21 10:45:08,489 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 10:45:08,489 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-21 10:45:08,489 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 10:45:08,489 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 10:45:52,727 INFO core: Event loop thread started, running loop forever
2026-09-21 10:45:53,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 10:45:53,032 INFO core: _init_accounts coroutine started
2026-09-21 10:45:53,033 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 10:45:53,038 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:50:32,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 10:55:24,626 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 10:55:24,627 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 10:55:24,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 10:55:24,648 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 10:55:24,657 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:00:31,391 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 11:00:31,391 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 11:00:34,711 INFO core: Event loop thread started, running loop forever
2026-09-21 11:00:35,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 11:00:35,015 INFO core: _init_accounts coroutine started
2026-09-21 11:00:35,017 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 11:00:35,022 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:05:39,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:10:17,831 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 11:10:17,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:15:53,601 INFO core: Event loop thread started, running loop forever
2026-09-21 11:15:53,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 11:15:53,908 INFO core: _init_accounts coroutine started
2026-09-21 11:15:53,909 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 11:15:53,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:20:24,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:25:18,858 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 11:25:18,858 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 11:25:18,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:30:24,418 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 11:30:24,419 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-21 11:30:24,420 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 11:30:44,521 INFO core: Event loop thread started, running loop forever
2026-09-21 11:30:44,822 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 11:30:44,825 INFO core: _init_accounts coroutine started
2026-09-21 11:30:44,825 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 11:30:44,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:35:05,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:40:11,523 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 11:40:16,375 INFO core: Event loop thread started, running loop forever
2026-09-21 11:40:16,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 11:40:16,685 INFO core: _init_accounts coroutine started
2026-09-21 11:40:16,686 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 11:40:16,689 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:45:23,492 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 11:45:29,019 INFO core: Event loop thread started, running loop forever
2026-09-21 11:45:29,320 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 11:45:29,325 INFO core: _init_accounts coroutine started
2026-09-21 11:45:29,327 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 11:45:29,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:50:40,147 INFO core: Event loop thread started, running loop forever
2026-09-21 11:50:40,448 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 11:50:40,453 INFO core: _init_accounts coroutine started
2026-09-21 11:50:40,454 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 11:50:40,464 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 11:55:45,429 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 11:55:45,431 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 11:55:45,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 11:55:45,434 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 11:55:45,438 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:00:09,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:05:15,481 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 12:05:15,481 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 12:05:15,481 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 12:05:33,709 INFO core: Event loop thread started, running loop forever
2026-09-21 12:05:34,010 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 12:05:34,014 INFO core: _init_accounts coroutine started
2026-09-21 12:05:34,016 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 12:05:34,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:10:38,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:15:24,321 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 12:15:24,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:15:24,321 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 12:20:14,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:25:05,147 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 12:25:05,167 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 12:25:05,186 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 12:25:05,187 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 12:25:05,191 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 12:25:05,192 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 12:25:05,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:30:12,429 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 12:30:12,429 WARNING core: Account 2: connect timed out after 35s
2026-09-21 12:30:12,430 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 12:30:12,430 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 12:30:12,431 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 12:30:12,431 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 12:30:12,432 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 12:30:38,032 INFO core: Event loop thread started, running loop forever
2026-09-21 12:30:38,335 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 12:30:38,338 INFO core: _init_accounts coroutine started
2026-09-21 12:30:38,338 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 12:30:38,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:35:13,764 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 12:35:13,774 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:40:50,689 INFO core: Event loop thread started, running loop forever
2026-09-21 12:40:50,990 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 12:40:51,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:45:31,638 INFO core: _init_accounts coroutine started
2026-09-21 12:45:31,640 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 12:45:31,644 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:50:33,480 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 12:50:33,480 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 12:50:33,483 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 12:50:33,484 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 12:50:33,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 12:55:33,304 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 12:55:33,305 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 12:55:33,308 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 12:55:33,309 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 12:55:33,311 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:00:07,447 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 13:00:07,448 WARNING core: Account 2: connect timed out after 35s
2026-09-21 13:00:07,448 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 13:00:07,448 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 13:00:07,449 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 13:00:07,450 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 13:00:07,450 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 13:00:37,480 INFO core: Event loop thread started, running loop forever
2026-09-21 13:00:37,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 13:00:37,787 INFO core: _init_accounts coroutine started
2026-09-21 13:00:37,787 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 13:00:37,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:05:18,679 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 13:05:18,679 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 13:05:18,681 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 13:05:18,683 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 13:05:18,690 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 13:05:18,691 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 13:05:18,694 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 13:05:18,695 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 13:05:18,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:10:25,372 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 13:10:25,374 WARNING core: Account 2: connect timed out after 35s
2026-09-21 13:10:25,374 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 13:10:25,375 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 13:10:25,376 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 13:10:25,377 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 13:10:25,377 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 13:10:25,380 INFO core: Event loop thread started, running loop forever
2026-09-21 13:10:25,681 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 13:10:25,687 INFO core: _init_accounts coroutine started
2026-09-21 13:10:25,688 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 13:10:25,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:10:25,701 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-21 13:15:35,304 INFO core: Event loop thread started, running loop forever
2026-09-21 13:15:35,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 13:15:35,608 INFO core: _init_accounts coroutine started
2026-09-21 13:15:35,609 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 13:15:35,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:20:41,167 INFO core: Event loop thread started, running loop forever
2026-09-21 13:20:41,159 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 13:20:41,469 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 13:20:41,475 INFO core: _init_accounts coroutine started
2026-09-21 13:20:41,475 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 13:20:41,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:25:42,759 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:25:42,766 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 13:30:15,146 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 13:30:15,152 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 13:30:15,154 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 13:30:15,157 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:35:22,514 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 13:35:22,514 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 13:35:22,514 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 13:35:28,667 INFO core: Event loop thread started, running loop forever
2026-09-21 13:35:28,968 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 13:35:28,974 INFO core: _init_accounts coroutine started
2026-09-21 13:35:28,974 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 13:35:29,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:40:35,456 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 13:40:35,456 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 13:40:35,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 13:40:35,465 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 13:40:35,466 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-21 13:40:35,466 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 13:40:35,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 13:40:53,903 INFO core: Event loop thread started, running loop forever
2026-09-21 13:40:54,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 13:40:54,211 INFO core: _init_accounts coroutine started
2026-09-21 13:40:54,213 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 13:40:54,339 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:45:46,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:50:29,293 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 13:50:29,304 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 13:55:25,724 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:00:27,719 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-21 14:00:27,720 INFO core: _init_accounts coroutine started
2026-09-21 14:00:27,720 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 14:00:27,724 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:05:33,468 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 14:05:51,681 INFO core: Event loop thread started, running loop forever
2026-09-21 14:05:51,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 14:05:51,989 INFO core: _init_accounts coroutine started
2026-09-21 14:05:51,991 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 14:05:51,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:10:04,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:15:08,305 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 14:15:08,332 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:20:44,089 INFO core: Event loop thread started, running loop forever
2026-09-21 14:20:44,390 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 14:20:44,395 INFO core: _init_accounts coroutine started
2026-09-21 14:20:44,396 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 14:20:44,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:25:05,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:30:12,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 14:30:38,544 INFO core: Event loop thread started, running loop forever
2026-09-21 14:30:38,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 14:30:38,848 INFO core: _init_accounts coroutine started
2026-09-21 14:30:38,850 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 14:30:38,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:35:45,424 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 14:35:50,571 INFO core: Event loop thread started, running loop forever
2026-09-21 14:35:50,874 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 14:35:50,879 INFO core: _init_accounts coroutine started
2026-09-21 14:35:50,880 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 14:35:50,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:40:28,715 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 14:40:28,717 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 14:40:28,721 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:45:14,956 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 14:45:14,959 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 14:45:14,971 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 14:45:14,971 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 14:45:14,975 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 14:45:14,976 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 14:45:14,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:50:51,795 INFO core: Event loop thread started, running loop forever
2026-09-21 14:50:52,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 14:50:52,100 INFO core: _init_accounts coroutine started
2026-09-21 14:50:52,101 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 14:50:52,108 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 14:55:27,275 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 14:55:27,275 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 14:55:27,279 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 14:55:27,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:00:09,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:00:09,723 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 15:05:38,441 INFO core: Event loop thread started, running loop forever
2026-09-21 15:05:38,742 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 15:05:38,745 INFO core: _init_accounts coroutine started
2026-09-21 15:05:38,747 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 15:05:38,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:10:29,735 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 15:10:29,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:15:09,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:20:49,370 INFO core: Event loop thread started, running loop forever
2026-09-21 15:20:49,671 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 15:20:49,674 INFO core: _init_accounts coroutine started
2026-09-21 15:20:49,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 15:20:49,682 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:25:46,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:30:24,070 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 15:30:24,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:35:39,369 INFO core: Event loop thread started, running loop forever
2026-09-21 15:35:39,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 15:35:39,675 INFO core: _init_accounts coroutine started
2026-09-21 15:35:39,675 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 15:35:39,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:40:22,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:45:28,398 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 15:45:40,664 INFO core: Event loop thread started, running loop forever
2026-09-21 15:45:40,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 15:45:40,969 INFO core: _init_accounts coroutine started
2026-09-21 15:45:40,969 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 15:45:40,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:50:21,878 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 15:50:21,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 15:55:19,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:00:19,125 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-21 16:00:19,126 INFO core: _init_accounts coroutine started
2026-09-21 16:00:19,126 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 16:00:19,130 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:05:14,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:10:07,086 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 16:10:07,087 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 16:10:07,089 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 16:10:07,092 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:15:24,372 INFO core: Event loop thread started, running loop forever
2026-09-21 16:15:24,673 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 16:15:24,679 INFO core: _init_accounts coroutine started
2026-09-21 16:15:24,679 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 16:15:24,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:20:13,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:25:19,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 16:25:41,279 INFO core: Event loop thread started, running loop forever
2026-09-21 16:25:41,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 16:25:41,586 INFO core: _init_accounts coroutine started
2026-09-21 16:25:41,586 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 16:25:41,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:30:15,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:35:21,114 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 16:35:21,116 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 16:35:21,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:35:21,120 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 16:40:45,655 INFO core: Event loop thread started, running loop forever
2026-09-21 16:40:45,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 16:40:45,975 INFO core: _init_accounts coroutine started
2026-09-21 16:40:45,975 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 16:40:45,980 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:45:31,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:50:11,668 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 16:55:15,820 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 16:55:15,820 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 16:55:15,839 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 16:55:15,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:00:19,637 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 17:00:19,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:05:27,335 INFO core: Event loop thread started, running loop forever
2026-09-21 17:05:27,637 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:05:27,640 INFO core: _init_accounts coroutine started
2026-09-21 17:05:27,641 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:05:27,647 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:10:34,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 17:10:43,024 INFO core: Event loop thread started, running loop forever
2026-09-21 17:10:43,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:10:43,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:15:15,698 INFO core: _init_accounts coroutine started
2026-09-21 17:15:15,698 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:15:15,709 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 17:15:15,709 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 17:15:15,710 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 17:15:15,712 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 17:15:15,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:20:21,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 17:20:37,986 INFO core: Event loop thread started, running loop forever
2026-09-21 17:20:38,287 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:20:38,290 INFO core: _init_accounts coroutine started
2026-09-21 17:20:38,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:20:38,297 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:25:17,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:30:24,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 17:30:29,024 INFO core: Event loop thread started, running loop forever
2026-09-21 17:30:29,325 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:30:29,329 INFO core: _init_accounts coroutine started
2026-09-21 17:30:29,331 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:30:29,339 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:35:42,197 INFO core: Event loop thread started, running loop forever
2026-09-21 17:35:42,498 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:35:42,504 INFO core: _init_accounts coroutine started
2026-09-21 17:35:42,504 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:35:42,511 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:40:50,222 INFO core: Event loop thread started, running loop forever
2026-09-21 17:40:50,523 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:40:50,526 INFO core: _init_accounts coroutine started
2026-09-21 17:40:50,528 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:40:50,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:45:20,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:50:27,464 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 17:50:27,464 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 17:50:27,464 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-21 17:50:27,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 17:50:27,465 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-21 17:50:27,465 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 17:50:27,465 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-21 17:50:27,465 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 17:50:27,465 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 17:50:34,929 INFO core: Event loop thread started, running loop forever
2026-09-21 17:50:35,230 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:50:35,235 INFO core: _init_accounts coroutine started
2026-09-21 17:50:35,235 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:50:35,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 17:55:42,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 17:55:50,975 INFO core: Event loop thread started, running loop forever
2026-09-21 17:55:51,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 17:55:51,281 INFO core: _init_accounts coroutine started
2026-09-21 17:55:51,283 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 17:55:51,288 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:00:07,554 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 18:00:07,594 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:05:30,902 INFO core: Event loop thread started, running loop forever
2026-09-21 18:05:31,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 18:05:31,210 INFO core: _init_accounts coroutine started
2026-09-21 18:05:31,211 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 18:05:31,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:10:35,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:15:36,989 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 18:15:36,990 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 18:15:36,996 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 18:15:36,997 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 18:15:37,007 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 18:15:37,008 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 18:15:37,011 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:20:22,489 INFO core: Event loop thread started, running loop forever
2026-09-21 18:20:22,791 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 18:20:22,798 INFO core: _init_accounts coroutine started
2026-09-21 18:20:22,799 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 18:20:22,813 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-21 18:20:22,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:20:44,521 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 18:20:44,523 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 18:25:09,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:30:34,890 INFO core: Event loop thread started, running loop forever
2026-09-21 18:30:35,191 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 18:30:35,204 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:35:36,456 INFO core: _init_accounts coroutine started
2026-09-21 18:35:36,456 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 18:35:36,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 18:35:36,473 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 18:35:36,475 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 18:35:36,476 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 18:35:36,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:40:43,453 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 18:40:50,045 INFO core: Event loop thread started, running loop forever
2026-09-21 18:40:50,347 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 18:40:50,350 INFO core: _init_accounts coroutine started
2026-09-21 18:40:50,352 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 18:40:50,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:45:12,813 INFO core: Event loop thread started, running loop forever
2026-09-21 18:45:13,114 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 18:45:13,118 INFO core: _init_accounts coroutine started
2026-09-21 18:45:13,118 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 18:45:13,124 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:50:11,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 18:55:17,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 18:55:36,790 INFO core: Event loop thread started, running loop forever
2026-09-21 18:55:37,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 18:55:37,104 INFO core: _init_accounts coroutine started
2026-09-21 18:55:37,104 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 18:55:37,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:00:49,201 INFO core: Event loop thread started, running loop forever
2026-09-21 19:00:49,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 19:00:49,505 INFO core: _init_accounts coroutine started
2026-09-21 19:00:49,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 19:00:49,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:05:28,621 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 19:05:28,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:10:34,383 INFO core: Event loop thread started, running loop forever
2026-09-21 19:10:34,683 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 19:10:34,688 INFO core: _init_accounts coroutine started
2026-09-21 19:10:34,688 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 19:10:34,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:15:26,320 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 19:15:26,320 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 19:15:26,322 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 19:15:26,324 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 19:15:26,328 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:20:33,392 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 19:20:33,392 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 19:20:33,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 19:20:50,325 INFO core: Event loop thread started, running loop forever
2026-09-21 19:20:50,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 19:20:50,633 INFO core: _init_accounts coroutine started
2026-09-21 19:20:50,633 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 19:20:50,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:25:44,634 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 19:25:44,635 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 19:25:44,636 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:25:44,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 19:30:48,058 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 19:30:48,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:35:42,100 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 19:35:42,101 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 19:35:42,105 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:40:06,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:40:06,473 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 19:45:13,421 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 19:45:27,911 INFO core: Event loop thread started, running loop forever
2026-09-21 19:45:28,212 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 19:45:28,215 INFO core: _init_accounts coroutine started
2026-09-21 19:45:28,216 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 19:45:28,225 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 19:45:28,225 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 19:45:28,226 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 19:45:28,227 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 19:45:28,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:50:25,474 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 19:50:25,474 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 19:50:25,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:50:25,479 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 19:50:25,480 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 19:55:05,826 WARNING core: Account 2: connect timed out after 35s
2026-09-21 19:55:05,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 19:55:05,871 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 19:55:05,872 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 19:55:05,873 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 19:55:05,873 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 19:55:05,874 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 20:00:11,410 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 20:00:11,412 WARNING core: Account 2: connect timed out after 35s
2026-09-21 20:00:11,413 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-21 20:00:11,414 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-21 20:00:11,414 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 20:00:11,416 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-21 20:00:11,416 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-21 20:00:28,285 INFO core: Event loop thread started, running loop forever
2026-09-21 20:00:28,588 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 20:00:28,592 INFO core: _init_accounts coroutine started
2026-09-21 20:00:28,594 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 20:00:28,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:05:14,114 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 20:05:14,115 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 20:05:14,116 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 20:05:14,117 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 20:05:14,125 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 20:05:14,126 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 20:05:14,134 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:10:10,812 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 20:10:10,815 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 20:10:10,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:15:10,011 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 20:15:10,012 WARNING core: Account 2: connect timed out after 35s
2026-09-21 20:15:10,013 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 20:15:10,013 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 20:15:10,014 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 20:15:10,016 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 20:15:10,016 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 20:15:10,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:20:17,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 20:20:17,379 WARNING core: Account 2: connect timed out after 35s
2026-09-21 20:20:17,379 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-21 20:20:17,380 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-21 20:20:17,380 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 20:20:17,381 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-21 20:20:17,381 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-21 20:20:28,198 INFO core: Event loop thread started, running loop forever
2026-09-21 20:20:28,500 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 20:20:28,507 INFO core: _init_accounts coroutine started
2026-09-21 20:20:28,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 20:20:28,511 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:25:14,342 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:30:21,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 20:30:21,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 20:30:21,513 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 20:30:21,514 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-21 20:30:22,292 INFO core: Event loop thread started, running loop forever
2026-09-21 20:30:22,594 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 20:30:22,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:35:12,013 INFO core: _init_accounts coroutine started
2026-09-21 20:35:12,013 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 20:35:12,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:40:49,143 INFO core: Event loop thread started, running loop forever
2026-09-21 20:40:49,444 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 20:40:49,447 INFO core: _init_accounts coroutine started
2026-09-21 20:40:49,449 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 20:40:49,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:45:38,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:50:26,396 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 20:50:26,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 20:55:26,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:00:13,936 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-21 21:00:13,943 INFO core: _init_accounts coroutine started
2026-09-21 21:00:13,944 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 21:00:13,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:05:50,729 INFO core: Event loop thread started, running loop forever
2026-09-21 21:05:51,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 21:05:51,035 INFO core: _init_accounts coroutine started
2026-09-21 21:05:51,036 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 21:05:51,044 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 21:05:51,044 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 21:05:51,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:10:24,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 21:10:24,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:15:12,444 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 21:15:12,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:20:12,846 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 21:20:12,846 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 21:20:12,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:20:12,853 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 21:20:12,854 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 21:25:18,433 WARNING core: Account 2: connect timed out after 35s
2026-09-21 21:25:18,434 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 21:25:18,434 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 21:25:18,435 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 21:25:18,436 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 21:25:36,721 INFO core: Event loop thread started, running loop forever
2026-09-21 21:25:37,022 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 21:25:37,027 INFO core: _init_accounts coroutine started
2026-09-21 21:25:37,028 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 21:25:37,043 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 21:25:37,043 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 21:25:37,046 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 21:25:37,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:30:31,007 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 21:30:31,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:35:30,886 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 21:35:30,890 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:35:31,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 21:40:35,954 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:45:26,418 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 21:45:26,420 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 21:45:26,436 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:50:27,045 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 21:50:27,046 WARNING core: Account 2: connect timed out after 35s
2026-09-21 21:50:27,047 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 21:50:27,048 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 21:50:27,049 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 21:50:27,050 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 21:50:27,050 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 21:50:27,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 21:55:28,637 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 21:55:28,637 WARNING core: Account 2: connect timed out after 35s
2026-09-21 21:55:28,637 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-21 21:55:28,637 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-21 21:55:28,638 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 21:55:28,638 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-21 21:55:28,638 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-21 21:55:28,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:00:17,137 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 22:00:17,137 WARNING core: Account 2: connect timed out after 35s
2026-09-21 22:00:17,137 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-21 22:00:17,137 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-21 22:00:17,138 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 22:00:17,138 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-21 22:00:17,138 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-21 22:00:17,156 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:05:09,763 INFO core: Event loop thread started, running loop forever
2026-09-21 22:05:10,064 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 22:05:10,069 INFO core: _init_accounts coroutine started
2026-09-21 22:05:10,071 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 22:05:10,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:10:17,507 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 22:10:37,576 INFO core: Event loop thread started, running loop forever
2026-09-21 22:10:37,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 22:10:37,882 INFO core: _init_accounts coroutine started
2026-09-21 22:10:37,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 22:10:37,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:15:38,686 INFO core: Event loop thread started, running loop forever
2026-09-21 22:15:38,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 22:15:38,991 INFO core: _init_accounts coroutine started
2026-09-21 22:15:38,991 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 22:15:38,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:20:44,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 22:20:45,840 INFO core: Event loop thread started, running loop forever
2026-09-21 22:20:46,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 22:20:46,148 INFO core: _init_accounts coroutine started
2026-09-21 22:20:46,149 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 22:20:46,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:25:50,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:30:47,520 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-21 22:30:47,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:35:24,623 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:40:49,190 INFO core: Event loop thread started, running loop forever
2026-09-21 22:40:49,491 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 22:40:49,496 INFO core: _init_accounts coroutine started
2026-09-21 22:40:49,497 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 22:40:49,505 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:45:35,432 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 22:45:35,433 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 22:45:35,441 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:50:34,687 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 22:55:40,398 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 22:55:40,399 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-21 22:55:40,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 22:55:40,400 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-21 22:55:40,401 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 22:55:45,349 INFO core: Event loop thread started, running loop forever
2026-09-21 22:55:45,650 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 22:55:45,654 INFO core: _init_accounts coroutine started
2026-09-21 22:55:45,655 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 22:55:45,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:00:22,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:05:12,956 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 23:05:12,957 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 23:05:12,997 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:10:31,695 INFO core: Event loop thread started, running loop forever
2026-09-21 23:10:31,999 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 23:10:32,009 INFO core: _init_accounts coroutine started
2026-09-21 23:10:32,010 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 23:10:32,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:15:14,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:20:19,050 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-21 23:20:19,051 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-21 23:20:19,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:25:21,883 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-21 23:25:21,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:30:19,133 INFO core: _init_accounts_inner: reloading LLM config
2026-09-21 23:30:19,158 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-21 23:30:19,158 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-21 23:30:19,166 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-21 23:30:19,167 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-21 23:30:19,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:35:07,286 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 23:35:07,286 WARNING core: Account 2: connect timed out after 35s
2026-09-21 23:35:07,287 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-21 23:35:07,287 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-21 23:35:07,288 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 23:35:07,290 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-21 23:35:07,290 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-21 23:35:07,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:40:10,329 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 23:40:10,330 WARNING core: Account 2: connect timed out after 35s
2026-09-21 23:40:10,330 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-21 23:40:10,330 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-21 23:40:10,331 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-21 23:40:10,331 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-21 23:40:10,332 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-21 23:40:10,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:45:16,435 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-21 23:45:28,982 INFO core: Event loop thread started, running loop forever
2026-09-21 23:45:29,284 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 23:45:29,289 INFO core: _init_accounts coroutine started
2026-09-21 23:45:29,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:45:29,293 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 23:50:19,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-21 23:55:26,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-21 23:55:28,894 INFO core: Event loop thread started, running loop forever
2026-09-21 23:55:29,196 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-21 23:55:29,202 INFO core: _init_accounts coroutine started
2026-09-21 23:55:29,203 INFO core: _init_accounts_inner: starting DB migrations
2026-09-21 23:55:29,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:00:09,535 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 00:00:09,535 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 00:00:09,538 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 00:00:09,553 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 00:00:09,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:05:11,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:05:52,440 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 00:05:52,441 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 00:05:52,446 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 00:05:52,448 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 00:05:52,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:10:04,892 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 00:10:04,893 WARNING core: Account 2: connect timed out after 35s
2026-09-22 00:10:04,893 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 00:10:04,894 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 00:10:04,894 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 00:10:04,896 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 00:10:04,896 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 00:10:04,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:15:10,426 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 00:15:10,427 WARNING core: Account 2: connect timed out after 35s
2026-09-22 00:15:10,428 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-22 00:15:10,428 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-22 00:15:10,429 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 00:15:10,430 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-22 00:15:10,430 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-22 00:15:45,257 INFO core: Event loop thread started, running loop forever
2026-09-22 00:15:45,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 00:15:45,566 INFO core: _init_accounts coroutine started
2026-09-22 00:15:45,567 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 00:15:45,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:20:45,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:25:49,821 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 00:25:49,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:30:41,081 INFO core: Event loop thread started, running loop forever
2026-09-22 00:30:41,386 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 00:30:41,390 INFO core: _init_accounts coroutine started
2026-09-22 00:30:41,391 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 00:30:41,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:35:44,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:40:49,023 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 00:40:49,029 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:45:39,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:50:25,524 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 00:50:25,531 INFO core: _init_accounts coroutine started
2026-09-22 00:50:25,531 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 00:50:25,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 00:55:32,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 00:55:48,328 INFO core: Event loop thread started, running loop forever
2026-09-22 00:55:48,629 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 00:55:48,767 INFO core: _init_accounts coroutine started
2026-09-22 00:55:48,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 00:55:48,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:00:52,948 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 01:00:52,949 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 01:00:52,950 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 01:00:52,951 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 01:00:52,965 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 01:00:52,966 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 01:00:52,970 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 01:00:52,971 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 01:00:52,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:05:22,631 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 01:05:22,632 WARNING core: Account 2: connect timed out after 35s
2026-09-22 01:05:22,633 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 01:05:22,633 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 01:05:22,634 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 01:05:22,635 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 01:05:22,636 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 01:05:22,638 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:10:29,397 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 01:10:29,398 WARNING core: Account 2: connect timed out after 35s
2026-09-22 01:10:29,399 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-22 01:10:44,939 INFO core: Event loop thread started, running loop forever
2026-09-22 01:10:45,240 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 01:10:45,244 INFO core: _init_accounts coroutine started
2026-09-22 01:10:45,245 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 01:10:45,252 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:15:46,443 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 01:15:46,443 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 01:15:46,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:20:53,396 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 01:20:53,400 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 01:20:53,667 INFO core: Event loop thread started, running loop forever
2026-09-22 01:20:53,969 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 01:20:53,973 INFO core: _init_accounts coroutine started
2026-09-22 01:20:53,973 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 01:20:53,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:25:17,230 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-22 01:25:17,251 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-22 01:30:29,492 INFO core: Event loop thread started, running loop forever
2026-09-22 01:30:29,793 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 01:30:29,796 INFO core: _init_accounts coroutine started
2026-09-22 01:30:29,797 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 01:30:29,810 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 01:30:29,811 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 01:30:29,812 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 01:30:29,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:30:29,814 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 01:35:36,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 01:35:41,158 INFO core: Event loop thread started, running loop forever
2026-09-22 01:35:41,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 01:35:41,469 INFO core: _init_accounts coroutine started
2026-09-22 01:35:41,470 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 01:35:41,505 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 01:35:41,506 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 01:35:41,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:35:41,508 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 01:35:41,513 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 01:40:50,407 INFO core: Event loop thread started, running loop forever
2026-09-22 01:40:50,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 01:40:50,711 INFO core: _init_accounts coroutine started
2026-09-22 01:40:50,713 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 01:40:50,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:45:04,488 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 01:45:04,488 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 01:45:04,489 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 01:45:04,491 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 01:45:04,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:50:06,487 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 01:50:06,488 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 01:50:06,500 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 01:50:06,501 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 01:50:06,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 01:55:13,411 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 01:55:13,412 WARNING core: Account 2: connect timed out after 35s
2026-09-22 01:55:13,413 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 01:55:13,413 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 01:55:13,416 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 01:55:13,417 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 01:55:13,417 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 01:55:42,391 INFO core: Event loop thread started, running loop forever
2026-09-22 01:55:42,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 01:55:42,700 INFO core: _init_accounts coroutine started
2026-09-22 01:55:42,701 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 01:55:42,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:00:36,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:05:27,408 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:10:34,478 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 02:10:49,978 INFO core: Event loop thread started, running loop forever
2026-09-22 02:10:50,279 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 02:10:50,284 INFO core: _init_accounts coroutine started
2026-09-22 02:10:50,284 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 02:10:50,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:15:30,192 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 02:15:30,192 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 02:15:30,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:15:30,195 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 02:20:16,875 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 02:20:16,883 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:25:26,375 INFO core: Event loop thread started, running loop forever
2026-09-22 02:25:26,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 02:25:26,680 INFO core: _init_accounts coroutine started
2026-09-22 02:25:26,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 02:25:26,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:30:52,966 INFO core: Event loop thread started, running loop forever
2026-09-22 02:30:53,267 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 02:30:53,280 INFO core: _init_accounts coroutine started
2026-09-22 02:30:53,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 02:30:53,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:35:41,356 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 02:35:41,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:35:41,368 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 02:40:34,398 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 02:40:34,409 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 02:40:34,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:40:34,427 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 02:45:06,321 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 02:45:06,323 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 02:45:15,718 INFO core: Event loop thread started, running loop forever
2026-09-22 02:45:16,019 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 02:45:16,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:50:06,478 INFO core: _init_accounts coroutine started
2026-09-22 02:50:06,481 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 02:50:06,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 02:55:13,355 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 02:55:34,903 INFO core: Event loop thread started, running loop forever
2026-09-22 02:55:35,203 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 02:55:35,207 INFO core: _init_accounts coroutine started
2026-09-22 02:55:35,208 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 02:55:35,214 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:00:18,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:05:25,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 03:05:25,459 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 03:05:25,459 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-22 03:05:25,460 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 03:05:25,460 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-22 03:05:25,460 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 03:05:25,460 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-22 03:05:25,460 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 03:05:25,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 03:05:37,521 INFO core: Event loop thread started, running loop forever
2026-09-22 03:05:37,826 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 03:05:37,836 INFO core: _init_accounts coroutine started
2026-09-22 03:05:37,836 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 03:05:37,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:10:41,040 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 03:10:41,042 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 03:10:41,048 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 03:10:41,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:15:26,281 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 03:15:26,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:20:13,549 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:25:20,474 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 03:25:20,477 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 03:25:20,477 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 03:25:28,735 INFO core: Event loop thread started, running loop forever
2026-09-22 03:25:29,036 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 03:25:29,043 INFO core: _init_accounts coroutine started
2026-09-22 03:25:29,044 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 03:25:29,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:30:27,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:35:09,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:40:47,140 INFO core: Event loop thread started, running loop forever
2026-09-22 03:40:47,441 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 03:40:47,446 INFO core: _init_accounts coroutine started
2026-09-22 03:40:47,447 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 03:40:47,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:45:40,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:50:25,186 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 03:50:25,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 03:55:33,539 INFO core: Event loop thread started, running loop forever
2026-09-22 03:55:33,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 03:55:33,845 INFO core: _init_accounts coroutine started
2026-09-22 03:55:33,847 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 03:55:33,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:00:24,632 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:05:42,179 INFO core: Event loop thread started, running loop forever
2026-09-22 04:05:42,480 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 04:05:42,485 INFO core: _init_accounts coroutine started
2026-09-22 04:05:42,485 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 04:05:42,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:10:08,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:15:14,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 04:15:48,406 INFO core: Event loop thread started, running loop forever
2026-09-22 04:15:48,706 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 04:15:48,713 INFO core: _init_accounts coroutine started
2026-09-22 04:15:48,714 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 04:15:48,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:20:18,887 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 04:20:18,888 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 04:20:18,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:25:10,928 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 04:25:10,937 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:30:28,903 INFO core: Event loop thread started, running loop forever
2026-09-22 04:30:29,205 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 04:30:29,211 INFO core: _init_accounts coroutine started
2026-09-22 04:30:29,211 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 04:30:29,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:35:35,477 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 04:35:48,804 INFO core: Event loop thread started, running loop forever
2026-09-22 04:35:49,106 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 04:35:49,116 INFO core: _init_accounts coroutine started
2026-09-22 04:35:49,117 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 04:35:49,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:40:27,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:45:31,996 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 04:45:31,996 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 04:45:32,006 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 04:45:32,012 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 04:45:32,013 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:50:14,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 04:55:21,402 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 04:55:21,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 04:55:21,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 04:55:45,213 INFO core: Event loop thread started, running loop forever
2026-09-22 04:55:45,514 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 04:55:45,519 INFO core: _init_accounts coroutine started
2026-09-22 04:55:45,520 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 04:55:45,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:00:07,358 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 05:00:50,038 INFO core: Event loop thread started, running loop forever
2026-09-22 05:00:50,339 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 05:00:50,342 INFO core: _init_accounts coroutine started
2026-09-22 05:00:50,343 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 05:00:50,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:05:32,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:10:29,059 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 05:10:29,060 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 05:10:29,069 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 05:10:29,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:10:29,072 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 05:15:36,510 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 05:15:36,510 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 05:15:36,510 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 05:15:38,298 INFO core: Event loop thread started, running loop forever
2026-09-22 05:15:38,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 05:15:38,607 INFO core: _init_accounts coroutine started
2026-09-22 05:15:38,607 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 05:15:38,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:20:16,973 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 05:20:17,037 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:25:05,809 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 05:25:05,822 INFO core: _init_accounts coroutine started
2026-09-22 05:25:05,822 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 05:25:05,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:30:11,454 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 05:30:33,220 INFO core: Event loop thread started, running loop forever
2026-09-22 05:30:33,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 05:30:33,525 INFO core: _init_accounts coroutine started
2026-09-22 05:30:33,528 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 05:30:33,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:35:24,036 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 05:35:24,081 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:40:49,353 INFO core: Event loop thread started, running loop forever
2026-09-22 05:40:49,654 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 05:40:49,657 INFO core: _init_accounts coroutine started
2026-09-22 05:40:49,658 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 05:40:49,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:45:51,227 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 05:45:51,230 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 05:45:51,238 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 05:45:51,238 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:50:16,319 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 05:50:16,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 05:55:23,553 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 05:55:42,120 INFO core: Event loop thread started, running loop forever
2026-09-22 05:55:42,421 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 05:55:42,426 INFO core: _init_accounts coroutine started
2026-09-22 05:55:42,427 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 05:55:42,435 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:00:48,050 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 06:00:48,078 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:05:39,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:10:48,807 INFO core: Event loop thread started, running loop forever
2026-09-22 06:10:49,108 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 06:10:49,111 INFO core: _init_accounts coroutine started
2026-09-22 06:10:49,111 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 06:10:49,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:15:24,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:20:31,420 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 06:20:47,331 INFO core: Event loop thread started, running loop forever
2026-09-22 06:20:47,632 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 06:20:47,635 INFO core: _init_accounts coroutine started
2026-09-22 06:20:47,636 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 06:20:47,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:25:18,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:30:24,385 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 06:30:42,306 INFO core: Event loop thread started, running loop forever
2026-09-22 06:30:42,607 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 06:30:42,611 INFO core: _init_accounts coroutine started
2026-09-22 06:30:42,612 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 06:30:42,617 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:35:39,165 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:40:36,612 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 06:40:36,612 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 06:40:36,629 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 06:40:36,641 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 06:40:36,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:45:10,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:50:14,014 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 06:50:14,014 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 06:50:14,019 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 06:50:14,020 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 06:50:14,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 06:55:05,125 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 06:55:05,126 WARNING core: Account 2: connect timed out after 35s
2026-09-22 06:55:05,126 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 06:55:05,127 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 06:55:05,128 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 06:55:05,129 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 06:55:05,129 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 06:55:05,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:00:12,451 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 07:00:12,453 WARNING core: Account 2: connect timed out after 35s
2026-09-22 07:00:30,821 INFO core: Event loop thread started, running loop forever
2026-09-22 07:00:31,122 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 07:00:31,128 INFO core: _init_accounts coroutine started
2026-09-22 07:00:31,128 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 07:00:31,145 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:05:20,619 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 07:05:20,619 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 07:05:20,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:10:22,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 07:10:22,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:10:22,438 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 07:15:04,532 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 07:15:04,532 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 07:15:04,532 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 07:15:53,348 INFO core: Event loop thread started, running loop forever
2026-09-22 07:15:53,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 07:15:53,653 INFO core: _init_accounts coroutine started
2026-09-22 07:15:53,654 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 07:15:53,660 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:20:23,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:25:22,544 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 07:25:22,544 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 07:25:22,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:30:29,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 07:30:29,414 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-22 07:30:29,415 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 07:30:44,825 INFO core: Event loop thread started, running loop forever
2026-09-22 07:30:45,126 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 07:30:45,129 INFO core: _init_accounts coroutine started
2026-09-22 07:30:45,131 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 07:30:45,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:35:46,523 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 07:35:46,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:40:28,621 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:45:32,310 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 07:45:32,311 INFO core: _init_accounts coroutine started
2026-09-22 07:45:32,311 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 07:45:32,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:50:31,591 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 07:50:31,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:55:10,800 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 07:55:10,800 INFO core: _init_accounts coroutine started
2026-09-22 07:55:10,801 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 07:55:10,837 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 07:55:10,837 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 07:55:10,838 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 07:55:10,839 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 07:55:10,840 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 08:00:28,399 INFO core: Event loop thread started, running loop forever
2026-09-22 08:00:28,700 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 08:00:28,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:05:35,442 INFO core: _init_accounts coroutine started
2026-09-22 08:05:35,444 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 08:05:36,333 INFO core: Event loop thread started, running loop forever
2026-09-22 08:05:36,634 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 08:05:36,637 INFO core: _init_accounts coroutine started
2026-09-22 08:05:36,639 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 08:05:36,645 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:10:37,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:15:30,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:20:04,038 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 08:20:04,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:25:21,296 INFO core: Event loop thread started, running loop forever
2026-09-22 08:25:21,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 08:25:21,602 INFO core: _init_accounts coroutine started
2026-09-22 08:25:21,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 08:25:21,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:30:21,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:35:18,992 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:40:31,788 INFO core: Event loop thread started, running loop forever
2026-09-22 08:40:32,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 08:40:32,094 INFO core: _init_accounts coroutine started
2026-09-22 08:40:32,095 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 08:40:32,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:45:23,922 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 08:45:23,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:45:23,929 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 08:50:11,753 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 08:50:11,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 08:55:18,443 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 08:55:18,479 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 08:55:18,480 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 08:55:18,480 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 08:55:29,506 INFO core: Event loop thread started, running loop forever
2026-09-22 08:55:29,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 08:55:29,818 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:00:36,418 INFO core: _init_accounts coroutine started
2026-09-22 09:00:36,419 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 09:00:52,698 INFO core: Event loop thread started, running loop forever
2026-09-22 09:00:52,999 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 09:00:53,002 INFO core: _init_accounts coroutine started
2026-09-22 09:00:53,005 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 09:00:53,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:05:13,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:10:20,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 09:10:44,834 INFO core: Event loop thread started, running loop forever
2026-09-22 09:10:45,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 09:10:45,140 INFO core: _init_accounts coroutine started
2026-09-22 09:10:45,140 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 09:10:45,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:15:05,839 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 09:15:05,839 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 09:15:05,842 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:15:05,843 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 09:20:12,418 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 09:20:12,418 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-22 09:20:12,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 09:20:12,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 09:20:33,188 INFO core: Event loop thread started, running loop forever
2026-09-22 09:20:33,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 09:20:33,492 INFO core: _init_accounts coroutine started
2026-09-22 09:20:33,493 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 09:20:33,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:25:43,049 INFO core: Event loop thread started, running loop forever
2026-09-22 09:25:43,350 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 09:25:43,354 INFO core: _init_accounts coroutine started
2026-09-22 09:25:43,355 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 09:25:43,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:30:28,031 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 09:30:28,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:35:14,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:40:34,435 INFO core: Event loop thread started, running loop forever
2026-09-22 09:40:34,736 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 09:40:34,740 INFO core: _init_accounts coroutine started
2026-09-22 09:40:34,741 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 09:40:34,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:45:32,512 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 09:45:32,512 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 09:45:32,513 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 09:45:32,521 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 09:45:32,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:50:30,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 09:55:17,411 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 09:55:17,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 09:55:17,422 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 09:55:17,423 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 09:55:17,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:00:24,433 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 10:00:24,434 WARNING core: Account 2: connect timed out after 35s
2026-09-22 10:00:42,316 INFO core: Event loop thread started, running loop forever
2026-09-22 10:00:42,618 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 10:00:42,623 INFO core: _init_accounts coroutine started
2026-09-22 10:00:42,623 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 10:00:42,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:05:34,076 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 10:05:34,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:10:39,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:15:18,360 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 10:15:18,367 INFO core: _init_accounts coroutine started
2026-09-22 10:15:18,367 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 10:15:18,371 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:15:18,373 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 10:20:24,389 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 10:20:51,773 INFO core: Event loop thread started, running loop forever
2026-09-22 10:20:52,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 10:20:52,081 INFO core: _init_accounts coroutine started
2026-09-22 10:20:52,081 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 10:20:52,088 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:25:43,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:30:49,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:30:49,058 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 10:35:08,701 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:40:19,858 INFO core: Event loop thread started, running loop forever
2026-09-22 10:40:20,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 10:40:20,164 INFO core: _init_accounts coroutine started
2026-09-22 10:40:20,165 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 10:40:20,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:45:16,273 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 10:45:16,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:50:07,743 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 10:55:12,050 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 10:55:12,051 INFO core: _init_accounts coroutine started
2026-09-22 10:55:12,051 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 10:55:12,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:00:19,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 11:00:21,575 INFO core: Event loop thread started, running loop forever
2026-09-22 11:00:21,876 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 11:00:21,882 INFO core: _init_accounts coroutine started
2026-09-22 11:00:21,882 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 11:00:21,893 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 11:00:21,893 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 11:00:21,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:05:33,627 INFO core: Event loop thread started, running loop forever
2026-09-22 11:05:33,928 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 11:05:33,931 INFO core: _init_accounts coroutine started
2026-09-22 11:05:33,934 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 11:05:33,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:10:49,032 INFO core: Event loop thread started, running loop forever
2026-09-22 11:10:49,334 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 11:10:49,338 INFO core: _init_accounts coroutine started
2026-09-22 11:10:49,339 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 11:10:49,351 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:15:15,548 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 11:15:15,548 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 11:15:15,554 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 11:15:15,560 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 11:15:15,566 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:20:18,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:25:15,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:30:08,417 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 11:30:08,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 11:30:08,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:35:38,375 INFO core: Event loop thread started, running loop forever
2026-09-22 11:35:38,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 11:35:38,679 INFO core: _init_accounts coroutine started
2026-09-22 11:35:38,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 11:35:38,688 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:40:18,422 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:45:13,756 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 11:45:13,757 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 11:45:13,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:50:11,785 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 11:50:11,808 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 11:50:11,832 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 11:50:11,832 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 11:50:11,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:55:18,794 INFO core: Event loop thread started, running loop forever
2026-09-22 11:55:19,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 11:55:19,099 INFO core: _init_accounts coroutine started
2026-09-22 11:55:19,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 11:55:19,110 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 12:00:11,709 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 12:00:27,168 INFO core: Event loop thread started, running loop forever
2026-09-22 12:00:27,471 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 12:00:27,474 INFO core: _init_accounts coroutine started
2026-09-22 12:00:27,475 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 12:00:27,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:05:05,809 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 12:05:05,812 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 12:05:05,814 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 12:05:05,816 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 12:05:05,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:10:04,364 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 12:10:04,365 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 12:10:04,371 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 12:10:04,372 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 12:10:04,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:15:11,426 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 12:15:11,937 INFO core: Event loop thread started, running loop forever
2026-09-22 12:15:12,238 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 12:15:12,243 INFO core: _init_accounts coroutine started
2026-09-22 12:15:12,245 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 12:15:12,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:15:12,275 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 12:15:12,275 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 12:15:12,280 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 12:15:12,284 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 12:20:07,361 INFO core: Event loop thread started, running loop forever
2026-09-22 12:20:07,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 12:20:07,668 INFO core: _init_accounts coroutine started
2026-09-22 12:20:07,668 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 12:20:07,680 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-22 12:20:07,682 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-22 12:20:19,391 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 12:20:19,391 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 12:20:19,392 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 12:25:35,558 INFO core: Event loop thread started, running loop forever
2026-09-22 12:25:35,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 12:25:35,863 INFO core: _init_accounts coroutine started
2026-09-22 12:25:35,864 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 12:25:35,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:30:27,045 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:35:26,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:40:07,025 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 12:40:07,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:45:23,188 INFO core: Event loop thread started, running loop forever
2026-09-22 12:45:23,491 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 12:45:23,495 INFO core: _init_accounts coroutine started
2026-09-22 12:45:23,497 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 12:45:23,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:50:51,288 INFO core: Event loop thread started, running loop forever
2026-09-22 12:50:51,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 12:50:51,593 INFO core: _init_accounts coroutine started
2026-09-22 12:50:51,596 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 12:50:51,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 12:55:28,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:00:38,437 INFO core: Event loop thread started, running loop forever
2026-09-22 13:00:38,739 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 13:00:38,742 INFO core: _init_accounts coroutine started
2026-09-22 13:00:38,744 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 13:00:38,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:05:40,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:10:49,495 INFO core: Event loop thread started, running loop forever
2026-09-22 13:10:49,797 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 13:10:49,801 INFO core: _init_accounts coroutine started
2026-09-22 13:10:49,802 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 13:10:49,814 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:15:09,451 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:20:15,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 13:20:15,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 13:20:15,427 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 13:20:15,427 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-22 13:20:15,428 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 13:20:15,428 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-22 13:20:15,428 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 13:20:15,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 13:20:32,717 INFO core: Event loop thread started, running loop forever
2026-09-22 13:20:33,019 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 13:20:33,024 INFO core: _init_accounts coroutine started
2026-09-22 13:20:33,025 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 13:20:33,036 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 13:20:33,036 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 13:20:33,037 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 13:20:33,039 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 13:20:33,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:25:23,076 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:30:30,440 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 13:30:47,009 INFO core: Event loop thread started, running loop forever
2026-09-22 13:30:47,312 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 13:30:47,316 INFO core: _init_accounts coroutine started
2026-09-22 13:30:47,317 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 13:30:47,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:35:43,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:40:12,055 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 13:40:12,056 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 13:40:12,057 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 13:40:12,058 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 13:40:12,075 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 13:40:12,076 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 13:40:12,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:45:12,827 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 13:45:12,828 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 13:45:12,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:50:09,481 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 13:50:09,482 WARNING core: Account 2: connect timed out after 35s
2026-09-22 13:50:09,482 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 13:50:09,483 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 13:50:09,484 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 13:50:09,485 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 13:50:09,485 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 13:50:09,506 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 13:55:16,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 13:55:16,417 WARNING core: Account 2: connect timed out after 35s
2026-09-22 13:55:16,418 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-22 13:55:16,418 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-22 13:55:16,418 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 13:55:16,419 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-22 13:55:16,419 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-22 13:55:23,669 INFO core: Event loop thread started, running loop forever
2026-09-22 13:55:23,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 13:55:23,974 INFO core: _init_accounts coroutine started
2026-09-22 13:55:23,975 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 13:55:23,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:00:20,255 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 14:00:20,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:05:44,164 INFO core: Event loop thread started, running loop forever
2026-09-22 14:05:44,472 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 14:05:44,480 INFO core: _init_accounts coroutine started
2026-09-22 14:05:44,480 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 14:05:44,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:10:42,660 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:15:07,885 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 14:15:07,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:20:18,209 INFO core: Event loop thread started, running loop forever
2026-09-22 14:20:18,509 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 14:20:18,514 INFO core: _init_accounts coroutine started
2026-09-22 14:20:18,514 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 14:20:18,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:25:09,251 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 14:25:09,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:30:50,346 INFO core: Event loop thread started, running loop forever
2026-09-22 14:30:50,648 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 14:30:50,655 INFO core: _init_accounts coroutine started
2026-09-22 14:30:50,655 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 14:30:50,661 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:35:35,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:40:33,560 INFO core: Event loop thread started, running loop forever
2026-09-22 14:40:33,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 14:40:33,864 INFO core: _init_accounts coroutine started
2026-09-22 14:40:33,865 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 14:40:33,872 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:40:42,563 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 14:45:27,517 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 14:45:27,518 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 14:45:27,520 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 14:45:27,522 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 14:45:27,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:50:35,555 INFO core: Event loop thread started, running loop forever
2026-09-22 14:50:35,856 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 14:50:35,861 INFO core: _init_accounts coroutine started
2026-09-22 14:50:35,862 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 14:50:35,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 14:55:31,795 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 14:55:31,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 14:55:31,800 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 14:55:31,803 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 14:55:31,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:00:37,444 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 15:00:48,212 INFO core: Event loop thread started, running loop forever
2026-09-22 15:00:48,513 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 15:00:48,518 INFO core: _init_accounts coroutine started
2026-09-22 15:00:48,521 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 15:00:48,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:05:18,811 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 15:05:18,811 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 15:05:18,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:10:09,923 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 15:10:09,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:15:12,929 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 15:15:12,938 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:20:19,446 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 15:20:19,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 15:20:19,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 15:20:25,550 INFO core: Event loop thread started, running loop forever
2026-09-22 15:20:25,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 15:20:25,856 INFO core: _init_accounts coroutine started
2026-09-22 15:20:25,858 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 15:20:25,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:25:23,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:30:09,439 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 15:30:09,440 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 15:30:09,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 15:30:09,443 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 15:30:09,446 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:35:16,472 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 15:35:16,473 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 15:35:16,473 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 15:35:34,487 INFO core: Event loop thread started, running loop forever
2026-09-22 15:35:34,788 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 15:35:34,793 INFO core: _init_accounts coroutine started
2026-09-22 15:35:34,793 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 15:35:34,816 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 15:35:34,817 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 15:35:34,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:40:36,988 INFO core: Event loop thread started, running loop forever
2026-09-22 15:40:37,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 15:40:37,294 INFO core: _init_accounts coroutine started
2026-09-22 15:40:37,294 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 15:40:37,311 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:40:40,989 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 15:45:33,382 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:50:18,064 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 15:50:18,064 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 15:50:18,100 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 15:50:18,102 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 15:50:18,114 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 15:50:18,114 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 15:50:18,123 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 15:50:18,125 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 15:50:18,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 15:55:25,436 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 15:55:25,437 WARNING core: Account 2: connect timed out after 35s
2026-09-22 15:55:25,437 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 15:55:25,438 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 15:55:25,439 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 15:55:25,440 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 15:55:25,440 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 15:55:39,441 INFO core: Event loop thread started, running loop forever
2026-09-22 15:55:39,743 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 15:55:39,746 INFO core: _init_accounts coroutine started
2026-09-22 15:55:39,748 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 15:55:39,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:00:11,914 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 16:00:11,914 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 16:00:11,915 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 16:00:11,916 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 16:00:11,928 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 16:00:11,928 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 16:00:11,932 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 16:00:11,933 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 16:00:11,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:05:48,419 INFO core: Event loop thread started, running loop forever
2026-09-22 16:05:48,720 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 16:05:48,724 INFO core: _init_accounts coroutine started
2026-09-22 16:05:48,726 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 16:05:48,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:10:39,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:15:19,920 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 16:15:19,921 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 16:15:19,923 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 16:15:19,928 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 16:15:19,941 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 16:15:19,941 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 16:15:19,950 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 16:15:19,951 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 16:15:19,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:20:26,474 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 16:20:26,474 WARNING core: Account 2: connect timed out after 35s
2026-09-22 16:20:26,475 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 16:20:26,475 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 16:20:26,476 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 16:20:26,477 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 16:20:26,478 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 16:20:50,648 INFO core: Event loop thread started, running loop forever
2026-09-22 16:20:50,949 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 16:20:50,953 INFO core: _init_accounts coroutine started
2026-09-22 16:20:50,954 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 16:20:50,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:25:54,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:30:49,544 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 16:30:49,545 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 16:30:49,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 16:30:49,565 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 16:30:49,584 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 16:30:49,584 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 16:30:49,591 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 16:30:49,593 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 16:30:49,599 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:35:44,444 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 16:35:44,446 WARNING core: Account 2: connect timed out after 35s
2026-09-22 16:35:44,446 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 16:35:44,447 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 16:35:44,447 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 16:35:44,448 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 16:35:44,449 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 16:35:44,478 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:40:26,364 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 16:40:26,365 WARNING core: Account 2: connect timed out after 35s
2026-09-22 16:40:26,373 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-22 16:40:26,373 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-22 16:40:26,374 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 16:40:26,374 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-22 16:40:26,375 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-22 16:40:26,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:45:33,429 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 16:45:33,430 WARNING core: Account 2: connect timed out after 35s
2026-09-22 16:45:33,430 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-22 16:45:33,431 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-22 16:45:33,431 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 16:45:33,432 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-22 16:45:39,088 INFO core: Event loop thread started, running loop forever
2026-09-22 16:45:39,390 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 16:45:39,395 INFO core: _init_accounts coroutine started
2026-09-22 16:45:39,395 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 16:45:39,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 16:45:39,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 16:45:39,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 16:45:39,408 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:45:39,409 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 16:50:29,252 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:55:15,835 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 16:55:15,837 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 16:55:15,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 16:55:15,843 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 16:55:15,844 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 17:00:10,443 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 17:00:10,444 WARNING core: Account 2: connect timed out after 35s
2026-09-22 17:00:10,444 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 17:00:10,446 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 17:00:10,447 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 17:00:10,448 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 17:00:10,449 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 17:00:10,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:05:17,444 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 17:05:44,447 INFO core: Event loop thread started, running loop forever
2026-09-22 17:05:44,748 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 17:05:44,752 INFO core: _init_accounts coroutine started
2026-09-22 17:05:44,754 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 17:05:44,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:10:31,032 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:15:13,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:15:13,018 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 17:15:13,019 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 17:15:13,020 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 17:20:20,478 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 17:20:20,645 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 17:20:45,822 INFO core: Event loop thread started, running loop forever
2026-09-22 17:20:46,127 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 17:20:46,134 INFO core: _init_accounts coroutine started
2026-09-22 17:20:46,135 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 17:20:46,149 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 17:20:46,149 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 17:20:46,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:25:38,857 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 17:25:38,860 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 17:25:38,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:30:55,487 INFO core: Event loop thread started, running loop forever
2026-09-22 17:30:55,789 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 17:30:55,794 INFO core: _init_accounts coroutine started
2026-09-22 17:30:55,795 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 17:30:55,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:35:38,108 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 17:35:38,108 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 17:35:38,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 17:35:38,112 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 17:35:38,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:40:54,319 INFO core: Event loop thread started, running loop forever
2026-09-22 17:40:54,621 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 17:40:54,624 INFO core: _init_accounts coroutine started
2026-09-22 17:40:54,625 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 17:40:54,636 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:45:34,651 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 17:45:34,657 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:50:23,414 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 17:55:06,861 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 17:55:06,861 INFO core: _init_accounts coroutine started
2026-09-22 17:55:06,861 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 17:55:06,867 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:00:12,399 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 18:00:34,899 INFO core: Event loop thread started, running loop forever
2026-09-22 18:00:35,200 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 18:00:35,208 INFO core: _init_accounts coroutine started
2026-09-22 18:00:35,211 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 18:00:35,213 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:05:26,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:10:33,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 18:10:33,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 18:10:33,455 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-22 18:10:54,560 INFO core: Event loop thread started, running loop forever
2026-09-22 18:10:54,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 18:10:54,863 INFO core: _init_accounts coroutine started
2026-09-22 18:10:54,866 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 18:10:54,875 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 18:10:54,875 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 18:10:54,892 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 18:10:54,893 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 18:10:54,899 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:15:28,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:20:31,171 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 18:20:31,171 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 18:20:31,177 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 18:20:31,178 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 18:20:31,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:25:38,447 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 18:25:43,549 INFO core: Event loop thread started, running loop forever
2026-09-22 18:25:43,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 18:25:43,854 INFO core: _init_accounts coroutine started
2026-09-22 18:25:43,856 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 18:25:43,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:30:09,474 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 18:30:09,474 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 18:30:09,489 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 18:30:09,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:35:47,206 INFO core: Event loop thread started, running loop forever
2026-09-22 18:35:47,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 18:35:47,523 INFO core: _init_accounts coroutine started
2026-09-22 18:35:47,523 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 18:35:47,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:40:13,593 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 18:40:13,594 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 18:40:13,595 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 18:40:13,597 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 18:40:13,617 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:40:13,618 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 18:40:13,618 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 18:45:06,311 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-22 18:45:06,312 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-22 18:45:06,318 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:50:13,404 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-22 18:50:13,404 WARNING core: Account 2: connect timed out after 35s
2026-09-22 18:50:13,405 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-22 18:50:13,405 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-22 18:50:13,406 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-22 18:50:13,406 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-22 18:50:13,407 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-22 18:50:31,812 INFO core: Event loop thread started, running loop forever
2026-09-22 18:50:32,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 18:50:32,121 INFO core: _init_accounts coroutine started
2026-09-22 18:50:32,121 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 18:50:32,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 18:55:26,877 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:00:10,616 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:05:16,499 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 19:05:16,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 19:05:16,499 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-22 19:05:16,500 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 19:05:16,501 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-22 19:05:16,501 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 19:05:16,501 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-22 19:05:16,501 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 19:05:16,501 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 19:05:53,776 INFO core: Event loop thread started, running loop forever
2026-09-22 19:05:54,084 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 19:05:54,089 INFO core: _init_accounts coroutine started
2026-09-22 19:05:54,091 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 19:05:54,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:10:46,342 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:15:42,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:20:07,860 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 19:20:07,861 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 19:20:07,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:25:14,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 19:25:38,218 INFO core: Event loop thread started, running loop forever
2026-09-22 19:25:38,519 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 19:25:38,523 INFO core: _init_accounts coroutine started
2026-09-22 19:25:38,525 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 19:25:38,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:30:26,840 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:35:32,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 19:35:32,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 19:35:32,435 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-22 19:35:32,436 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 19:35:32,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-22 19:35:32,436 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 19:35:32,436 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-22 19:35:42,509 INFO core: Event loop thread started, running loop forever
2026-09-22 19:35:42,810 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 19:35:42,814 INFO core: _init_accounts coroutine started
2026-09-22 19:35:42,815 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 19:35:42,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:40:29,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:45:24,747 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 19:45:24,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:50:48,043 INFO core: Event loop thread started, running loop forever
2026-09-22 19:50:48,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 19:50:48,349 INFO core: _init_accounts coroutine started
2026-09-22 19:50:48,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 19:50:48,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 19:55:26,054 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 19:55:26,054 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 19:55:26,058 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:00:06,702 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 20:00:06,719 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 20:00:06,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:05:12,461 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 20:05:12,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 20:05:12,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 20:05:38,939 INFO core: Event loop thread started, running loop forever
2026-09-22 20:05:39,240 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 20:05:39,243 INFO core: _init_accounts coroutine started
2026-09-22 20:05:39,245 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 20:05:39,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:10:26,650 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:15:32,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 20:15:32,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 20:15:32,413 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-22 20:15:32,414 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 20:15:32,414 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-22 20:15:32,414 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 20:15:32,414 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-22 20:15:32,414 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 20:15:32,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 20:15:53,755 INFO core: Event loop thread started, running loop forever
2026-09-22 20:15:54,056 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 20:15:54,061 INFO core: _init_accounts coroutine started
2026-09-22 20:15:54,062 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 20:15:54,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:20:32,343 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 20:20:32,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:25:18,061 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:30:33,927 INFO core: Event loop thread started, running loop forever
2026-09-22 20:30:34,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 20:30:34,232 INFO core: _init_accounts coroutine started
2026-09-22 20:30:34,233 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 20:30:34,243 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 20:30:34,243 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 20:30:34,244 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:35:41,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 20:35:41,416 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-22 20:35:41,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 20:35:41,416 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-22 20:35:41,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 20:35:41,417 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-22 20:35:41,425 INFO core: Event loop thread started, running loop forever
2026-09-22 20:35:41,726 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 20:35:41,731 INFO core: _init_accounts coroutine started
2026-09-22 20:35:41,731 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 20:35:41,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:40:25,549 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-22 20:40:25,557 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-22 20:45:41,681 INFO core: Event loop thread started, running loop forever
2026-09-22 20:45:41,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 20:45:41,991 INFO core: _init_accounts coroutine started
2026-09-22 20:45:41,992 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 20:45:42,004 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:50:39,883 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 20:55:28,443 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 20:55:28,443 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 20:55:28,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 20:55:28,447 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 20:55:28,460 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:00:50,138 INFO core: Event loop thread started, running loop forever
2026-09-22 21:00:50,440 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 21:00:50,444 INFO core: _init_accounts coroutine started
2026-09-22 21:00:50,446 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 21:00:50,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:05:42,221 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 21:05:42,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:10:46,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:15:52,452 INFO core: Event loop thread started, running loop forever
2026-09-22 21:15:52,753 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 21:15:52,757 INFO core: _init_accounts coroutine started
2026-09-22 21:15:52,757 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 21:15:52,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:20:30,817 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 21:20:30,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 21:20:30,823 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 21:20:30,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:20:30,825 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 21:25:36,506 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-22 21:25:41,396 INFO core: Event loop thread started, running loop forever
2026-09-22 21:25:41,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 21:25:41,702 INFO core: _init_accounts coroutine started
2026-09-22 21:25:41,704 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 21:25:41,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:30:43,387 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 21:30:43,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:35:14,249 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:40:35,335 INFO core: Event loop thread started, running loop forever
2026-09-22 21:40:35,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 21:40:35,639 INFO core: _init_accounts coroutine started
2026-09-22 21:40:35,639 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 21:40:35,645 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:45:42,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 21:45:51,963 INFO core: Event loop thread started, running loop forever
2026-09-22 21:45:52,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 21:45:52,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:50:29,719 INFO core: _init_accounts coroutine started
2026-09-22 21:50:29,723 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 21:50:29,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 21:55:23,807 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 21:55:23,820 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:00:39,870 INFO core: Event loop thread started, running loop forever
2026-09-22 22:00:40,172 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 22:00:40,176 INFO core: _init_accounts coroutine started
2026-09-22 22:00:40,178 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 22:00:40,188 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:05:38,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:10:45,421 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 22:10:45,422 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 22:10:46,165 INFO core: Event loop thread started, running loop forever
2026-09-22 22:10:46,466 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 22:10:46,470 INFO core: _init_accounts coroutine started
2026-09-22 22:10:46,471 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 22:10:46,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:15:08,187 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:20:15,416 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 22:20:34,734 INFO core: Event loop thread started, running loop forever
2026-09-22 22:20:35,035 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 22:20:35,040 INFO core: _init_accounts coroutine started
2026-09-22 22:20:35,041 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 22:20:35,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:25:35,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:30:42,427 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 22:30:42,428 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 22:30:42,428 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-22 22:30:42,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 22:30:42,429 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-22 22:30:42,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 22:30:42,429 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-22 22:30:42,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-22 22:30:42,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 22:30:51,403 INFO core: Event loop thread started, running loop forever
2026-09-22 22:30:51,704 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 22:30:51,715 INFO core: _init_accounts coroutine started
2026-09-22 22:30:51,715 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 22:30:51,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:35:38,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:35:38,703 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 22:35:38,703 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 22:40:07,551 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:45:11,348 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 22:45:11,351 INFO core: _init_accounts_inner: reloading LLM config
2026-09-22 22:45:11,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:50:47,771 INFO core: Event loop thread started, running loop forever
2026-09-22 22:50:48,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 22:50:48,081 INFO core: _init_accounts coroutine started
2026-09-22 22:50:48,083 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 22:50:48,088 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 22:55:16,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:00:23,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 23:00:26,636 INFO core: Event loop thread started, running loop forever
2026-09-22 23:00:26,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 23:00:26,941 INFO core: _init_accounts coroutine started
2026-09-22 23:00:26,942 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 23:00:26,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:05:46,559 INFO core: Event loop thread started, running loop forever
2026-09-22 23:05:46,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 23:05:46,873 INFO core: _init_accounts coroutine started
2026-09-22 23:05:46,874 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 23:05:46,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:10:37,520 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 23:10:37,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:15:35,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:20:12,930 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-22 23:20:12,931 INFO core: _init_accounts coroutine started
2026-09-22 23:20:12,931 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 23:20:12,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:25:18,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-22 23:25:22,031 INFO core: Event loop thread started, running loop forever
2026-09-22 23:25:22,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 23:25:22,334 INFO core: _init_accounts coroutine started
2026-09-22 23:25:22,335 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 23:25:22,344 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:30:24,656 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 23:30:24,678 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:35:48,127 INFO core: Event loop thread started, running loop forever
2026-09-22 23:35:48,429 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 23:35:48,433 INFO core: _init_accounts coroutine started
2026-09-22 23:35:48,436 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 23:35:48,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:40:28,169 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-22 23:40:28,187 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:45:42,644 INFO core: Event loop thread started, running loop forever
2026-09-22 23:45:42,947 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-22 23:45:42,951 INFO core: _init_accounts coroutine started
2026-09-22 23:45:42,953 INFO core: _init_accounts_inner: starting DB migrations
2026-09-22 23:45:42,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:50:37,707 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-22 23:50:37,707 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-22 23:50:37,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-22 23:55:30,296 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-22 23:55:30,308 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:00:13,424 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 00:00:13,437 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:05:32,248 INFO core: Event loop thread started, running loop forever
2026-09-23 00:05:32,548 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 00:05:32,554 INFO core: _init_accounts coroutine started
2026-09-23 00:05:32,554 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 00:05:32,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:10:25,601 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 00:10:25,601 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 00:10:25,605 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 00:10:25,606 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 00:10:25,611 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:15:23,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:20:45,470 INFO core: Event loop thread started, running loop forever
2026-09-23 00:20:45,771 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 00:20:45,777 INFO core: _init_accounts coroutine started
2026-09-23 00:20:45,778 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 00:20:45,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:25:08,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:30:14,439 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 00:30:26,778 INFO core: Event loop thread started, running loop forever
2026-09-23 00:30:27,079 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 00:30:27,087 INFO core: _init_accounts coroutine started
2026-09-23 00:30:27,096 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 00:30:27,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:35:33,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 00:35:50,235 INFO core: Event loop thread started, running loop forever
2026-09-23 00:35:50,536 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 00:35:50,539 INFO core: _init_accounts coroutine started
2026-09-23 00:35:50,540 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 00:35:50,548 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 00:35:50,548 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 00:35:50,549 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 00:35:50,551 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 00:35:50,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:40:52,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:45:27,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:50:34,455 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 00:50:34,456 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 00:50:34,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 00:50:38,674 INFO core: Event loop thread started, running loop forever
2026-09-23 00:50:38,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 00:50:38,981 INFO core: _init_accounts coroutine started
2026-09-23 00:50:38,982 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 00:50:38,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 00:55:08,528 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 00:55:08,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:00:47,510 INFO core: Event loop thread started, running loop forever
2026-09-23 01:00:47,812 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 01:00:47,815 INFO core: _init_accounts coroutine started
2026-09-23 01:00:47,816 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 01:00:47,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:05:43,213 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 01:05:43,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:10:48,750 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:15:11,303 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-23 01:15:11,305 INFO core: _init_accounts coroutine started
2026-09-23 01:15:11,305 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 01:15:11,319 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 01:15:11,320 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 01:15:11,320 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 01:15:11,321 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 01:15:11,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:20:18,478 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 01:20:18,479 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 01:20:18,479 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 01:20:37,492 INFO core: Event loop thread started, running loop forever
2026-09-23 01:20:37,793 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 01:20:37,799 INFO core: _init_accounts coroutine started
2026-09-23 01:20:37,800 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 01:20:37,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:25:09,253 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:30:16,429 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 01:30:45,005 INFO core: Event loop thread started, running loop forever
2026-09-23 01:30:45,306 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 01:30:45,309 INFO core: _init_accounts coroutine started
2026-09-23 01:30:45,309 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 01:30:45,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:35:22,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:40:26,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:45:22,403 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 01:45:22,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 01:45:22,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 01:45:22,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:50:34,100 INFO core: Event loop thread started, running loop forever
2026-09-23 01:50:34,404 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 01:50:34,408 INFO core: _init_accounts coroutine started
2026-09-23 01:50:34,409 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 01:50:34,419 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 01:55:15,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:00:21,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 02:00:24,297 INFO core: Event loop thread started, running loop forever
2026-09-23 02:00:24,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 02:00:24,603 INFO core: _init_accounts coroutine started
2026-09-23 02:00:24,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 02:00:24,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:05:08,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:10:08,441 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 02:10:08,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 02:10:08,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:15:31,313 INFO core: Event loop thread started, running loop forever
2026-09-23 02:15:31,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 02:15:31,619 INFO core: _init_accounts coroutine started
2026-09-23 02:15:31,619 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 02:15:31,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:20:38,522 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 02:20:42,603 INFO core: Event loop thread started, running loop forever
2026-09-23 02:20:42,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 02:20:42,910 INFO core: _init_accounts coroutine started
2026-09-23 02:20:42,911 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 02:20:42,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:25:48,543 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 02:25:51,622 INFO core: Event loop thread started, running loop forever
2026-09-23 02:25:51,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 02:25:51,937 INFO core: _init_accounts coroutine started
2026-09-23 02:25:51,938 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 02:25:51,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:30:49,592 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 02:30:49,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:35:39,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:40:13,895 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-23 02:40:13,896 INFO core: _init_accounts coroutine started
2026-09-23 02:40:13,896 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 02:40:13,914 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:45:14,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:50:52,327 INFO core: Event loop thread started, running loop forever
2026-09-23 02:50:52,628 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 02:50:52,634 INFO core: _init_accounts coroutine started
2026-09-23 02:50:52,635 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 02:50:52,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 02:55:52,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:00:40,472 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 03:00:40,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:05:57,735 INFO core: Event loop thread started, running loop forever
2026-09-23 03:05:58,051 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 03:05:58,055 INFO core: _init_accounts coroutine started
2026-09-23 03:05:58,055 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 03:05:58,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:10:23,972 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 03:10:23,982 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 03:10:23,984 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 03:10:23,985 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 03:10:24,029 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:15:31,494 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 03:15:31,494 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 03:15:31,495 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 03:15:39,957 INFO core: Event loop thread started, running loop forever
2026-09-23 03:15:40,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 03:15:40,265 INFO core: _init_accounts coroutine started
2026-09-23 03:15:40,266 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 03:15:40,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:20:10,612 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 03:20:10,633 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:25:26,561 INFO core: Event loop thread started, running loop forever
2026-09-23 03:25:26,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 03:25:26,871 INFO core: _init_accounts coroutine started
2026-09-23 03:25:26,872 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 03:25:26,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:30:17,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:35:12,502 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 03:35:12,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:40:52,780 INFO core: Event loop thread started, running loop forever
2026-09-23 03:40:53,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 03:40:53,086 INFO core: _init_accounts coroutine started
2026-09-23 03:40:53,086 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 03:40:53,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:45:18,305 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 03:45:18,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:50:28,382 INFO core: Event loop thread started, running loop forever
2026-09-23 03:50:28,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 03:50:28,688 INFO core: _init_accounts coroutine started
2026-09-23 03:50:28,691 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 03:50:28,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:55:48,384 INFO core: Event loop thread started, running loop forever
2026-09-23 03:55:48,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 03:55:48,690 INFO core: _init_accounts coroutine started
2026-09-23 03:55:48,691 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 03:55:48,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 03:55:48,709 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 03:55:48,709 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 04:00:29,199 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 04:00:29,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:05:36,469 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 04:05:47,556 INFO core: Event loop thread started, running loop forever
2026-09-23 04:05:47,857 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 04:05:47,861 INFO core: _init_accounts coroutine started
2026-09-23 04:05:47,862 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 04:05:47,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:10:30,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:15:12,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 04:15:12,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 04:15:12,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:20:19,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 04:20:19,436 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 04:20:19,436 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 04:20:19,437 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 04:20:19,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 04:20:19,437 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 04:20:25,692 INFO core: Event loop thread started, running loop forever
2026-09-23 04:20:25,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 04:20:26,002 INFO core: _init_accounts coroutine started
2026-09-23 04:20:26,002 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 04:20:26,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:25:53,106 INFO core: Event loop thread started, running loop forever
2026-09-23 04:25:53,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 04:25:53,413 INFO core: _init_accounts coroutine started
2026-09-23 04:25:53,413 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 04:25:53,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:30:44,469 INFO core: Event loop thread started, running loop forever
2026-09-23 04:30:44,772 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 04:30:44,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:30:44,783 INFO core: _init_accounts coroutine started
2026-09-23 04:30:44,783 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 04:35:18,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:40:21,309 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 04:40:21,311 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 04:40:21,551 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:45:24,181 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 04:45:24,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:50:36,799 INFO core: Event loop thread started, running loop forever
2026-09-23 04:50:37,100 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 04:50:37,105 INFO core: _init_accounts coroutine started
2026-09-23 04:50:37,105 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 04:50:37,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:55:24,839 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 04:55:24,840 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 04:55:24,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 04:55:24,842 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 05:00:19,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:05:25,420 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 05:05:25,420 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 05:05:25,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 05:05:25,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 05:05:51,888 INFO core: Event loop thread started, running loop forever
2026-09-23 05:05:52,189 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 05:05:52,192 INFO core: _init_accounts coroutine started
2026-09-23 05:05:52,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 05:05:52,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:10:12,950 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 05:10:12,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:10:12,951 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 05:15:10,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:20:07,864 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 05:20:07,875 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 05:20:07,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:25:07,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:26:22,639 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 05:26:22,640 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 05:26:22,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:26:22,663 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 05:26:22,664 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 05:30:12,720 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 05:30:12,721 WARNING core: Account 2: connect timed out after 35s
2026-09-23 05:30:12,722 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 05:30:12,722 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 05:30:12,723 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 05:30:12,724 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 05:30:12,724 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 05:30:12,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:35:18,468 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 05:35:18,469 WARNING core: Account 2: connect timed out after 35s
2026-09-23 05:35:37,062 INFO core: Event loop thread started, running loop forever
2026-09-23 05:35:37,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 05:35:37,368 INFO core: _init_accounts coroutine started
2026-09-23 05:35:37,369 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 05:35:37,374 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:40:46,768 INFO core: Event loop thread started, running loop forever
2026-09-23 05:40:47,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 05:40:47,073 INFO core: _init_accounts coroutine started
2026-09-23 05:40:47,074 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 05:40:47,078 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:45:42,726 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:50:25,217 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 05:50:25,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 05:50:25,223 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 05:55:32,492 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-23 05:55:36,600 INFO core: Event loop thread started, running loop forever
2026-09-23 05:55:36,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 05:55:36,906 INFO core: _init_accounts coroutine started
2026-09-23 05:55:36,906 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 05:55:36,920 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:00:08,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:05:15,512 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 06:05:29,401 INFO core: Event loop thread started, running loop forever
2026-09-23 06:05:29,703 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 06:05:29,714 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:10:29,471 INFO core: _init_accounts coroutine started
2026-09-23 06:10:29,472 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 06:10:29,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:15:36,425 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 06:15:52,241 INFO core: Event loop thread started, running loop forever
2026-09-23 06:15:52,542 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 06:15:52,545 INFO core: _init_accounts coroutine started
2026-09-23 06:15:52,552 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 06:15:52,562 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:20:41,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 06:20:41,492 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 06:20:41,493 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 06:20:41,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:20:41,495 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 06:25:27,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:30:19,205 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:30:19,207 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 06:35:26,455 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 06:35:50,846 INFO core: Event loop thread started, running loop forever
2026-09-23 06:35:51,147 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 06:35:51,152 INFO core: _init_accounts coroutine started
2026-09-23 06:35:51,158 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 06:35:51,166 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:35:51,167 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 06:35:51,167 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 06:40:44,891 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 06:40:44,931 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 06:40:44,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:45:04,440 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 06:45:53,092 INFO core: Event loop thread started, running loop forever
2026-09-23 06:45:53,393 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 06:45:53,396 INFO core: _init_accounts coroutine started
2026-09-23 06:45:53,397 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 06:45:53,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:50:47,346 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 06:50:47,351 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 06:55:47,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:00:07,979 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-23 07:00:07,980 INFO core: _init_accounts coroutine started
2026-09-23 07:00:07,981 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 07:00:07,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:05:49,368 INFO core: Event loop thread started, running loop forever
2026-09-23 07:05:49,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 07:05:49,676 INFO core: _init_accounts coroutine started
2026-09-23 07:05:49,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 07:05:49,686 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:05:49,689 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 07:05:49,689 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 07:05:49,690 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 07:05:49,692 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 07:10:45,379 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:15:20,150 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 07:15:20,151 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 07:15:20,157 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 07:15:20,159 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 07:15:20,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:20:33,769 INFO core: Event loop thread started, running loop forever
2026-09-23 07:20:34,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 07:20:34,078 INFO core: _init_accounts coroutine started
2026-09-23 07:20:34,078 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 07:20:34,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:25:53,296 INFO core: Event loop thread started, running loop forever
2026-09-23 07:25:53,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 07:25:53,608 INFO core: _init_accounts coroutine started
2026-09-23 07:25:53,609 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 07:25:53,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:30:34,893 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 07:30:34,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:35:17,087 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:40:43,589 INFO core: Event loop thread started, running loop forever
2026-09-23 07:40:43,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 07:40:43,894 INFO core: _init_accounts coroutine started
2026-09-23 07:40:43,904 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 07:40:43,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:45:12,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:50:19,482 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 07:50:19,483 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 07:50:19,483 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-23 07:50:19,484 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 07:50:19,484 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 07:50:19,484 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 07:50:19,484 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 07:50:19,484 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 07:50:19,485 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 07:50:27,206 INFO core: Event loop thread started, running loop forever
2026-09-23 07:50:27,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 07:50:27,521 INFO core: _init_accounts coroutine started
2026-09-23 07:50:27,521 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 07:50:27,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 07:55:36,890 INFO core: Event loop thread started, running loop forever
2026-09-23 07:55:37,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 07:55:37,195 INFO core: _init_accounts coroutine started
2026-09-23 07:55:37,197 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 07:55:37,205 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:00:11,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:05:18,460 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 08:05:27,821 INFO core: Event loop thread started, running loop forever
2026-09-23 08:05:28,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 08:05:28,130 INFO core: _init_accounts coroutine started
2026-09-23 08:05:28,130 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 08:05:28,141 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:10:34,469 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 08:10:34,469 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 08:10:34,472 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 08:10:34,472 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 08:10:34,473 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 08:10:34,473 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 08:10:34,473 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 08:10:34,473 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 08:10:38,260 INFO core: Event loop thread started, running loop forever
2026-09-23 08:10:38,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 08:10:38,564 INFO core: _init_accounts coroutine started
2026-09-23 08:10:38,566 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 08:10:38,577 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:10:38,579 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 08:10:38,579 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 08:15:19,544 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 08:15:19,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:20:09,147 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 08:20:09,149 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 08:20:09,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:25:39,391 INFO core: Event loop thread started, running loop forever
2026-09-23 08:25:39,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 08:25:39,707 INFO core: _init_accounts coroutine started
2026-09-23 08:25:39,707 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 08:25:39,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:30:38,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:30:38,364 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 08:30:38,365 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 08:35:08,608 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 08:35:08,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:40:38,527 INFO core: Event loop thread started, running loop forever
2026-09-23 08:40:38,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 08:40:38,834 INFO core: _init_accounts coroutine started
2026-09-23 08:40:38,834 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 08:40:38,847 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:45:37,082 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 08:45:37,083 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 08:45:37,085 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 08:45:37,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:50:44,450 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 08:50:44,452 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 08:50:46,721 INFO core: Event loop thread started, running loop forever
2026-09-23 08:50:47,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 08:50:47,027 INFO core: _init_accounts coroutine started
2026-09-23 08:50:47,028 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 08:50:47,046 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 08:55:16,236 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 08:55:16,236 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 08:55:16,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:00:11,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:05:17,517 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 09:05:52,984 INFO core: Event loop thread started, running loop forever
2026-09-23 09:05:53,287 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 09:05:53,291 INFO core: _init_accounts coroutine started
2026-09-23 09:05:53,293 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 09:05:53,307 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:10:09,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:10:09,072 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 09:15:04,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 09:15:04,444 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 09:15:04,444 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 09:15:04,445 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 09:15:04,445 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 09:15:04,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 09:15:04,445 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 09:15:15,743 INFO core: Event loop thread started, running loop forever
2026-09-23 09:15:16,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 09:15:16,061 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:20:22,435 INFO core: _init_accounts coroutine started
2026-09-23 09:20:22,436 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 09:20:39,580 INFO core: Event loop thread started, running loop forever
2026-09-23 09:20:39,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 09:20:39,885 INFO core: _init_accounts coroutine started
2026-09-23 09:20:39,886 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 09:20:39,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:25:30,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:30:35,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:35:17,403 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 09:35:17,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:40:44,182 INFO core: Event loop thread started, running loop forever
2026-09-23 09:40:44,483 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 09:40:44,489 INFO core: _init_accounts coroutine started
2026-09-23 09:40:44,490 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 09:40:44,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:45:44,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:50:32,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 09:50:32,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 09:50:32,405 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 09:50:32,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 09:55:23,371 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 09:55:23,379 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:00:52,316 INFO core: Event loop thread started, running loop forever
2026-09-23 10:00:52,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 10:00:52,627 INFO core: _init_accounts coroutine started
2026-09-23 10:00:52,627 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 10:00:52,635 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 10:00:52,635 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 10:00:52,637 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 10:00:52,638 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 10:00:52,649 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 10:00:52,649 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 10:00:52,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:00:52,660 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 10:00:52,660 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 10:05:37,583 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 10:05:37,583 WARNING core: Account 2: connect timed out after 35s
2026-09-23 10:05:37,584 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 10:05:37,584 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 10:05:37,584 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 10:05:37,585 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 10:05:37,585 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 10:05:37,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:10:18,058 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 10:10:18,059 WARNING core: Account 2: connect timed out after 35s
2026-09-23 10:10:18,060 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-23 10:10:18,060 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-23 10:10:18,061 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 10:10:18,063 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-23 10:10:18,063 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-23 10:10:18,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:15:13,665 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 10:15:13,665 WARNING core: Account 2: connect timed out after 35s
2026-09-23 10:15:13,666 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-23 10:15:13,666 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-23 10:15:13,667 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 10:15:13,668 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-23 10:15:13,668 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-23 10:15:13,682 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:20:19,473 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 10:20:19,475 WARNING core: Account 2: connect timed out after 35s
2026-09-23 10:20:19,475 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-23 10:20:19,475 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-23 10:20:19,476 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 10:20:19,477 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-09-23 10:20:19,477 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-09-23 10:20:27,288 INFO core: Event loop thread started, running loop forever
2026-09-23 10:20:27,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 10:20:27,596 INFO core: _init_accounts coroutine started
2026-09-23 10:20:27,596 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 10:20:27,621 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:25:34,474 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 10:25:51,741 INFO core: Event loop thread started, running loop forever
2026-09-23 10:25:52,045 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 10:25:52,066 INFO core: _init_accounts coroutine started
2026-09-23 10:25:52,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 10:25:52,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:30:37,712 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 10:30:37,713 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 10:30:37,717 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:30:37,718 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 10:30:37,719 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 10:35:10,633 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:40:17,475 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 10:40:17,475 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 10:40:17,476 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 10:40:36,086 INFO core: Event loop thread started, running loop forever
2026-09-23 10:40:36,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 10:40:36,392 INFO core: _init_accounts coroutine started
2026-09-23 10:40:36,392 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 10:40:36,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:45:12,329 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:50:19,418 INFO core: Event loop thread started, running loop forever
2026-09-23 10:50:19,723 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 10:50:19,728 INFO core: _init_accounts coroutine started
2026-09-23 10:50:19,729 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 10:50:19,740 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 10:50:19,744 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 10:50:19,756 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 10:55:26,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 10:55:26,430 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 10:55:26,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 10:55:26,431 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 10:55:26,431 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 10:55:26,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 10:55:45,589 INFO core: Event loop thread started, running loop forever
2026-09-23 10:55:45,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 10:55:45,894 INFO core: _init_accounts coroutine started
2026-09-23 10:55:45,897 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 10:55:45,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:00:45,541 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 11:00:45,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:05:22,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:10:06,483 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-23 11:10:06,485 INFO core: _init_accounts coroutine started
2026-09-23 11:10:06,485 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 11:10:06,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:15:20,737 INFO core: Event loop thread started, running loop forever
2026-09-23 11:15:21,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 11:15:21,042 INFO core: _init_accounts coroutine started
2026-09-23 11:15:21,042 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 11:15:21,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:20:18,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:25:39,870 INFO core: Event loop thread started, running loop forever
2026-09-23 11:25:40,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 11:25:40,180 INFO core: _init_accounts coroutine started
2026-09-23 11:25:40,183 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 11:25:40,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:30:07,484 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 11:30:56,131 INFO core: Event loop thread started, running loop forever
2026-09-23 11:30:56,433 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 11:30:56,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:35:36,305 INFO core: _init_accounts coroutine started
2026-09-23 11:35:36,306 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 11:35:36,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:40:48,790 INFO core: Event loop thread started, running loop forever
2026-09-23 11:40:49,091 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 11:40:49,103 INFO core: _init_accounts coroutine started
2026-09-23 11:40:49,103 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 11:40:49,142 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:45:05,407 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:50:12,529 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 11:50:12,529 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 11:50:12,529 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-23 11:50:12,530 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 11:50:12,530 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 11:50:12,530 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 11:50:12,530 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 11:50:12,530 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 11:50:12,531 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 11:50:28,691 INFO core: Event loop thread started, running loop forever
2026-09-23 11:50:28,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 11:50:29,012 INFO core: _init_accounts coroutine started
2026-09-23 11:50:29,012 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 11:50:29,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 11:55:35,537 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-23 11:55:49,590 INFO core: Event loop thread started, running loop forever
2026-09-23 11:55:49,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 11:55:49,897 INFO core: _init_accounts coroutine started
2026-09-23 11:55:49,899 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 11:55:49,907 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:00:47,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:05:35,683 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 12:05:35,683 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 12:05:35,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:10:27,727 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 12:10:27,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:15:22,687 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 12:15:22,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:20:29,499 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 12:20:29,505 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 12:20:29,506 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 12:20:39,224 INFO core: Event loop thread started, running loop forever
2026-09-23 12:20:39,525 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 12:20:39,529 INFO core: _init_accounts coroutine started
2026-09-23 12:20:39,530 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 12:20:39,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:25:46,409 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 12:25:53,315 INFO core: Event loop thread started, running loop forever
2026-09-23 12:25:53,616 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 12:25:53,620 INFO core: _init_accounts coroutine started
2026-09-23 12:25:53,621 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 12:25:53,637 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 12:25:53,637 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 12:25:53,639 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 12:25:53,641 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 12:25:53,651 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 12:25:53,652 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 12:25:53,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:25:53,656 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 12:25:53,657 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 12:30:27,831 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 12:30:27,831 WARNING core: Account 2: connect timed out after 35s
2026-09-23 12:30:27,832 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 12:30:27,832 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 12:30:27,832 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 12:30:27,833 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 12:30:27,833 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 12:30:27,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:35:33,396 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 12:35:33,397 WARNING core: Account 2: connect timed out after 35s
2026-09-23 12:35:33,398 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-23 12:35:33,398 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-23 12:35:33,398 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 12:35:33,399 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-23 12:35:33,400 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-23 12:35:35,292 INFO core: Event loop thread started, running loop forever
2026-09-23 12:35:35,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 12:35:35,606 INFO core: _init_accounts coroutine started
2026-09-23 12:35:35,606 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 12:35:35,613 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:40:13,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:45:25,857 INFO core: Event loop thread started, running loop forever
2026-09-23 12:45:26,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 12:45:26,164 INFO core: _init_accounts coroutine started
2026-09-23 12:45:26,165 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 12:45:26,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:50:11,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 12:55:18,454 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 12:55:18,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 12:55:18,462 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-23 12:55:18,462 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 12:55:18,462 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 12:55:18,462 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 12:55:18,462 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 12:55:18,463 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 12:55:18,463 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 12:55:40,527 INFO core: Event loop thread started, running loop forever
2026-09-23 12:55:40,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 12:55:40,837 INFO core: _init_accounts coroutine started
2026-09-23 12:55:40,837 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 12:55:40,838 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:00:36,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:05:23,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 13:05:23,381 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 13:05:23,392 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:10:10,857 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 13:10:10,858 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 13:10:10,863 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:10:10,864 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 13:15:16,479 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 13:15:45,335 INFO core: Event loop thread started, running loop forever
2026-09-23 13:15:45,636 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 13:15:45,639 INFO core: _init_accounts coroutine started
2026-09-23 13:15:45,641 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 13:15:45,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:20:44,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:20:44,674 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 13:20:44,674 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 13:25:36,228 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 13:25:36,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:30:31,091 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 13:30:31,092 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 13:30:31,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:35:45,432 INFO core: Event loop thread started, running loop forever
2026-09-23 13:35:45,733 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 13:35:45,737 INFO core: _init_accounts coroutine started
2026-09-23 13:35:45,739 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 13:35:45,752 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:40:52,388 INFO core: Event loop thread started, running loop forever
2026-09-23 13:40:52,378 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 13:40:52,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 13:40:52,694 INFO core: _init_accounts coroutine started
2026-09-23 13:40:52,694 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 13:40:52,724 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:45:05,340 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 13:45:49,580 INFO core: Event loop thread started, running loop forever
2026-09-23 13:45:49,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 13:45:49,885 INFO core: _init_accounts coroutine started
2026-09-23 13:45:49,886 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 13:45:49,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:50:27,663 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 13:50:27,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 13:55:37,206 INFO core: Event loop thread started, running loop forever
2026-09-23 13:55:37,507 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 13:55:37,512 INFO core: _init_accounts coroutine started
2026-09-23 13:55:37,513 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 13:55:37,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:00:34,191 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 14:00:34,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:05:17,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:10:55,404 INFO core: Event loop thread started, running loop forever
2026-09-23 14:10:55,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 14:10:55,715 INFO core: _init_accounts coroutine started
2026-09-23 14:10:55,717 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 14:10:55,730 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 14:10:55,730 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 14:10:55,736 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 14:10:55,746 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 14:10:55,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:15:52,788 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:20:36,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:25:33,894 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 14:25:33,894 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 14:25:33,902 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 14:25:33,903 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 14:25:33,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:30:32,935 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 14:30:32,935 WARNING core: Account 2: connect timed out after 35s
2026-09-23 14:30:32,936 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 14:30:32,936 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 14:30:32,937 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 14:30:32,938 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 14:30:32,939 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 14:30:32,941 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:35:38,465 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 14:35:38,466 WARNING core: Account 2: connect timed out after 35s
2026-09-23 14:35:38,467 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-23 14:35:38,467 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-23 14:35:38,467 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 14:35:38,468 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-23 14:35:38,469 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-23 14:35:43,536 INFO core: Event loop thread started, running loop forever
2026-09-23 14:35:43,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 14:35:43,841 INFO core: _init_accounts coroutine started
2026-09-23 14:35:43,842 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 14:35:43,850 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:35:43,853 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 14:35:43,853 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 14:40:31,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:40:31,536 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 14:40:31,538 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 14:45:23,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:50:08,728 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 14:55:14,467 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 14:55:14,468 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 14:55:14,476 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 14:55:14,477 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 14:55:27,260 INFO core: Event loop thread started, running loop forever
2026-09-23 14:55:27,561 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 14:55:27,566 INFO core: _init_accounts coroutine started
2026-09-23 14:55:27,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 14:55:27,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:00:11,907 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 15:00:11,908 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 15:00:11,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:05:21,527 INFO core: Event loop thread started, running loop forever
2026-09-23 15:05:21,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 15:05:21,831 INFO core: _init_accounts coroutine started
2026-09-23 15:05:21,834 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 15:05:21,842 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:10:28,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 15:10:40,426 INFO core: Event loop thread started, running loop forever
2026-09-23 15:10:40,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 15:10:40,731 INFO core: _init_accounts coroutine started
2026-09-23 15:10:40,733 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 15:10:40,741 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:15:14,614 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 15:15:14,614 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 15:15:14,617 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:20:20,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 15:20:49,136 INFO core: Event loop thread started, running loop forever
2026-09-23 15:20:49,437 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 15:20:49,442 INFO core: _init_accounts coroutine started
2026-09-23 15:20:49,443 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 15:20:49,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:25:12,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:30:18,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 15:30:51,537 INFO core: Event loop thread started, running loop forever
2026-09-23 15:30:51,839 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 15:30:51,843 INFO core: _init_accounts coroutine started
2026-09-23 15:30:51,844 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 15:30:51,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:35:13,522 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 15:35:13,522 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 15:35:13,526 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:40:17,508 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 15:40:17,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:45:24,480 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 15:45:40,891 INFO core: Event loop thread started, running loop forever
2026-09-23 15:45:41,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 15:45:41,199 INFO core: _init_accounts coroutine started
2026-09-23 15:45:41,199 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 15:45:41,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:50:30,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 15:55:12,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:00:06,385 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 16:00:06,385 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 16:00:06,385 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-23 16:00:06,390 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 16:00:06,390 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 16:00:06,390 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 16:00:11,759 INFO core: Event loop thread started, running loop forever
2026-09-23 16:00:12,059 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 16:00:12,063 INFO core: _init_accounts coroutine started
2026-09-23 16:00:12,065 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 16:00:12,085 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 16:00:12,085 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 16:00:12,087 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 16:00:12,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:05:32,612 INFO core: Event loop thread started, running loop forever
2026-09-23 16:05:32,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 16:05:32,918 INFO core: _init_accounts coroutine started
2026-09-23 16:05:32,919 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 16:05:32,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:10:38,456 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 16:10:50,996 INFO core: Event loop thread started, running loop forever
2026-09-23 16:10:51,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 16:10:51,306 INFO core: _init_accounts coroutine started
2026-09-23 16:10:51,306 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 16:10:51,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:15:10,823 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 16:15:10,823 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 16:15:10,825 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 16:15:10,826 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 16:15:10,840 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 16:15:10,840 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 16:15:10,842 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:15:10,848 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 16:20:16,412 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 16:20:34,828 INFO core: Event loop thread started, running loop forever
2026-09-23 16:20:35,137 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 16:20:35,140 INFO core: _init_accounts coroutine started
2026-09-23 16:20:35,142 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 16:20:35,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:25:42,539 INFO core: Event loop thread started, running loop forever
2026-09-23 16:25:42,840 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 16:25:42,844 INFO core: _init_accounts coroutine started
2026-09-23 16:25:42,845 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 16:25:42,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:30:25,454 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 16:30:25,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:35:30,233 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:40:28,293 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-23 16:40:28,296 INFO core: _init_accounts coroutine started
2026-09-23 16:40:28,297 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 16:40:28,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:45:40,145 INFO core: Event loop thread started, running loop forever
2026-09-23 16:45:40,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 16:45:40,451 INFO core: _init_accounts coroutine started
2026-09-23 16:45:40,451 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 16:45:40,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:50:08,652 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 16:50:08,665 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 16:55:12,784 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:00:46,588 INFO core: Event loop thread started, running loop forever
2026-09-23 17:00:46,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 17:00:46,892 INFO core: _init_accounts coroutine started
2026-09-23 17:00:46,895 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 17:00:46,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:05:47,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:10:16,262 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 17:10:16,262 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 17:10:16,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:15:23,479 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 17:15:23,510 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 17:15:23,510 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 17:15:23,511 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 17:15:23,511 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 17:15:43,180 INFO core: Event loop thread started, running loop forever
2026-09-23 17:15:43,481 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 17:15:43,485 INFO core: _init_accounts coroutine started
2026-09-23 17:15:43,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 17:15:43,492 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:20:48,451 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 17:20:48,457 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:25:48,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:30:27,664 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-23 17:30:27,667 INFO core: _init_accounts coroutine started
2026-09-23 17:30:27,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:30:27,669 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 17:35:38,381 INFO core: Event loop thread started, running loop forever
2026-09-23 17:35:38,682 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 17:35:38,686 INFO core: _init_accounts coroutine started
2026-09-23 17:35:38,687 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 17:35:38,701 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 17:35:38,701 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 17:35:38,701 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:40:06,726 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 17:40:06,761 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:45:12,509 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 17:45:12,510 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 17:45:54,317 INFO core: Event loop thread started, running loop forever
2026-09-23 17:45:54,620 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 17:45:54,625 INFO core: _init_accounts coroutine started
2026-09-23 17:45:54,625 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 17:45:54,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:50:35,293 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 17:50:35,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 17:55:38,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:00:10,266 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-23 18:00:10,267 INFO core: _init_accounts coroutine started
2026-09-23 18:00:10,267 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 18:00:10,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:05:16,514 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 18:05:54,865 INFO core: Event loop thread started, running loop forever
2026-09-23 18:05:55,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 18:05:55,170 INFO core: _init_accounts coroutine started
2026-09-23 18:05:55,171 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 18:05:55,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:10:44,752 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 18:10:44,752 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 18:10:44,753 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 18:10:44,755 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 18:10:44,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:15:06,335 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 18:15:06,336 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 18:15:06,336 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 18:15:46,216 INFO core: Event loop thread started, running loop forever
2026-09-23 18:15:46,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 18:15:46,521 INFO core: _init_accounts coroutine started
2026-09-23 18:15:46,522 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 18:15:46,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:20:14,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:25:20,448 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 18:25:43,811 INFO core: Event loop thread started, running loop forever
2026-09-23 18:25:44,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 18:25:44,117 INFO core: _init_accounts coroutine started
2026-09-23 18:25:44,118 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 18:25:44,125 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:30:40,686 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:35:37,238 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 18:35:37,238 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 18:35:37,248 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 18:35:37,253 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 18:35:37,267 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:40:26,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:45:17,469 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:50:23,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 18:50:47,965 INFO core: Event loop thread started, running loop forever
2026-09-23 18:50:48,267 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 18:50:48,272 INFO core: _init_accounts coroutine started
2026-09-23 18:50:48,274 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 18:50:48,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 18:55:27,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 18:55:27,483 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 18:55:27,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:00:34,426 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 19:00:34,427 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 19:00:34,427 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 19:00:34,428 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-23 19:00:34,428 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 19:00:34,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 19:00:48,645 INFO core: Event loop thread started, running loop forever
2026-09-23 19:00:48,946 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 19:00:48,950 INFO core: _init_accounts coroutine started
2026-09-23 19:00:48,951 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 19:00:48,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:05:46,244 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 19:05:46,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:10:20,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:15:31,726 INFO core: Event loop thread started, running loop forever
2026-09-23 19:15:32,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 19:15:32,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:20:34,780 INFO core: _init_accounts coroutine started
2026-09-23 19:20:34,781 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 19:20:34,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:25:05,816 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 19:25:05,816 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 19:25:05,819 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:30:11,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 19:30:11,412 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-23 19:30:11,413 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 19:30:25,767 INFO core: Event loop thread started, running loop forever
2026-09-23 19:30:26,068 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 19:30:26,072 INFO core: _init_accounts coroutine started
2026-09-23 19:30:26,074 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 19:30:26,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:35:30,740 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 19:35:30,740 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 19:35:30,742 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 19:35:30,743 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 19:35:30,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:40:31,818 INFO core: Event loop thread started, running loop forever
2026-09-23 19:40:32,121 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 19:40:32,124 INFO core: _init_accounts coroutine started
2026-09-23 19:40:32,126 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 19:40:32,134 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-23 19:40:32,136 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-23 19:40:37,850 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 19:40:37,851 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 19:40:37,851 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 19:45:34,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:50:42,565 INFO core: Event loop thread started, running loop forever
2026-09-23 19:50:42,867 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 19:50:42,870 INFO core: _init_accounts coroutine started
2026-09-23 19:50:42,873 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 19:50:42,879 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 19:55:12,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:00:18,014 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 20:00:18,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:05:52,393 INFO core: Event loop thread started, running loop forever
2026-09-23 20:05:52,695 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 20:05:52,698 INFO core: _init_accounts coroutine started
2026-09-23 20:05:52,700 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 20:05:52,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:10:30,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:15:27,560 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 20:15:27,561 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 20:15:27,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 20:15:27,563 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 20:15:27,572 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:20:16,119 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 20:20:16,119 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 20:20:16,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:25:23,430 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 20:25:23,431 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 20:25:34,460 INFO core: Event loop thread started, running loop forever
2026-09-23 20:25:34,761 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 20:25:34,766 INFO core: _init_accounts coroutine started
2026-09-23 20:25:34,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 20:25:34,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:30:30,720 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:35:27,777 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 20:35:27,777 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 20:35:27,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:40:27,023 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 20:40:27,028 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 20:40:27,029 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:45:18,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:50:25,417 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 20:50:51,295 INFO core: Event loop thread started, running loop forever
2026-09-23 20:50:51,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 20:50:51,601 INFO core: _init_accounts coroutine started
2026-09-23 20:50:51,603 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 20:50:51,609 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 20:55:11,810 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:00:17,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 21:00:34,811 INFO core: Event loop thread started, running loop forever
2026-09-23 21:00:35,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 21:00:35,115 INFO core: _init_accounts coroutine started
2026-09-23 21:00:35,117 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 21:00:35,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:05:41,438 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-23 21:05:50,885 INFO core: Event loop thread started, running loop forever
2026-09-23 21:05:51,185 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 21:05:51,189 INFO core: _init_accounts coroutine started
2026-09-23 21:05:51,190 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 21:05:51,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:10:49,287 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 21:10:49,287 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 21:10:49,288 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 21:10:49,290 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 21:10:49,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:15:29,419 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:20:13,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:25:13,368 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 21:25:13,369 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 21:25:13,371 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:25:13,377 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 21:25:13,378 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 21:30:20,455 WARNING core: Account 2: connect timed out after 35s
2026-09-23 21:30:20,457 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 21:30:20,457 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 21:30:20,458 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 21:30:20,459 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 21:30:20,459 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 21:30:27,216 INFO core: Event loop thread started, running loop forever
2026-09-23 21:30:27,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 21:30:27,524 INFO core: _init_accounts coroutine started
2026-09-23 21:30:27,524 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 21:30:27,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:30:27,534 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 21:30:27,534 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 21:35:34,028 INFO core: Event loop thread started, running loop forever
2026-09-23 21:35:34,329 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 21:35:34,334 INFO core: _init_accounts coroutine started
2026-09-23 21:35:34,335 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 21:35:34,339 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:40:26,052 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 21:40:26,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:45:04,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:50:46,223 INFO core: Event loop thread started, running loop forever
2026-09-23 21:50:46,524 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 21:50:46,528 INFO core: _init_accounts coroutine started
2026-09-23 21:50:46,531 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 21:50:46,542 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 21:50:46,542 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 21:50:46,543 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 21:50:46,543 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 21:50:46,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 21:55:40,559 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:00:11,985 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:05:16,918 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 22:05:17,198 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 22:05:16,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:05:17,211 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 22:10:05,358 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 22:10:05,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:15:05,446 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 22:15:05,447 WARNING core: Account 2: connect timed out after 35s
2026-09-23 22:15:05,448 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 22:15:05,448 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 22:15:05,449 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 22:15:05,450 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 22:15:05,450 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 22:15:11,340 INFO core: Event loop thread started, running loop forever
2026-09-23 22:15:11,642 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 22:15:11,647 INFO core: _init_accounts coroutine started
2026-09-23 22:15:11,647 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 22:15:11,650 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:20:18,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 22:20:49,317 INFO core: Event loop thread started, running loop forever
2026-09-23 22:20:49,618 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 22:20:49,622 INFO core: _init_accounts coroutine started
2026-09-23 22:20:49,622 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 22:20:49,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:25:12,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:30:19,412 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 22:30:44,800 INFO core: Event loop thread started, running loop forever
2026-09-23 22:30:45,102 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 22:30:45,109 INFO core: _init_accounts coroutine started
2026-09-23 22:30:45,110 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 22:30:45,135 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 22:30:45,135 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 22:30:45,136 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 22:30:45,138 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 22:30:45,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:35:18,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:40:25,417 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 22:40:25,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 22:40:39,730 INFO core: Event loop thread started, running loop forever
2026-09-23 22:40:40,031 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 22:40:40,035 INFO core: _init_accounts coroutine started
2026-09-23 22:40:40,042 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 22:40:40,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:45:26,665 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 22:45:26,665 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 22:45:26,666 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 22:45:26,668 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 22:45:26,682 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:50:20,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 22:55:27,378 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-23 22:55:27,379 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 22:55:27,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-23 22:55:45,377 INFO core: Event loop thread started, running loop forever
2026-09-23 22:55:45,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 22:55:45,686 INFO core: _init_accounts coroutine started
2026-09-23 22:55:45,687 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 22:55:45,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:00:06,541 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:05:07,283 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 23:05:07,283 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 23:05:07,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 23:05:07,288 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 23:05:07,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:10:16,359 INFO core: Event loop thread started, running loop forever
2026-09-23 23:10:16,661 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 23:10:16,665 INFO core: _init_accounts coroutine started
2026-09-23 23:10:16,666 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 23:10:16,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:15:50,651 INFO core: Event loop thread started, running loop forever
2026-09-23 23:15:50,952 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 23:15:50,958 INFO core: _init_accounts coroutine started
2026-09-23 23:15:50,958 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 23:15:50,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:15:50,970 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 23:15:50,970 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 23:15:50,971 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 23:15:50,972 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 23:15:50,983 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 23:15:50,983 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 23:15:50,987 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 23:20:10,761 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 23:20:10,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:22:09,706 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 23:22:09,707 WARNING core: Account 2: connect timed out after 35s
2026-09-23 23:22:09,708 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 23:22:09,708 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 23:22:09,709 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 23:22:09,710 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 23:22:09,710 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 23:22:09,715 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:25:31,751 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 23:25:31,755 WARNING core: Account 2: connect timed out after 35s
2026-09-23 23:25:31,755 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-23 23:25:31,755 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-23 23:25:31,756 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 23:25:31,757 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-23 23:25:31,757 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-23 23:25:31,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:30:33,633 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 23:30:33,634 WARNING core: Account 2: connect timed out after 35s
2026-09-23 23:30:33,634 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-23 23:30:33,634 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-23 23:30:33,634 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 23:30:33,635 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-23 23:30:33,635 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-23 23:30:33,644 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:35:36,463 INFO core: Event loop thread started, running loop forever
2026-09-23 23:35:36,764 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 23:35:36,767 INFO core: _init_accounts coroutine started
2026-09-23 23:35:36,768 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 23:35:36,785 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:35:40,460 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 23:35:40,460 WARNING core: Account 2: connect timed out after 35s
2026-09-23 23:35:40,461 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-23 23:35:40,461 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-23 23:35:40,462 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 23:40:11,019 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 23:40:11,019 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 23:40:11,021 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 23:40:11,022 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 23:40:11,031 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 23:40:11,031 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-23 23:40:11,037 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-23 23:40:11,038 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-23 23:40:11,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:45:17,402 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-23 23:45:17,402 WARNING core: Account 2: connect timed out after 35s
2026-09-23 23:45:17,403 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-23 23:45:17,403 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-23 23:45:17,404 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-23 23:45:17,405 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-23 23:45:17,405 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-23 23:45:45,692 INFO core: Event loop thread started, running loop forever
2026-09-23 23:45:45,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 23:45:45,996 INFO core: _init_accounts coroutine started
2026-09-23 23:45:45,997 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 23:45:46,007 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:45:46,017 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-23 23:45:46,027 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-23 23:45:46,028 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-23 23:45:46,029 INFO core: _init_accounts_inner: reloading LLM config
2026-09-23 23:50:17,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-23 23:55:23,365 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-23 23:55:28,954 INFO core: Event loop thread started, running loop forever
2026-09-23 23:55:29,255 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-23 23:55:29,258 INFO core: _init_accounts coroutine started
2026-09-23 23:55:29,260 INFO core: _init_accounts_inner: starting DB migrations
2026-09-23 23:55:29,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:00:11,316 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:05:04,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:10:10,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 00:10:10,426 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 00:10:10,426 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-24 00:10:10,427 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 00:10:10,427 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 00:10:10,427 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 00:10:10,427 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 00:10:10,427 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 00:10:10,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 00:10:43,338 INFO core: Event loop thread started, running loop forever
2026-09-24 00:10:43,639 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 00:10:43,643 INFO core: _init_accounts coroutine started
2026-09-24 00:10:43,644 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 00:10:43,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:15:23,463 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 00:15:23,463 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 00:15:23,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:20:13,827 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 00:20:13,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:25:23,167 INFO core: Event loop thread started, running loop forever
2026-09-24 00:25:23,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 00:25:23,473 INFO core: _init_accounts coroutine started
2026-09-24 00:25:23,475 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 00:25:23,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:30:05,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 00:30:24,000 INFO core: Event loop thread started, running loop forever
2026-09-24 00:30:24,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 00:30:24,305 INFO core: _init_accounts coroutine started
2026-09-24 00:30:24,306 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 00:30:24,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:35:30,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 00:35:46,340 INFO core: Event loop thread started, running loop forever
2026-09-24 00:35:46,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 00:35:46,645 INFO core: _init_accounts coroutine started
2026-09-24 00:35:46,645 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 00:35:46,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:40:14,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:45:16,482 INFO core: Event loop thread started, running loop forever
2026-09-24 00:45:16,783 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 00:45:16,788 INFO core: _init_accounts coroutine started
2026-09-24 00:45:16,789 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 00:45:16,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:45:21,478 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 00:50:30,388 INFO core: Event loop thread started, running loop forever
2026-09-24 00:50:30,689 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 00:50:30,693 INFO core: _init_accounts coroutine started
2026-09-24 00:50:30,693 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 00:50:30,708 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 00:55:18,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:00:24,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 01:00:27,872 INFO core: Event loop thread started, running loop forever
2026-09-24 01:00:28,173 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 01:00:28,179 INFO core: _init_accounts coroutine started
2026-09-24 01:00:28,180 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 01:00:28,186 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:05:33,262 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 01:05:33,262 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 01:05:33,264 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 01:05:33,266 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 01:05:33,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:10:33,327 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 01:10:33,327 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 01:10:33,330 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 01:10:33,331 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 01:10:33,337 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:15:26,747 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 01:15:26,752 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:15:26,758 WARNING core: Account 2: connect timed out after 35s
2026-09-24 01:15:26,760 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-24 01:15:26,761 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-24 01:15:26,762 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 01:20:14,532 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-24 01:20:14,532 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-24 01:20:14,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:25:21,384 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 01:25:21,385 WARNING core: Account 2: connect timed out after 35s
2026-09-24 01:25:21,386 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-24 01:25:42,645 INFO core: Event loop thread started, running loop forever
2026-09-24 01:25:42,945 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 01:25:42,949 INFO core: _init_accounts coroutine started
2026-09-24 01:25:42,951 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 01:25:42,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:30:43,594 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:30:43,595 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 01:30:43,595 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 01:35:26,557 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 01:35:26,562 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:40:09,541 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 01:40:09,543 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:45:06,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:50:47,942 INFO core: Event loop thread started, running loop forever
2026-09-24 01:50:48,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 01:50:48,246 INFO core: _init_accounts coroutine started
2026-09-24 01:50:48,247 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 01:50:48,255 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 01:55:28,426 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 01:55:28,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 01:55:28,428 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 01:55:28,430 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 01:55:28,433 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:00:17,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:05:23,436 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 02:05:46,200 INFO core: Event loop thread started, running loop forever
2026-09-24 02:05:46,501 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 02:05:46,509 INFO core: _init_accounts coroutine started
2026-09-24 02:05:46,509 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 02:05:46,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:10:51,981 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:15:31,545 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 02:15:31,545 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 02:15:31,547 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 02:15:31,548 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:15:31,548 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 02:20:38,416 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 02:20:38,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 02:20:38,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 02:20:52,544 INFO core: Event loop thread started, running loop forever
2026-09-24 02:20:52,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 02:20:52,849 INFO core: _init_accounts coroutine started
2026-09-24 02:20:52,851 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 02:20:52,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:25:26,928 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 02:25:26,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:30:22,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:35:05,854 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-24 02:35:05,855 INFO core: _init_accounts coroutine started
2026-09-24 02:35:05,855 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 02:35:05,862 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 02:35:05,862 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 02:35:05,863 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:40:11,385 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 02:40:11,386 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 02:40:32,435 INFO core: Event loop thread started, running loop forever
2026-09-24 02:40:32,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 02:40:32,744 INFO core: _init_accounts coroutine started
2026-09-24 02:40:32,744 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 02:40:32,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:45:04,364 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 02:45:37,479 INFO core: Event loop thread started, running loop forever
2026-09-24 02:45:37,780 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 02:45:37,785 INFO core: _init_accounts coroutine started
2026-09-24 02:45:37,786 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 02:45:37,789 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:50:44,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 02:50:45,544 INFO core: Event loop thread started, running loop forever
2026-09-24 02:50:45,845 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 02:50:45,849 INFO core: _init_accounts coroutine started
2026-09-24 02:50:45,850 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 02:50:45,859 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 02:55:44,760 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:00:06,719 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 03:00:06,720 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 03:00:06,730 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 03:00:06,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:05:43,753 INFO core: Event loop thread started, running loop forever
2026-09-24 03:05:44,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 03:05:44,057 INFO core: _init_accounts coroutine started
2026-09-24 03:05:44,058 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 03:05:44,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:10:13,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:15:20,359 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 03:15:20,361 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 03:15:20,361 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-24 03:15:20,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 03:15:20,362 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 03:15:20,362 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 03:15:20,362 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 03:15:20,362 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 03:15:20,363 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 03:15:48,155 INFO core: Event loop thread started, running loop forever
2026-09-24 03:15:48,456 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 03:15:48,466 INFO core: _init_accounts coroutine started
2026-09-24 03:15:48,467 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 03:15:48,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:20:37,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:25:39,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:30:46,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 03:30:47,611 INFO core: Event loop thread started, running loop forever
2026-09-24 03:30:47,912 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 03:30:47,916 INFO core: _init_accounts coroutine started
2026-09-24 03:30:47,917 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 03:30:47,924 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:35:11,701 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:35:11,702 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 03:40:18,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 03:40:18,402 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 03:40:18,402 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 03:40:18,402 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 03:40:18,403 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 03:40:18,403 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 03:40:18,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 03:40:36,259 INFO core: Event loop thread started, running loop forever
2026-09-24 03:40:36,560 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 03:40:36,565 INFO core: _init_accounts coroutine started
2026-09-24 03:40:36,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 03:40:36,582 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 03:40:36,582 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 03:40:36,583 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 03:40:36,584 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 03:40:36,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:45:44,254 INFO core: Event loop thread started, running loop forever
2026-09-24 03:45:44,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 03:45:44,560 INFO core: _init_accounts coroutine started
2026-09-24 03:45:44,561 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 03:45:44,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:50:19,980 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 03:50:19,981 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 03:50:19,984 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 03:55:06,715 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 03:55:06,716 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 03:55:06,719 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 03:55:06,721 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:00:13,405 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 04:00:19,795 INFO core: Event loop thread started, running loop forever
2026-09-24 04:00:20,096 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 04:00:20,103 INFO core: _init_accounts coroutine started
2026-09-24 04:00:20,104 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 04:00:20,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:05:23,359 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 04:05:23,359 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 04:05:23,360 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 04:05:23,362 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 04:05:23,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:10:42,772 INFO core: Event loop thread started, running loop forever
2026-09-24 04:10:43,073 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 04:10:43,078 INFO core: _init_accounts coroutine started
2026-09-24 04:10:43,078 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 04:10:43,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:15:49,454 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 04:15:54,034 INFO core: Event loop thread started, running loop forever
2026-09-24 04:15:54,335 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 04:15:54,337 INFO core: _init_accounts coroutine started
2026-09-24 04:15:54,337 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 04:15:54,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:20:51,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:25:52,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:30:09,663 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 04:30:09,701 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:35:48,304 INFO core: Event loop thread started, running loop forever
2026-09-24 04:35:48,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 04:35:48,608 INFO core: _init_accounts coroutine started
2026-09-24 04:35:48,613 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 04:35:48,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:40:30,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:45:05,691 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 04:45:05,692 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 04:45:05,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:50:12,385 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 04:50:12,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 04:50:12,386 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 04:50:12,387 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 04:50:12,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 04:50:12,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 04:50:12,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 04:50:26,328 INFO core: Event loop thread started, running loop forever
2026-09-24 04:50:26,628 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 04:50:26,633 INFO core: _init_accounts coroutine started
2026-09-24 04:50:26,633 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 04:50:26,638 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 04:55:13,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:00:05,392 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 05:00:31,486 INFO core: Event loop thread started, running loop forever
2026-09-24 05:00:31,787 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 05:00:31,791 INFO core: _init_accounts coroutine started
2026-09-24 05:00:31,792 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 05:00:31,797 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:05:10,198 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 05:05:10,198 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 05:05:10,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:05:10,201 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 05:10:16,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 05:10:49,323 INFO core: Event loop thread started, running loop forever
2026-09-24 05:10:49,624 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 05:10:49,633 INFO core: _init_accounts coroutine started
2026-09-24 05:10:49,633 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 05:10:49,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:15:40,049 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 05:15:40,050 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 05:15:40,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:20:14,469 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 05:20:14,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:25:21,377 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 05:25:41,179 INFO core: Event loop thread started, running loop forever
2026-09-24 05:25:41,480 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 05:25:41,486 INFO core: _init_accounts coroutine started
2026-09-24 05:25:41,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 05:25:41,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:30:30,318 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 05:30:30,327 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:35:11,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:40:22,848 INFO core: Event loop thread started, running loop forever
2026-09-24 05:40:23,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 05:40:23,153 INFO core: _init_accounts coroutine started
2026-09-24 05:40:23,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 05:40:23,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:45:37,470 INFO core: Event loop thread started, running loop forever
2026-09-24 05:45:37,773 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 05:45:37,778 INFO core: _init_accounts coroutine started
2026-09-24 05:45:37,778 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 05:45:37,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:50:44,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 05:50:48,880 INFO core: Event loop thread started, running loop forever
2026-09-24 05:50:49,181 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 05:50:49,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 05:55:27,691 INFO core: _init_accounts coroutine started
2026-09-24 05:55:27,692 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 05:55:27,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:00:33,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 06:00:33,413 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 06:00:36,733 INFO core: Event loop thread started, running loop forever
2026-09-24 06:00:37,040 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 06:00:37,044 INFO core: _init_accounts coroutine started
2026-09-24 06:00:37,046 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 06:00:37,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:05:38,486 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 06:05:38,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:05:38,494 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 06:10:14,174 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 06:10:14,177 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 06:10:14,193 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:15:43,599 INFO core: Event loop thread started, running loop forever
2026-09-24 06:15:43,900 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 06:15:43,906 INFO core: _init_accounts coroutine started
2026-09-24 06:15:43,906 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 06:15:43,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:20:22,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:25:29,462 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 06:25:42,864 INFO core: Event loop thread started, running loop forever
2026-09-24 06:25:43,165 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 06:25:43,169 INFO core: _init_accounts coroutine started
2026-09-24 06:25:43,178 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:25:43,185 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 06:25:43,191 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 06:25:43,192 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 06:25:43,193 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 06:30:24,053 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 06:30:24,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:35:31,507 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 06:35:31,507 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 06:35:31,507 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 06:35:48,424 INFO core: Event loop thread started, running loop forever
2026-09-24 06:35:48,725 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 06:35:48,731 INFO core: _init_accounts coroutine started
2026-09-24 06:35:48,732 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 06:35:48,742 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:40:42,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:45:19,909 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 06:45:19,909 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 06:45:19,911 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 06:45:19,912 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 06:45:19,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:50:20,111 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 06:55:06,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:00:12,539 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 07:00:19,345 INFO core: Event loop thread started, running loop forever
2026-09-24 07:00:19,646 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 07:00:19,650 INFO core: _init_accounts coroutine started
2026-09-24 07:00:19,650 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 07:00:19,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:05:17,343 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 07:05:17,344 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 07:05:17,350 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 07:05:17,352 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 07:05:17,359 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:10:23,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:10:23,114 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 07:10:23,114 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 07:10:23,119 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 07:10:23,120 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 07:15:36,622 INFO core: Event loop thread started, running loop forever
2026-09-24 07:15:36,923 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 07:15:36,927 INFO core: _init_accounts coroutine started
2026-09-24 07:15:36,930 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 07:15:36,936 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:15:36,942 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 07:15:36,942 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 07:15:36,946 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 07:15:36,948 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 07:20:08,938 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:25:16,395 INFO core: Event loop thread started, running loop forever
2026-09-24 07:25:16,696 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 07:25:16,700 INFO core: _init_accounts coroutine started
2026-09-24 07:25:16,704 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 07:25:16,710 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:30:51,539 INFO core: Event loop thread started, running loop forever
2026-09-24 07:30:51,840 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 07:30:51,848 INFO core: _init_accounts coroutine started
2026-09-24 07:30:51,848 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 07:30:51,866 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:35:33,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:40:18,969 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 07:40:18,970 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 07:40:18,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:45:24,423 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 07:45:48,770 INFO core: Event loop thread started, running loop forever
2026-09-24 07:45:49,073 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 07:45:49,078 INFO core: _init_accounts coroutine started
2026-09-24 07:45:49,079 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 07:45:49,084 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:50:42,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 07:55:10,483 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 07:55:10,484 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 07:55:10,489 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:00:22,623 INFO core: Event loop thread started, running loop forever
2026-09-24 08:00:22,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 08:00:22,927 INFO core: _init_accounts coroutine started
2026-09-24 08:00:22,929 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 08:00:22,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:05:15,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:10:21,411 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 08:10:33,522 INFO core: Event loop thread started, running loop forever
2026-09-24 08:10:33,823 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 08:10:33,831 INFO core: _init_accounts coroutine started
2026-09-24 08:10:33,831 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 08:10:33,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:15:12,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:20:31,111 INFO core: Event loop thread started, running loop forever
2026-09-24 08:20:31,412 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 08:20:31,415 INFO core: _init_accounts coroutine started
2026-09-24 08:20:31,417 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 08:20:31,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:25:13,855 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 08:25:13,857 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 08:25:13,861 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 08:25:13,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:30:17,884 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 08:30:17,945 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:30:17,950 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 08:35:23,439 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 08:35:23,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 08:35:49,520 INFO core: Event loop thread started, running loop forever
2026-09-24 08:35:49,820 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 08:35:49,823 INFO core: _init_accounts coroutine started
2026-09-24 08:35:49,825 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 08:35:49,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:40:50,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:45:19,016 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 08:45:19,016 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 08:45:19,019 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 08:45:19,020 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:45:19,021 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 08:50:26,452 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 08:50:26,453 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 08:50:26,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 08:50:39,145 INFO core: Event loop thread started, running loop forever
2026-09-24 08:50:39,445 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 08:50:39,450 INFO core: _init_accounts coroutine started
2026-09-24 08:50:39,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 08:50:39,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 08:55:35,651 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 08:55:35,657 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:00:22,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:05:36,216 INFO core: Event loop thread started, running loop forever
2026-09-24 09:05:36,517 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 09:05:36,525 INFO core: _init_accounts coroutine started
2026-09-24 09:05:36,526 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 09:05:36,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:10:18,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:15:31,851 INFO core: Event loop thread started, running loop forever
2026-09-24 09:15:32,152 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 09:15:32,155 INFO core: _init_accounts coroutine started
2026-09-24 09:15:32,158 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 09:15:32,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:20:29,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:25:36,182 INFO core: Event loop thread started, running loop forever
2026-09-24 09:25:36,484 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 09:25:36,489 INFO core: _init_accounts coroutine started
2026-09-24 09:25:36,490 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 09:25:36,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:30:42,494 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 09:30:46,660 INFO core: Event loop thread started, running loop forever
2026-09-24 09:30:46,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 09:30:46,977 INFO core: _init_accounts coroutine started
2026-09-24 09:30:46,977 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 09:30:46,998 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:35:29,483 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 09:35:29,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:40:07,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:45:44,566 INFO core: Event loop thread started, running loop forever
2026-09-24 09:45:44,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 09:45:44,875 INFO core: _init_accounts coroutine started
2026-09-24 09:45:44,875 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 09:45:44,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:50:42,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 09:55:25,762 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 09:55:25,797 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:00:54,845 INFO core: Event loop thread started, running loop forever
2026-09-24 10:00:55,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 10:00:55,151 INFO core: _init_accounts coroutine started
2026-09-24 10:00:55,151 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 10:00:55,178 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 10:00:55,178 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 10:00:55,180 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 10:00:55,182 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 10:00:55,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:05:17,123 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:10:26,307 INFO core: Event loop thread started, running loop forever
2026-09-24 10:10:26,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 10:10:26,613 INFO core: _init_accounts coroutine started
2026-09-24 10:10:26,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 10:10:26,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:15:32,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:20:11,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:25:15,723 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 10:25:15,724 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 10:25:15,728 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 10:25:15,729 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 10:25:15,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:30:21,552 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 10:30:48,837 INFO core: Event loop thread started, running loop forever
2026-09-24 10:30:49,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 10:30:49,142 INFO core: _init_accounts coroutine started
2026-09-24 10:30:49,144 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 10:30:49,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:35:17,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:40:24,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 10:40:43,479 INFO core: Event loop thread started, running loop forever
2026-09-24 10:40:43,780 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 10:40:43,783 INFO core: _init_accounts coroutine started
2026-09-24 10:40:43,784 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 10:40:43,791 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:45:23,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:50:06,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 10:55:13,364 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 10:55:14,750 INFO core: Event loop thread started, running loop forever
2026-09-24 10:55:15,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 10:55:15,056 INFO core: _init_accounts coroutine started
2026-09-24 10:55:15,056 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 10:55:15,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:00:21,377 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 11:00:51,309 INFO core: Event loop thread started, running loop forever
2026-09-24 11:00:51,610 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 11:00:51,614 INFO core: _init_accounts coroutine started
2026-09-24 11:00:51,616 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 11:00:51,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:05:20,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:10:20,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:15:26,477 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 11:15:35,230 INFO core: Event loop thread started, running loop forever
2026-09-24 11:15:35,531 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 11:15:35,535 INFO core: _init_accounts coroutine started
2026-09-24 11:15:35,536 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 11:15:35,542 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:20:31,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:25:38,425 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 11:25:43,172 INFO core: Event loop thread started, running loop forever
2026-09-24 11:25:43,474 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 11:25:43,479 INFO core: _init_accounts coroutine started
2026-09-24 11:25:43,484 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 11:25:43,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:30:48,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:35:13,499 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 11:35:13,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 11:35:13,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:40:08,927 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 11:40:08,930 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:40:08,931 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 11:45:39,997 INFO core: Event loop thread started, running loop forever
2026-09-24 11:45:40,298 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 11:45:40,301 INFO core: _init_accounts coroutine started
2026-09-24 11:45:40,303 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 11:45:40,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:50:13,558 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 11:55:11,689 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 11:55:11,689 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 11:55:11,690 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 11:55:11,691 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 11:55:11,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:00:40,344 INFO core: Event loop thread started, running loop forever
2026-09-24 12:00:40,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 12:00:40,674 INFO core: _init_accounts coroutine started
2026-09-24 12:00:40,675 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 12:00:40,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:05:18,840 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 12:05:18,850 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:10:10,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:15:34,540 INFO core: Event loop thread started, running loop forever
2026-09-24 12:15:34,849 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 12:15:34,856 INFO core: _init_accounts coroutine started
2026-09-24 12:15:34,857 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 12:15:34,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:20:14,825 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 12:20:14,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:20:14,827 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 12:25:20,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 12:25:20,385 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 12:25:20,386 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 12:25:20,386 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 12:25:20,386 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 12:25:20,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 12:25:29,148 INFO core: Event loop thread started, running loop forever
2026-09-24 12:25:29,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 12:25:29,451 INFO core: _init_accounts coroutine started
2026-09-24 12:25:29,453 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 12:25:29,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:30:33,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:35:38,438 INFO core: Event loop thread started, running loop forever
2026-09-24 12:35:38,743 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 12:35:38,747 INFO core: _init_accounts coroutine started
2026-09-24 12:35:38,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 12:35:38,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:35:40,432 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 12:40:21,376 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 12:40:21,421 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:45:22,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:50:17,733 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-24 12:50:17,734 INFO core: _init_accounts coroutine started
2026-09-24 12:50:17,735 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 12:50:17,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:55:08,335 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 12:55:08,339 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 12:55:08,445 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 13:00:15,547 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 13:00:15,550 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 13:00:40,368 INFO core: Event loop thread started, running loop forever
2026-09-24 13:00:40,669 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 13:00:40,679 INFO core: _init_accounts coroutine started
2026-09-24 13:00:40,681 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 13:00:40,689 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:05:47,545 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 13:05:49,221 INFO core: Event loop thread started, running loop forever
2026-09-24 13:05:49,524 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 13:05:49,528 INFO core: _init_accounts coroutine started
2026-09-24 13:05:49,528 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 13:05:49,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:10:12,266 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 13:10:12,266 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 13:10:12,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:15:15,103 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 13:15:15,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:20:22,391 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 13:20:22,394 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 13:20:49,310 INFO core: Event loop thread started, running loop forever
2026-09-24 13:20:49,612 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 13:20:49,618 INFO core: _init_accounts coroutine started
2026-09-24 13:20:49,619 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 13:20:49,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:25:33,448 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:30:40,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 13:30:43,252 INFO core: Event loop thread started, running loop forever
2026-09-24 13:30:43,556 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 13:30:43,559 INFO core: _init_accounts coroutine started
2026-09-24 13:30:43,561 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 13:30:43,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:35:13,142 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 13:35:13,142 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 13:35:13,144 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 13:35:13,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:40:20,475 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 13:40:20,476 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 13:40:20,477 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 13:40:20,477 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 13:40:20,590 INFO core: Event loop thread started, running loop forever
2026-09-24 13:40:20,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 13:40:20,901 INFO core: _init_accounts coroutine started
2026-09-24 13:40:20,901 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 13:40:20,914 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-24 13:40:20,916 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-24 13:45:32,241 INFO core: Event loop thread started, running loop forever
2026-09-24 13:45:32,543 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 13:45:32,548 INFO core: _init_accounts coroutine started
2026-09-24 13:45:32,549 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 13:45:32,557 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:50:17,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 13:55:24,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 13:55:24,409 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 13:55:24,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 13:55:33,675 INFO core: Event loop thread started, running loop forever
2026-09-24 13:55:33,976 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 13:55:33,981 INFO core: _init_accounts coroutine started
2026-09-24 13:55:33,984 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 13:55:33,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:00:10,428 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 14:00:10,429 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 14:00:10,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 14:00:10,440 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 14:00:10,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:05:36,954 INFO core: Event loop thread started, running loop forever
2026-09-24 14:05:37,257 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:05:37,260 INFO core: _init_accounts coroutine started
2026-09-24 14:05:37,261 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:05:37,267 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:10:43,425 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 14:10:50,595 INFO core: Event loop thread started, running loop forever
2026-09-24 14:10:50,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:10:50,901 INFO core: _init_accounts coroutine started
2026-09-24 14:10:50,903 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:10:50,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:15:22,231 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 14:15:22,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:20:41,449 INFO core: Event loop thread started, running loop forever
2026-09-24 14:20:41,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:20:41,754 INFO core: _init_accounts coroutine started
2026-09-24 14:20:41,754 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:20:41,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:25:27,087 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:30:22,629 INFO core: Event loop thread started, running loop forever
2026-09-24 14:30:22,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:30:22,935 INFO core: _init_accounts coroutine started
2026-09-24 14:30:22,936 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:30:22,942 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:35:33,628 INFO core: Event loop thread started, running loop forever
2026-09-24 14:35:33,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:35:33,935 INFO core: _init_accounts coroutine started
2026-09-24 14:35:33,935 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:35:33,942 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:40:42,598 INFO core: Event loop thread started, running loop forever
2026-09-24 14:40:42,899 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:40:42,902 INFO core: _init_accounts coroutine started
2026-09-24 14:40:42,904 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:40:42,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:45:23,721 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:50:17,747 INFO core: Event loop thread started, running loop forever
2026-09-24 14:50:18,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:50:18,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 14:50:30,772 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 14:50:30,773 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 14:50:30,773 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-24 14:50:30,774 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 14:55:25,500 INFO core: _init_accounts coroutine started
2026-09-24 14:55:25,500 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:55:25,500 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-24 14:55:26,753 INFO core: Event loop thread started, running loop forever
2026-09-24 14:55:27,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 14:55:27,058 INFO core: _init_accounts coroutine started
2026-09-24 14:55:27,060 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 14:55:27,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:00:25,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:05:10,910 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 15:05:10,910 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 15:05:10,913 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 15:05:10,917 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 15:05:10,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:10:28,751 INFO core: Event loop thread started, running loop forever
2026-09-24 15:10:29,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 15:10:29,058 INFO core: _init_accounts coroutine started
2026-09-24 15:10:29,058 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 15:10:29,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:15:21,946 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 15:15:21,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:20:43,890 INFO core: Event loop thread started, running loop forever
2026-09-24 15:20:44,190 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 15:20:44,199 INFO core: _init_accounts coroutine started
2026-09-24 15:20:44,199 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 15:20:44,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:25:41,321 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 15:25:41,321 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 15:25:41,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:30:31,555 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 15:30:31,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:35:34,833 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 15:35:34,845 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:40:12,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:45:18,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 15:45:25,915 INFO core: Event loop thread started, running loop forever
2026-09-24 15:45:26,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 15:45:26,221 INFO core: _init_accounts coroutine started
2026-09-24 15:45:26,221 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 15:45:26,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:50:49,696 INFO core: Event loop thread started, running loop forever
2026-09-24 15:50:49,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 15:50:50,001 INFO core: _init_accounts coroutine started
2026-09-24 15:50:50,003 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 15:50:50,007 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 15:55:31,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 15:55:31,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 15:55:31,409 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 15:55:31,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 15:55:31,419 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 15:55:31,419 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 15:55:31,424 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 15:55:31,425 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 15:55:31,433 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:00:36,504 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 16:00:36,508 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:00:36,515 WARNING core: Account 2: connect timed out after 35s
2026-09-24 16:05:36,919 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-24 16:05:36,920 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-24 16:05:36,921 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 16:05:36,923 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-24 16:05:36,924 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-24 16:05:36,938 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:10:24,585 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 16:10:24,585 WARNING core: Account 2: connect timed out after 35s
2026-09-24 16:10:24,586 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-24 16:10:24,586 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-24 16:10:24,586 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 16:10:24,587 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-24 16:10:24,587 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-24 16:10:24,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:15:31,460 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 16:15:31,461 WARNING core: Account 2: connect timed out after 35s
2026-09-24 16:15:31,462 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-24 16:15:31,462 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-24 16:15:31,463 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 16:15:31,465 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-24 16:15:31,465 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-24 16:15:34,402 INFO core: Event loop thread started, running loop forever
2026-09-24 16:15:34,703 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 16:15:34,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:20:28,404 INFO core: _init_accounts coroutine started
2026-09-24 16:20:28,405 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 16:20:28,420 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:25:09,300 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 16:25:09,300 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 16:25:09,302 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 16:25:09,303 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 16:25:09,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:30:13,921 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:35:11,065 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 16:35:11,066 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 16:35:11,088 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 16:35:11,089 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 16:35:11,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:40:18,496 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 16:40:18,496 WARNING core: Account 2: connect timed out after 35s
2026-09-24 16:40:18,497 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-24 16:40:18,497 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-24 16:40:18,498 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 16:40:35,625 INFO core: Event loop thread started, running loop forever
2026-09-24 16:40:35,926 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 16:40:35,932 INFO core: _init_accounts coroutine started
2026-09-24 16:40:35,933 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 16:40:35,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:45:41,209 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 16:45:41,210 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 16:45:41,220 INFO core: Event loop thread started, running loop forever
2026-09-24 16:45:41,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 16:45:41,525 INFO core: _init_accounts coroutine started
2026-09-24 16:45:41,527 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 16:45:41,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:50:19,892 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 16:50:19,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 16:50:19,894 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 16:50:19,896 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 16:50:19,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 16:55:48,233 INFO core: Event loop thread started, running loop forever
2026-09-24 16:55:48,537 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 16:55:48,540 INFO core: _init_accounts coroutine started
2026-09-24 16:55:48,541 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 16:55:48,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:00:25,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:05:25,589 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 17:05:25,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:10:29,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:15:23,794 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-24 17:15:23,796 INFO core: _init_accounts coroutine started
2026-09-24 17:15:23,796 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 17:15:23,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:20:10,448 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 17:20:10,449 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:20:10,449 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 17:25:25,637 INFO core: Event loop thread started, running loop forever
2026-09-24 17:25:25,939 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 17:25:25,942 INFO core: _init_accounts coroutine started
2026-09-24 17:25:25,944 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 17:25:25,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:30:42,563 INFO core: Event loop thread started, running loop forever
2026-09-24 17:30:42,864 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 17:30:42,869 INFO core: _init_accounts coroutine started
2026-09-24 17:30:42,870 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 17:30:42,875 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:35:31,051 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 17:35:31,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:40:13,135 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:45:42,163 INFO core: Event loop thread started, running loop forever
2026-09-24 17:45:42,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 17:45:42,467 INFO core: _init_accounts coroutine started
2026-09-24 17:45:42,468 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 17:45:42,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:50:45,671 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 17:50:45,671 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 17:50:45,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 17:55:17,524 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 17:55:17,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:00:24,365 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 18:00:39,911 INFO core: Event loop thread started, running loop forever
2026-09-24 18:00:40,213 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 18:00:40,215 INFO core: _init_accounts coroutine started
2026-09-24 18:00:40,217 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 18:00:40,223 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:05:43,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:10:28,946 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 18:10:28,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:15:39,201 INFO core: Event loop thread started, running loop forever
2026-09-24 18:15:39,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 18:15:39,508 INFO core: _init_accounts coroutine started
2026-09-24 18:15:39,508 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 18:15:39,513 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:20:47,709 INFO core: Event loop thread started, running loop forever
2026-09-24 18:20:48,009 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 18:20:48,015 INFO core: _init_accounts coroutine started
2026-09-24 18:20:48,016 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 18:20:48,023 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:25:16,732 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 18:25:16,739 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:30:50,412 INFO core: Event loop thread started, running loop forever
2026-09-24 18:30:50,713 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 18:30:50,719 INFO core: _init_accounts coroutine started
2026-09-24 18:30:50,719 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 18:30:50,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:35:10,612 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 18:35:10,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:40:09,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:45:44,862 INFO core: Event loop thread started, running loop forever
2026-09-24 18:45:45,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 18:45:45,167 INFO core: _init_accounts coroutine started
2026-09-24 18:45:45,168 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 18:45:45,172 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:50:42,979 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 18:55:51,715 INFO core: Event loop thread started, running loop forever
2026-09-24 18:55:52,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 18:55:52,020 INFO core: _init_accounts coroutine started
2026-09-24 18:55:52,020 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 18:55:52,049 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 18:55:52,050 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 18:55:52,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:00:16,596 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 19:00:16,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:05:11,330 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 19:05:11,337 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:10:18,502 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 19:10:18,503 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 19:10:18,503 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 19:10:25,152 INFO core: Event loop thread started, running loop forever
2026-09-24 19:10:25,453 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 19:10:25,457 INFO core: _init_accounts coroutine started
2026-09-24 19:10:25,460 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 19:10:25,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:15:06,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:20:12,460 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 19:20:43,288 INFO core: Event loop thread started, running loop forever
2026-09-24 19:20:43,589 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 19:20:43,596 INFO core: _init_accounts coroutine started
2026-09-24 19:20:43,597 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 19:20:43,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:25:37,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 19:25:37,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:25:37,362 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 19:30:31,262 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 19:30:31,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:35:38,456 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 19:35:38,457 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 19:35:38,458 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 19:35:38,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 19:35:49,856 INFO core: Event loop thread started, running loop forever
2026-09-24 19:35:50,158 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 19:35:50,163 INFO core: _init_accounts coroutine started
2026-09-24 19:35:50,164 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 19:35:50,172 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 19:35:50,173 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 19:35:50,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:40:42,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 19:40:42,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:45:28,994 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 19:45:29,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:50:13,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 19:55:50,679 INFO core: Event loop thread started, running loop forever
2026-09-24 19:55:50,980 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 19:55:50,983 INFO core: _init_accounts coroutine started
2026-09-24 19:55:50,986 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 19:55:50,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:00:33,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:05:32,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 20:05:32,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 20:05:32,410 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 20:05:32,416 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:10:28,534 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 20:10:28,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:15:35,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 20:15:51,989 INFO core: Event loop thread started, running loop forever
2026-09-24 20:15:52,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 20:15:52,293 INFO core: _init_accounts coroutine started
2026-09-24 20:15:52,295 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 20:15:52,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:20:27,768 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 20:20:27,769 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 20:20:27,777 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 20:20:27,779 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 20:20:27,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:25:14,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:30:24,670 INFO core: Event loop thread started, running loop forever
2026-09-24 20:30:24,971 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 20:30:24,976 INFO core: _init_accounts coroutine started
2026-09-24 20:30:24,976 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 20:30:24,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:35:09,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:35:09,057 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 20:35:09,058 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 20:40:16,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 20:40:16,385 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 20:40:16,386 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 20:40:16,386 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 20:40:16,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 20:40:26,907 INFO core: Event loop thread started, running loop forever
2026-09-24 20:40:27,208 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 20:40:27,211 INFO core: _init_accounts coroutine started
2026-09-24 20:40:27,215 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 20:40:27,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:45:36,545 INFO core: Event loop thread started, running loop forever
2026-09-24 20:45:36,846 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 20:45:36,850 INFO core: _init_accounts coroutine started
2026-09-24 20:45:36,851 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 20:45:36,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:50:10,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 20:55:16,468 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 20:55:16,468 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 20:55:16,476 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 20:55:16,477 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 20:55:16,478 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 20:55:16,478 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 20:55:16,478 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 20:55:16,478 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 20:55:48,150 INFO core: Event loop thread started, running loop forever
2026-09-24 20:55:48,451 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 20:55:48,454 INFO core: _init_accounts coroutine started
2026-09-24 20:55:48,454 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 20:55:48,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:00:05,647 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 21:00:05,647 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 21:00:05,668 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:05:12,424 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 21:05:40,746 INFO core: Event loop thread started, running loop forever
2026-09-24 21:05:41,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 21:05:41,050 INFO core: _init_accounts coroutine started
2026-09-24 21:05:41,052 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 21:05:41,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:10:23,164 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:15:51,154 INFO core: Event loop thread started, running loop forever
2026-09-24 21:15:51,455 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 21:15:51,460 INFO core: _init_accounts coroutine started
2026-09-24 21:15:51,461 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 21:15:51,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:20:32,968 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 21:20:32,969 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 21:20:32,971 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 21:20:32,973 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 21:20:32,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:25:36,401 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 21:25:36,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 21:25:36,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:30:43,396 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 21:30:47,375 INFO core: Event loop thread started, running loop forever
2026-09-24 21:30:47,676 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 21:30:47,680 INFO core: _init_accounts coroutine started
2026-09-24 21:30:47,681 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 21:30:47,686 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:35:06,802 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:40:20,199 INFO core: Event loop thread started, running loop forever
2026-09-24 21:40:20,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 21:40:20,503 INFO core: _init_accounts coroutine started
2026-09-24 21:40:20,504 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 21:40:20,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:45:27,425 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 21:45:28,945 INFO core: Event loop thread started, running loop forever
2026-09-24 21:45:29,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 21:45:29,250 INFO core: _init_accounts coroutine started
2026-09-24 21:45:29,251 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 21:45:29,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:50:35,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 21:50:41,771 INFO core: Event loop thread started, running loop forever
2026-09-24 21:50:42,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 21:50:42,078 INFO core: _init_accounts coroutine started
2026-09-24 21:50:42,078 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 21:50:42,084 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 21:50:42,084 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 21:50:42,085 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 21:50:42,087 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 21:50:42,088 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 21:55:29,838 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:00:08,916 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 22:00:08,917 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 22:00:08,921 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:00:08,924 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 22:00:08,926 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 22:05:14,380 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 22:05:14,381 WARNING core: Account 2: connect timed out after 35s
2026-09-24 22:05:26,796 INFO core: Event loop thread started, running loop forever
2026-09-24 22:05:27,097 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 22:05:27,101 INFO core: _init_accounts coroutine started
2026-09-24 22:05:27,103 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 22:05:27,107 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:10:03,912 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 22:10:03,912 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 22:10:03,913 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 22:10:03,915 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 22:10:03,925 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 22:10:03,925 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 22:10:03,929 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 22:10:03,930 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 22:10:03,946 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:15:08,838 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 22:15:08,838 WARNING core: Account 2: connect timed out after 35s
2026-09-24 22:15:08,839 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-24 22:15:08,839 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-24 22:15:08,840 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 22:15:08,841 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-24 22:15:08,841 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-24 22:15:08,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:20:14,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 22:20:14,415 WARNING core: Account 2: connect timed out after 35s
2026-09-24 22:20:16,776 INFO core: Event loop thread started, running loop forever
2026-09-24 22:20:17,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 22:20:17,081 INFO core: _init_accounts coroutine started
2026-09-24 22:20:17,082 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 22:20:17,096 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 22:20:17,096 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 22:20:17,097 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 22:20:17,099 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 22:20:17,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:25:23,448 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 22:25:36,226 INFO core: Event loop thread started, running loop forever
2026-09-24 22:25:36,527 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 22:25:36,532 INFO core: _init_accounts coroutine started
2026-09-24 22:25:36,532 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 22:25:36,536 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:30:43,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 22:30:53,194 INFO core: Event loop thread started, running loop forever
2026-09-24 22:30:53,495 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 22:30:53,506 INFO core: _init_accounts coroutine started
2026-09-24 22:30:53,506 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 22:30:53,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:35:17,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:40:13,117 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 22:40:13,117 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 22:40:13,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:40:13,122 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 22:45:05,386 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-24 22:45:05,387 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 22:45:05,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-24 22:45:05,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 22:45:05,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-24 22:45:49,969 INFO core: Event loop thread started, running loop forever
2026-09-24 22:45:50,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 22:45:50,281 INFO core: _init_accounts coroutine started
2026-09-24 22:45:50,282 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 22:45:50,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:50:27,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 22:55:34,453 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 22:55:40,110 INFO core: Event loop thread started, running loop forever
2026-09-24 22:55:40,412 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 22:55:40,415 INFO core: _init_accounts coroutine started
2026-09-24 22:55:40,416 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 22:55:40,421 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:00:44,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:05:25,464 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 23:05:25,465 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 23:05:25,473 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 23:05:25,476 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 23:05:25,478 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:10:52,764 INFO core: Event loop thread started, running loop forever
2026-09-24 23:10:53,065 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 23:10:53,071 INFO core: _init_accounts coroutine started
2026-09-24 23:10:53,072 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 23:10:53,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:15:34,615 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 23:15:34,615 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 23:15:34,616 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 23:15:34,622 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 23:15:34,640 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-24 23:15:34,640 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:15:34,641 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 23:20:40,449 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 23:20:40,450 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 23:20:49,899 INFO core: Event loop thread started, running loop forever
2026-09-24 23:20:50,200 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 23:20:50,203 INFO core: _init_accounts coroutine started
2026-09-24 23:20:50,204 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 23:20:50,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:25:40,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-24 23:25:40,693 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-24 23:25:40,695 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-24 23:25:40,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:30:41,496 INFO core: _init_accounts_inner: reloading LLM config
2026-09-24 23:30:41,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:35:21,771 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-24 23:35:21,773 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-24 23:35:21,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:40:10,274 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-24 23:40:10,275 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-24 23:40:10,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:45:07,549 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 23:45:07,550 WARNING core: Account 2: connect timed out after 35s
2026-09-24 23:45:07,551 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-24 23:45:07,551 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-24 23:45:07,552 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 23:45:07,552 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-24 23:45:07,553 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-24 23:45:07,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:50:09,715 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 23:50:09,716 WARNING core: Account 2: connect timed out after 35s
2026-09-24 23:50:09,716 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-24 23:50:09,716 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-24 23:50:09,717 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 23:50:09,717 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-24 23:50:09,718 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-24 23:50:09,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-24 23:55:16,376 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-24 23:55:16,376 WARNING core: Account 2: connect timed out after 35s
2026-09-24 23:55:16,376 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-24 23:55:16,377 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-24 23:55:16,377 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-24 23:55:23,862 INFO core: Event loop thread started, running loop forever
2026-09-24 23:55:24,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-24 23:55:24,168 INFO core: _init_accounts coroutine started
2026-09-24 23:55:24,169 INFO core: _init_accounts_inner: starting DB migrations
2026-09-24 23:55:24,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:00:35,501 INFO core: Event loop thread started, running loop forever
2026-09-25 00:00:35,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 00:00:35,811 INFO core: _init_accounts coroutine started
2026-09-25 00:00:35,812 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 00:00:35,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:05:51,461 INFO core: Event loop thread started, running loop forever
2026-09-25 00:05:51,762 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 00:05:51,767 INFO core: _init_accounts coroutine started
2026-09-25 00:05:51,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 00:05:51,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:10:32,430 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 00:10:32,430 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 00:10:32,433 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:10:32,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 00:15:04,319 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:20:07,110 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 00:20:07,134 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:25:50,426 INFO core: Event loop thread started, running loop forever
2026-09-25 00:25:50,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 00:25:50,731 INFO core: _init_accounts coroutine started
2026-09-25 00:25:50,732 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 00:25:50,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:30:28,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:35:22,898 INFO core: Event loop thread started, running loop forever
2026-09-25 00:35:23,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 00:35:23,204 INFO core: _init_accounts coroutine started
2026-09-25 00:35:23,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 00:35:23,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:35:23,216 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-25 00:35:34,926 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 00:35:34,926 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 00:35:34,930 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 00:35:34,930 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 00:35:34,931 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 00:35:34,931 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 00:35:34,931 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 00:35:34,931 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-25 00:40:27,931 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-25 00:45:17,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:50:24,637 INFO core: Event loop thread started, running loop forever
2026-09-25 00:50:24,938 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 00:50:24,941 INFO core: _init_accounts coroutine started
2026-09-25 00:50:24,943 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 00:50:24,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 00:55:21,104 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 00:55:21,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:00:28,007 INFO core: Event loop thread started, running loop forever
2026-09-25 01:00:28,308 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 01:00:28,315 INFO core: _init_accounts coroutine started
2026-09-25 01:00:28,315 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 01:00:28,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:05:36,002 INFO core: Event loop thread started, running loop forever
2026-09-25 01:05:36,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 01:05:36,307 INFO core: _init_accounts coroutine started
2026-09-25 01:05:36,307 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 01:05:36,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:10:24,232 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 01:10:24,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:15:12,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:20:16,694 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-25 01:20:16,694 INFO core: _init_accounts coroutine started
2026-09-25 01:20:16,695 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 01:20:16,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:25:14,463 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 01:25:14,464 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 01:25:14,468 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:30:20,440 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 01:30:24,044 INFO core: Event loop thread started, running loop forever
2026-09-25 01:30:24,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 01:30:24,350 INFO core: _init_accounts coroutine started
2026-09-25 01:30:24,351 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 01:30:24,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:35:14,239 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 01:35:14,239 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 01:35:14,241 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 01:35:14,242 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 01:35:14,260 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 01:35:14,261 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 01:35:14,266 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 01:35:14,267 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 01:35:14,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:40:21,399 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 01:40:34,458 INFO core: Event loop thread started, running loop forever
2026-09-25 01:40:34,759 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 01:40:34,763 INFO core: _init_accounts coroutine started
2026-09-25 01:40:34,763 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 01:40:34,777 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 01:40:34,777 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 01:40:34,779 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 01:40:34,780 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 01:40:34,793 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 01:40:34,793 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 01:40:34,799 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 01:40:34,800 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 01:40:34,826 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:45:13,917 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 01:45:13,918 WARNING core: Account 2: connect timed out after 35s
2026-09-25 01:45:13,918 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 01:45:13,918 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 01:45:13,919 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 01:45:13,920 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-25 01:45:13,920 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-25 01:45:13,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:50:19,443 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 01:50:19,445 WARNING core: Account 2: connect timed out after 35s
2026-09-25 01:50:26,962 INFO core: Event loop thread started, running loop forever
2026-09-25 01:50:27,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 01:50:27,268 INFO core: _init_accounts coroutine started
2026-09-25 01:50:27,268 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 01:50:27,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 01:55:23,667 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 01:55:23,668 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 01:55:23,669 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 01:55:23,671 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 01:55:23,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:00:25,373 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:05:36,834 INFO core: Event loop thread started, running loop forever
2026-09-25 02:05:37,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 02:05:37,138 INFO core: _init_accounts coroutine started
2026-09-25 02:05:37,139 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 02:05:37,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:10:24,961 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 02:10:24,961 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 02:10:24,962 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 02:10:24,963 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 02:10:24,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:15:30,430 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 02:15:30,430 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 02:15:30,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 02:15:50,743 INFO core: Event loop thread started, running loop forever
2026-09-25 02:15:51,044 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 02:15:51,048 INFO core: _init_accounts coroutine started
2026-09-25 02:15:51,051 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 02:15:51,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:20:10,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:25:17,427 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 02:25:17,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 02:25:17,428 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-25 02:25:17,428 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 02:25:17,428 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 02:25:17,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 02:25:17,429 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 02:25:17,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 02:25:17,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 02:25:33,535 INFO core: Event loop thread started, running loop forever
2026-09-25 02:25:33,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 02:25:33,842 INFO core: _init_accounts coroutine started
2026-09-25 02:25:33,842 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 02:25:33,849 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:30:07,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:35:21,691 INFO core: Event loop thread started, running loop forever
2026-09-25 02:35:21,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 02:35:21,999 INFO core: _init_accounts coroutine started
2026-09-25 02:35:22,001 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 02:35:22,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:40:47,696 INFO core: Event loop thread started, running loop forever
2026-09-25 02:40:47,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 02:40:48,002 INFO core: _init_accounts coroutine started
2026-09-25 02:40:48,003 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 02:40:48,018 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 02:40:48,018 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 02:40:48,019 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 02:40:48,021 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 02:40:48,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:45:42,031 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:50:46,931 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 02:50:46,933 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 02:50:46,933 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 02:55:38,200 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 02:55:38,201 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 02:55:38,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:00:07,319 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 03:00:07,321 WARNING core: Account 2: connect timed out after 35s
2026-09-25 03:00:07,322 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 03:00:07,322 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 03:00:07,323 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 03:00:07,324 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-25 03:00:07,324 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-25 03:00:07,380 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:05:14,435 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 03:05:14,436 WARNING core: Account 2: connect timed out after 35s
2026-09-25 03:05:14,436 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-25 03:05:14,436 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-25 03:05:14,436 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 03:05:14,437 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-25 03:05:14,437 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-25 03:05:38,209 INFO core: Event loop thread started, running loop forever
2026-09-25 03:05:38,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 03:05:38,517 INFO core: _init_accounts coroutine started
2026-09-25 03:05:38,518 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 03:05:38,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:05:38,540 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 03:05:38,540 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 03:05:38,542 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 03:10:03,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:10:03,991 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 03:15:41,064 INFO core: Event loop thread started, running loop forever
2026-09-25 03:15:41,365 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 03:15:41,368 INFO core: _init_accounts coroutine started
2026-09-25 03:15:41,369 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 03:15:41,373 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:20:05,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:25:48,597 INFO core: Event loop thread started, running loop forever
2026-09-25 03:25:48,898 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 03:25:48,901 INFO core: _init_accounts coroutine started
2026-09-25 03:25:48,902 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 03:25:48,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:30:24,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:35:06,088 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 03:35:06,089 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 03:35:06,090 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 03:35:06,092 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 03:35:06,107 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:40:13,000 INFO core: Event loop thread started, running loop forever
2026-09-25 03:40:13,005 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 03:40:13,012 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 03:40:13,301 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 03:40:13,305 INFO core: _init_accounts coroutine started
2026-09-25 03:40:13,307 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 03:40:13,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:45:14,397 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:45:14,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 03:45:14,398 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 03:45:14,400 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 03:50:20,402 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 03:50:49,511 INFO core: Event loop thread started, running loop forever
2026-09-25 03:50:49,812 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 03:50:49,815 INFO core: _init_accounts coroutine started
2026-09-25 03:50:49,817 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 03:50:49,824 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 03:55:50,386 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 03:55:50,386 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 03:55:50,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:00:13,658 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 04:00:13,663 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:05:36,226 INFO core: Event loop thread started, running loop forever
2026-09-25 04:05:36,527 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 04:05:36,532 INFO core: _init_accounts coroutine started
2026-09-25 04:05:36,532 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 04:05:36,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:10:52,695 INFO core: Event loop thread started, running loop forever
2026-09-25 04:10:52,996 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 04:10:53,003 INFO core: _init_accounts coroutine started
2026-09-25 04:10:53,003 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 04:10:53,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:15:41,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:20:43,175 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 04:20:43,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:25:47,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:30:45,239 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-25 04:30:45,242 INFO core: _init_accounts coroutine started
2026-09-25 04:30:45,243 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 04:30:45,247 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 04:30:45,247 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 04:30:45,248 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 04:30:45,250 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 04:30:45,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:35:40,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:40:46,815 INFO core: Event loop thread started, running loop forever
2026-09-25 04:40:47,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 04:40:47,121 INFO core: _init_accounts coroutine started
2026-09-25 04:40:47,123 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 04:40:47,137 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-25 04:40:47,138 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-25 04:45:41,292 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:50:36,714 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-25 04:50:36,715 INFO core: _init_accounts coroutine started
2026-09-25 04:50:36,716 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 04:50:36,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 04:55:25,718 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:00:31,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 05:00:43,946 INFO core: Event loop thread started, running loop forever
2026-09-25 05:00:44,248 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 05:00:44,251 INFO core: _init_accounts coroutine started
2026-09-25 05:00:44,255 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 05:00:44,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:05:43,830 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 05:05:43,831 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:05:43,831 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 05:10:23,719 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:15:54,028 INFO core: Event loop thread started, running loop forever
2026-09-25 05:15:54,328 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 05:15:54,332 INFO core: _init_accounts coroutine started
2026-09-25 05:15:54,334 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 05:15:54,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:20:04,524 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 05:20:04,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:20:04,531 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 05:25:07,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:30:23,308 INFO core: Event loop thread started, running loop forever
2026-09-25 05:30:23,609 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 05:30:23,612 INFO core: _init_accounts coroutine started
2026-09-25 05:30:23,613 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 05:30:23,618 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:35:30,489 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 05:35:42,134 INFO core: Event loop thread started, running loop forever
2026-09-25 05:35:42,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 05:35:42,441 INFO core: _init_accounts coroutine started
2026-09-25 05:35:42,442 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 05:35:42,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:40:49,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 05:40:51,877 INFO core: Event loop thread started, running loop forever
2026-09-25 05:40:52,179 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 05:40:52,183 INFO core: _init_accounts coroutine started
2026-09-25 05:40:52,184 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 05:40:52,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:45:35,558 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 05:45:35,558 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 05:45:35,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 05:45:35,563 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 05:45:35,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:50:17,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 05:55:39,956 INFO core: Event loop thread started, running loop forever
2026-09-25 05:55:40,262 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 05:55:40,266 INFO core: _init_accounts coroutine started
2026-09-25 05:55:40,269 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 05:55:40,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:00:40,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:00:40,443 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 06:00:40,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 06:05:48,356 INFO core: Event loop thread started, running loop forever
2026-09-25 06:05:48,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 06:05:48,661 INFO core: _init_accounts coroutine started
2026-09-25 06:05:48,662 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 06:05:48,668 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 06:05:48,669 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 06:05:48,670 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 06:05:48,671 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 06:05:48,678 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 06:05:48,678 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 06:05:48,681 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 06:05:48,682 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 06:05:48,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:10:09,093 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 06:10:09,093 WARNING core: Account 2: connect timed out after 35s
2026-09-25 06:10:09,094 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 06:10:09,094 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 06:10:09,095 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 06:10:09,096 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-25 06:10:09,097 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-25 06:10:09,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:15:15,440 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 06:15:26,202 INFO core: Event loop thread started, running loop forever
2026-09-25 06:15:26,503 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 06:15:26,509 INFO core: _init_accounts coroutine started
2026-09-25 06:15:26,510 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 06:15:26,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:20:31,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:25:18,324 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 06:25:18,327 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 06:25:18,330 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 06:25:18,332 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 06:25:18,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:30:48,069 INFO core: Event loop thread started, running loop forever
2026-09-25 06:30:48,370 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 06:30:48,375 INFO core: _init_accounts coroutine started
2026-09-25 06:30:48,375 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 06:30:48,389 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:35:26,778 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 06:35:26,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:40:52,959 INFO core: Event loop thread started, running loop forever
2026-09-25 06:40:53,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 06:40:53,264 INFO core: _init_accounts coroutine started
2026-09-25 06:40:53,264 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 06:40:53,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:45:18,971 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 06:45:18,971 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 06:45:18,973 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 06:45:18,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:45:18,975 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 06:50:16,063 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 06:55:05,832 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 06:55:05,833 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 06:55:05,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:00:11,431 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 07:00:17,204 INFO core: Event loop thread started, running loop forever
2026-09-25 07:00:17,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 07:00:17,510 INFO core: _init_accounts coroutine started
2026-09-25 07:00:17,511 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 07:00:17,524 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:05:24,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 07:05:39,741 INFO core: Event loop thread started, running loop forever
2026-09-25 07:05:40,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 07:05:40,046 INFO core: _init_accounts coroutine started
2026-09-25 07:05:40,048 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 07:05:40,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:10:28,901 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 07:10:28,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:10:28,902 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 07:15:30,046 INFO core: Event loop thread started, running loop forever
2026-09-25 07:15:30,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 07:15:30,349 INFO core: _init_accounts coroutine started
2026-09-25 07:15:30,352 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 07:15:30,359 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-25 07:15:30,362 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-25 07:15:35,042 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 07:20:35,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:25:14,653 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-25 07:25:14,655 INFO core: _init_accounts coroutine started
2026-09-25 07:25:14,655 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 07:25:14,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:30:20,421 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 07:30:49,291 INFO core: Event loop thread started, running loop forever
2026-09-25 07:30:49,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 07:30:49,597 INFO core: _init_accounts coroutine started
2026-09-25 07:30:49,598 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 07:30:49,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:35:18,762 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:40:19,146 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 07:40:19,169 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:45:03,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:50:44,661 INFO core: Event loop thread started, running loop forever
2026-09-25 07:50:44,962 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 07:50:44,967 INFO core: _init_accounts coroutine started
2026-09-25 07:50:44,968 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 07:50:44,974 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 07:55:23,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:00:29,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 08:00:29,401 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 08:00:29,401 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-25 08:00:29,402 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 08:00:29,402 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 08:00:29,402 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 08:00:29,402 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 08:00:29,402 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 08:00:29,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 08:00:43,556 INFO core: Event loop thread started, running loop forever
2026-09-25 08:00:43,861 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 08:00:43,869 INFO core: _init_accounts coroutine started
2026-09-25 08:00:43,870 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 08:00:43,872 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:05:37,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:10:08,639 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 08:10:08,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:15:14,441 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:20:19,979 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-25 08:20:19,980 INFO core: _init_accounts coroutine started
2026-09-25 08:20:19,980 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 08:20:19,987 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 08:20:19,988 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 08:20:19,989 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 08:20:19,990 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 08:20:19,999 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 08:20:19,999 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 08:20:20,003 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 08:20:20,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:20:20,004 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 08:25:26,437 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 08:25:26,437 WARNING core: Account 2: connect timed out after 35s
2026-09-25 08:25:26,437 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 08:25:26,437 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 08:25:33,346 INFO core: Event loop thread started, running loop forever
2026-09-25 08:25:33,649 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 08:25:33,654 INFO core: _init_accounts coroutine started
2026-09-25 08:25:33,654 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 08:25:33,658 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:30:19,590 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 08:30:19,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:35:24,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:40:36,273 INFO core: Event loop thread started, running loop forever
2026-09-25 08:40:36,574 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 08:40:36,580 INFO core: _init_accounts coroutine started
2026-09-25 08:40:36,582 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 08:40:36,608 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:45:35,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:50:07,692 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 08:50:07,692 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 08:50:07,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 08:55:24,263 INFO core: Event loop thread started, running loop forever
2026-09-25 08:55:24,565 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 08:55:24,568 INFO core: _init_accounts coroutine started
2026-09-25 08:55:24,569 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 08:55:24,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:00:26,226 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 09:00:26,226 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:00:26,227 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 09:05:11,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:10:07,166 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 09:10:07,173 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:15:14,349 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 09:15:14,350 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 09:15:14,350 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 09:15:14,350 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 09:15:20,047 INFO core: Event loop thread started, running loop forever
2026-09-25 09:15:20,348 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 09:15:20,352 INFO core: _init_accounts coroutine started
2026-09-25 09:15:20,354 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 09:15:20,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:20:16,252 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:25:14,756 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 09:25:14,756 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 09:25:14,757 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 09:25:14,759 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 09:25:14,780 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 09:25:14,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:25:14,781 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 09:30:20,438 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 09:30:20,441 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 09:30:46,848 INFO core: Event loop thread started, running loop forever
2026-09-25 09:30:47,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 09:30:47,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:35:04,687 INFO core: _init_accounts coroutine started
2026-09-25 09:35:04,688 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 09:35:04,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:40:31,224 INFO core: Event loop thread started, running loop forever
2026-09-25 09:40:31,525 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 09:40:31,528 INFO core: _init_accounts coroutine started
2026-09-25 09:40:31,530 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 09:40:31,535 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:45:18,796 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:50:24,384 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 09:50:24,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 09:50:24,385 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-25 09:50:24,385 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 09:50:24,386 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 09:50:24,386 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 09:50:24,386 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 09:50:24,386 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 09:50:24,386 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 09:50:51,550 INFO core: Event loop thread started, running loop forever
2026-09-25 09:50:51,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 09:50:51,857 INFO core: _init_accounts coroutine started
2026-09-25 09:50:51,857 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 09:50:51,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 09:55:03,738 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 09:55:03,738 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 09:55:03,741 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:00:09,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 10:00:09,408 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 10:00:09,408 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 10:00:09,409 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 10:00:14,249 INFO core: Event loop thread started, running loop forever
2026-09-25 10:00:14,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 10:00:14,554 INFO core: _init_accounts coroutine started
2026-09-25 10:00:14,556 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 10:00:14,562 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:05:22,944 INFO core: Event loop thread started, running loop forever
2026-09-25 10:05:23,245 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 10:05:23,249 INFO core: _init_accounts coroutine started
2026-09-25 10:05:23,251 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 10:05:23,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:10:49,829 INFO core: Event loop thread started, running loop forever
2026-09-25 10:10:50,130 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 10:10:50,133 INFO core: _init_accounts coroutine started
2026-09-25 10:10:50,134 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 10:10:50,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:15:08,172 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 10:15:08,172 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 10:15:08,174 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 10:15:08,175 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 10:15:08,184 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 10:15:08,184 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 10:15:08,187 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 10:15:08,188 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 10:15:08,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:20:15,389 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 10:20:15,389 WARNING core: Account 2: connect timed out after 35s
2026-09-25 10:20:15,390 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 10:20:41,842 INFO core: Event loop thread started, running loop forever
2026-09-25 10:20:42,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 10:20:42,146 INFO core: _init_accounts coroutine started
2026-09-25 10:20:42,148 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 10:20:42,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:25:23,988 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:30:14,663 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 10:30:14,663 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 10:30:14,673 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 10:30:14,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:35:48,723 INFO core: Event loop thread started, running loop forever
2026-09-25 10:35:49,024 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 10:35:49,028 INFO core: _init_accounts coroutine started
2026-09-25 10:35:49,030 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 10:35:49,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:40:16,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:45:28,001 INFO core: Event loop thread started, running loop forever
2026-09-25 10:45:28,302 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 10:45:28,307 INFO core: _init_accounts coroutine started
2026-09-25 10:45:28,308 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 10:45:28,311 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:50:29,187 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:55:20,690 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 10:55:20,691 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 10:55:20,692 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 10:55:20,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 10:55:20,695 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 11:00:46,295 INFO core: Event loop thread started, running loop forever
2026-09-25 11:00:46,596 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 11:00:46,599 INFO core: _init_accounts coroutine started
2026-09-25 11:00:46,602 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 11:00:46,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:05:33,949 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 11:05:33,949 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 11:05:33,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:05:33,952 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 11:10:12,849 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 11:10:12,852 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:15:19,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 11:15:19,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 11:15:19,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 11:15:23,438 INFO core: Event loop thread started, running loop forever
2026-09-25 11:15:23,739 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 11:15:23,746 INFO core: _init_accounts coroutine started
2026-09-25 11:15:23,748 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 11:15:23,749 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:20:15,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:25:22,436 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 11:25:50,839 INFO core: Event loop thread started, running loop forever
2026-09-25 11:25:51,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 11:25:51,144 INFO core: _init_accounts coroutine started
2026-09-25 11:25:51,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 11:25:51,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:30:07,411 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 11:30:24,634 INFO core: Event loop thread started, running loop forever
2026-09-25 11:30:24,935 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 11:30:24,939 INFO core: _init_accounts coroutine started
2026-09-25 11:30:24,939 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 11:30:24,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:35:30,449 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 11:35:30,449 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 11:35:45,207 INFO core: Event loop thread started, running loop forever
2026-09-25 11:35:45,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 11:35:45,511 INFO core: _init_accounts coroutine started
2026-09-25 11:35:45,512 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 11:35:45,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:40:24,989 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 11:40:24,998 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:45:06,761 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:50:53,770 INFO core: Event loop thread started, running loop forever
2026-09-25 11:50:54,072 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 11:50:54,082 INFO core: _init_accounts coroutine started
2026-09-25 11:50:54,083 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 11:50:54,109 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 11:55:33,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:00:35,792 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 12:00:35,792 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 12:00:35,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:05:41,437 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 12:05:50,414 INFO core: Event loop thread started, running loop forever
2026-09-25 12:05:50,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 12:05:50,718 INFO core: _init_accounts coroutine started
2026-09-25 12:05:50,721 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 12:05:50,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:10:14,723 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 12:10:14,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:15:27,365 INFO core: Event loop thread started, running loop forever
2026-09-25 12:15:27,666 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 12:15:27,672 INFO core: _init_accounts coroutine started
2026-09-25 12:15:27,672 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 12:15:27,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:20:16,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 12:20:16,468 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 12:20:16,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:25:17,994 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 12:25:18,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:30:16,738 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 12:30:16,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:35:09,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:40:16,526 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 12:40:18,296 INFO core: Event loop thread started, running loop forever
2026-09-25 12:40:18,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 12:40:18,618 INFO core: _init_accounts coroutine started
2026-09-25 12:40:18,621 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 12:40:18,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:45:46,040 INFO core: Event loop thread started, running loop forever
2026-09-25 12:45:46,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 12:45:46,346 INFO core: _init_accounts coroutine started
2026-09-25 12:45:46,347 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 12:45:46,353 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:50:10,365 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 12:50:10,366 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 12:50:10,368 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 12:55:17,451 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 12:55:17,452 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 12:55:41,655 INFO core: Event loop thread started, running loop forever
2026-09-25 12:55:41,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 12:55:41,959 INFO core: _init_accounts coroutine started
2026-09-25 12:55:41,961 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 12:55:41,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:00:42,181 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 13:00:42,202 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:05:25,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:10:36,538 INFO core: Event loop thread started, running loop forever
2026-09-25 13:10:36,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 13:10:36,859 INFO core: _init_accounts coroutine started
2026-09-25 13:10:36,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:10:36,862 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 13:15:43,289 INFO core: Event loop thread started, running loop forever
2026-09-25 13:15:43,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 13:15:43,595 INFO core: _init_accounts coroutine started
2026-09-25 13:15:43,596 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 13:15:43,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:20:13,912 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:25:12,180 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 13:25:12,181 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 13:25:12,189 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 13:25:12,190 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 13:25:12,210 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:30:32,977 INFO core: Event loop thread started, running loop forever
2026-09-25 13:30:33,278 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 13:30:33,281 INFO core: _init_accounts coroutine started
2026-09-25 13:30:33,281 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 13:30:33,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:35:31,476 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 13:35:31,477 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 13:35:31,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:35:31,484 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 13:40:36,396 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 13:40:36,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:45:44,288 INFO core: Event loop thread started, running loop forever
2026-09-25 13:45:44,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 13:45:44,594 INFO core: _init_accounts coroutine started
2026-09-25 13:45:44,595 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 13:45:44,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:50:09,519 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 13:55:05,803 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:00:11,389 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 14:00:45,743 INFO core: Event loop thread started, running loop forever
2026-09-25 14:00:46,044 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 14:00:46,049 INFO core: _init_accounts coroutine started
2026-09-25 14:00:46,050 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 14:00:46,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:05:39,160 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 14:05:39,161 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 14:05:39,162 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:10:19,824 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 14:10:19,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:15:25,505 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 14:15:26,421 INFO core: Event loop thread started, running loop forever
2026-09-25 14:15:26,722 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 14:15:26,733 INFO core: _init_accounts coroutine started
2026-09-25 14:15:26,735 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 14:15:26,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:20:10,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:20:10,732 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 14:25:16,446 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 14:25:50,197 INFO core: Event loop thread started, running loop forever
2026-09-25 14:25:50,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 14:25:50,504 INFO core: _init_accounts coroutine started
2026-09-25 14:25:50,505 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 14:25:50,512 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:30:30,390 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:35:36,773 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 14:35:37,427 INFO core: Event loop thread started, running loop forever
2026-09-25 14:35:37,729 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 14:35:37,733 INFO core: _init_accounts coroutine started
2026-09-25 14:35:37,735 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 14:35:37,750 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:40:05,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:45:11,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 14:45:11,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 14:45:11,409 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 14:45:11,410 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 14:45:11,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 14:45:11,410 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 14:45:11,410 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 14:45:11,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 14:45:40,658 INFO core: Event loop thread started, running loop forever
2026-09-25 14:45:40,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 14:45:40,963 INFO core: _init_accounts coroutine started
2026-09-25 14:45:40,963 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 14:45:40,980 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 14:45:40,980 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 14:45:40,981 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 14:45:40,982 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 14:45:40,984 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:50:18,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 14:55:25,533 INFO core: Event loop thread started, running loop forever
2026-09-25 14:55:25,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 14:55:25,838 INFO core: _init_accounts coroutine started
2026-09-25 14:55:25,840 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 14:55:25,847 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:00:27,693 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 15:00:27,693 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 15:00:27,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:05:10,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 15:05:10,496 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 15:05:10,508 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 15:05:10,508 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 15:05:10,526 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 15:05:10,527 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 15:05:10,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:10:17,431 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 15:10:17,432 WARNING core: Account 2: connect timed out after 35s
2026-09-25 15:10:17,432 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 15:10:17,433 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 15:10:17,434 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 15:10:17,434 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-25 15:10:17,435 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-25 15:10:41,559 INFO core: Event loop thread started, running loop forever
2026-09-25 15:10:41,860 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 15:10:41,866 INFO core: _init_accounts coroutine started
2026-09-25 15:10:41,866 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 15:10:41,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:15:05,340 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 15:15:09,979 INFO core: Event loop thread started, running loop forever
2026-09-25 15:15:10,282 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 15:15:10,287 INFO core: _init_accounts coroutine started
2026-09-25 15:15:10,289 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 15:15:10,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:20:17,384 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 15:20:17,385 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 15:20:26,303 INFO core: Event loop thread started, running loop forever
2026-09-25 15:20:26,604 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 15:20:26,617 INFO core: _init_accounts coroutine started
2026-09-25 15:20:26,618 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 15:20:26,621 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:25:15,481 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 15:25:15,492 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:30:53,881 INFO core: Event loop thread started, running loop forever
2026-09-25 15:30:54,182 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 15:30:54,193 INFO core: _init_accounts coroutine started
2026-09-25 15:30:54,193 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 15:30:54,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:35:22,047 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 15:35:22,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:40:27,649 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:45:49,467 INFO core: Event loop thread started, running loop forever
2026-09-25 15:45:49,768 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 15:45:49,776 INFO core: _init_accounts coroutine started
2026-09-25 15:45:49,776 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 15:45:49,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:50:29,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 15:55:35,323 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 15:55:35,323 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 15:55:35,326 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:00:42,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 16:00:49,054 INFO core: Event loop thread started, running loop forever
2026-09-25 16:00:49,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 16:00:49,361 INFO core: _init_accounts coroutine started
2026-09-25 16:00:49,362 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 16:00:49,380 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 16:00:49,381 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 16:00:49,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 16:00:49,385 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:00:49,386 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 16:05:36,847 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:10:09,501 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 16:10:09,502 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 16:10:09,505 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 16:10:09,506 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 16:10:09,511 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:15:16,433 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 16:15:16,434 WARNING core: Account 2: connect timed out after 35s
2026-09-25 16:15:16,434 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 16:15:16,435 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 16:15:16,435 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 16:15:16,437 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-25 16:15:16,437 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-25 16:15:41,573 INFO core: Event loop thread started, running loop forever
2026-09-25 16:15:41,874 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 16:15:41,878 INFO core: _init_accounts coroutine started
2026-09-25 16:15:41,880 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 16:15:41,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:20:42,858 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 16:20:42,858 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 16:20:42,861 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 16:20:42,863 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:25:48,477 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 16:25:48,478 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 16:25:51,946 INFO core: Event loop thread started, running loop forever
2026-09-25 16:25:52,247 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 16:25:52,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:25:52,257 INFO core: _init_accounts coroutine started
2026-09-25 16:30:42,325 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 16:30:42,335 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 16:30:42,335 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 16:30:42,337 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 16:30:42,339 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:35:22,396 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 16:35:22,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:40:26,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:45:33,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 16:45:33,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 16:45:33,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 16:45:44,587 INFO core: Event loop thread started, running loop forever
2026-09-25 16:45:44,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 16:45:44,895 INFO core: _init_accounts coroutine started
2026-09-25 16:45:44,895 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 16:45:44,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:50:41,674 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 16:50:41,674 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 16:50:41,675 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 16:50:41,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 16:50:41,677 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 16:55:47,447 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 16:55:47,448 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 16:55:47,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 16:55:53,520 INFO core: Event loop thread started, running loop forever
2026-09-25 16:55:53,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 16:55:53,824 INFO core: _init_accounts coroutine started
2026-09-25 16:55:53,824 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 16:55:53,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:00:44,736 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 17:00:44,737 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 17:00:44,741 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:05:20,328 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 17:05:20,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:10:16,818 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 17:10:16,866 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 17:10:16,867 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 17:10:16,872 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 17:10:16,873 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 17:10:16,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:15:09,571 INFO core: Event loop thread started, running loop forever
2026-09-25 17:15:09,873 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 17:15:09,875 INFO core: _init_accounts coroutine started
2026-09-25 17:15:09,876 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 17:15:09,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:15:23,578 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 17:15:23,579 WARNING core: Account 2: connect timed out after 35s
2026-09-25 17:20:16,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 17:20:35,022 INFO core: Event loop thread started, running loop forever
2026-09-25 17:20:35,323 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 17:20:35,326 INFO core: _init_accounts coroutine started
2026-09-25 17:20:35,329 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 17:20:35,336 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:25:06,594 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 17:25:06,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:25:06,595 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 17:30:04,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 17:30:04,403 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 17:30:04,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 17:30:04,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 17:30:04,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 17:30:43,214 INFO core: Event loop thread started, running loop forever
2026-09-25 17:30:43,515 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 17:30:43,523 INFO core: _init_accounts coroutine started
2026-09-25 17:30:43,524 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 17:30:43,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:35:52,485 INFO core: Event loop thread started, running loop forever
2026-09-25 17:35:52,786 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 17:35:52,795 INFO core: _init_accounts coroutine started
2026-09-25 17:35:52,796 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 17:35:52,798 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:40:47,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:45:43,241 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 17:45:43,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:50:17,196 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 17:55:23,936 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-25 17:55:23,938 INFO core: _init_accounts coroutine started
2026-09-25 17:55:23,938 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 17:55:23,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:00:22,829 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 18:00:22,829 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 18:00:22,834 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 18:00:22,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:05:29,406 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 18:05:29,407 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 18:05:29,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 18:05:29,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 18:05:33,796 INFO core: Event loop thread started, running loop forever
2026-09-25 18:05:34,106 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 18:05:34,118 INFO core: _init_accounts coroutine started
2026-09-25 18:05:34,118 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 18:05:34,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:10:28,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:15:14,352 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 18:15:14,354 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 18:15:14,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:20:35,704 INFO core: Event loop thread started, running loop forever
2026-09-25 18:20:36,006 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 18:20:36,011 INFO core: _init_accounts coroutine started
2026-09-25 18:20:36,011 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 18:20:36,016 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:25:12,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 18:25:12,383 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 18:25:12,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 18:25:12,392 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 18:25:12,394 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:30:16,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:35:10,181 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 18:35:10,182 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 18:35:10,187 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 18:35:10,188 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 18:35:10,193 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:40:17,429 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 18:40:17,429 WARNING core: Account 2: connect timed out after 35s
2026-09-25 18:40:17,429 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 18:40:17,430 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 18:40:17,430 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 18:40:17,431 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-25 18:40:17,431 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-25 18:40:42,966 INFO core: Event loop thread started, running loop forever
2026-09-25 18:40:43,268 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 18:40:43,278 INFO core: _init_accounts coroutine started
2026-09-25 18:40:43,279 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 18:40:43,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:45:22,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:45:22,627 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 18:45:22,627 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 18:50:28,426 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 18:50:50,841 INFO core: Event loop thread started, running loop forever
2026-09-25 18:50:51,142 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 18:50:51,148 INFO core: _init_accounts coroutine started
2026-09-25 18:50:51,149 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 18:50:51,157 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 18:55:43,579 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:00:33,568 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 19:00:33,569 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 19:00:33,572 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 19:00:33,573 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 19:00:33,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:05:22,412 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:10:10,829 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 19:10:10,830 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 19:10:10,834 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 19:10:10,835 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 19:10:10,836 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:15:16,441 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 19:15:16,442 WARNING core: Account 2: connect timed out after 35s
2026-09-25 19:15:16,442 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-25 19:15:16,443 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-25 19:15:16,444 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-25 19:15:16,445 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-25 19:15:16,445 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-25 19:15:34,900 INFO core: Event loop thread started, running loop forever
2026-09-25 19:15:35,202 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 19:15:35,205 INFO core: _init_accounts coroutine started
2026-09-25 19:15:35,207 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 19:15:35,216 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:20:28,170 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 19:20:28,170 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 19:20:28,177 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 19:20:28,179 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 19:20:28,191 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:25:35,394 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 19:25:53,547 INFO core: Event loop thread started, running loop forever
2026-09-25 19:25:53,850 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 19:25:53,853 INFO core: _init_accounts coroutine started
2026-09-25 19:25:53,853 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 19:25:53,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:25:53,871 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 19:25:53,871 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 19:30:42,621 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 19:30:42,634 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 19:30:42,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:35:21,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:40:10,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:45:19,972 INFO core: Event loop thread started, running loop forever
2026-09-25 19:45:20,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 19:45:20,277 INFO core: _init_accounts coroutine started
2026-09-25 19:45:20,280 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 19:45:20,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:50:07,327 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 19:50:07,327 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 19:50:07,329 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 19:50:07,337 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 19:55:18,944 INFO core: Event loop thread started, running loop forever
2026-09-25 19:55:19,245 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 19:55:19,249 INFO core: _init_accounts coroutine started
2026-09-25 19:55:19,249 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 19:55:19,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:00:25,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 20:00:37,688 INFO core: Event loop thread started, running loop forever
2026-09-25 20:00:37,989 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 20:00:37,993 INFO core: _init_accounts coroutine started
2026-09-25 20:00:37,995 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 20:00:38,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:05:43,771 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 20:05:43,771 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 20:05:43,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:05:43,773 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 20:10:19,095 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 20:10:19,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:15:26,468 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 20:15:26,471 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 20:15:40,187 INFO core: Event loop thread started, running loop forever
2026-09-25 20:15:40,488 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 20:15:40,493 INFO core: _init_accounts coroutine started
2026-09-25 20:15:40,495 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 20:15:40,500 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:20:18,589 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 20:20:18,590 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 20:20:18,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:25:14,134 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 20:25:14,136 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 20:25:14,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:30:21,483 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 20:30:21,483 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 20:30:21,483 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 20:30:49,629 INFO core: Event loop thread started, running loop forever
2026-09-25 20:30:49,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 20:30:49,933 INFO core: _init_accounts coroutine started
2026-09-25 20:30:49,935 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 20:30:49,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:35:13,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:40:19,460 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 20:40:28,045 INFO core: Event loop thread started, running loop forever
2026-09-25 20:40:28,346 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 20:40:28,355 INFO core: _init_accounts coroutine started
2026-09-25 20:40:28,355 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 20:40:28,364 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:45:35,439 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 20:45:50,045 INFO core: Event loop thread started, running loop forever
2026-09-25 20:45:50,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 20:45:50,349 INFO core: _init_accounts coroutine started
2026-09-25 20:45:50,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 20:45:50,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:50:44,520 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 20:50:44,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 20:55:51,540 INFO core: Event loop thread started, running loop forever
2026-09-25 20:55:51,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 20:55:51,846 INFO core: _init_accounts coroutine started
2026-09-25 20:55:51,847 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 20:55:51,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:00:30,914 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:05:29,783 INFO core: Event loop thread started, running loop forever
2026-09-25 21:05:30,084 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 21:05:30,088 INFO core: _init_accounts coroutine started
2026-09-25 21:05:30,089 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 21:05:30,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:10:09,142 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 21:10:09,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:15:38,422 INFO core: Event loop thread started, running loop forever
2026-09-25 21:15:38,724 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 21:15:38,729 INFO core: _init_accounts coroutine started
2026-09-25 21:15:38,729 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 21:15:38,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:20:41,846 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:25:06,382 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 21:25:06,384 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:25:06,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 21:30:46,839 INFO core: Event loop thread started, running loop forever
2026-09-25 21:30:47,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 21:30:47,145 INFO core: _init_accounts coroutine started
2026-09-25 21:30:47,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 21:30:47,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:35:11,396 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 21:35:11,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:40:39,249 INFO core: Event loop thread started, running loop forever
2026-09-25 21:40:39,550 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 21:40:39,554 INFO core: _init_accounts coroutine started
2026-09-25 21:40:39,556 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 21:40:39,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:45:20,571 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:45:20,572 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 21:45:20,572 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 21:45:20,574 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 21:50:37,778 INFO core: Event loop thread started, running loop forever
2026-09-25 21:50:38,086 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 21:50:38,089 INFO core: _init_accounts coroutine started
2026-09-25 21:50:38,091 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 21:50:38,097 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:55:13,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 21:55:13,975 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 21:55:13,979 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 21:55:13,983 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 22:00:27,715 INFO core: Event loop thread started, running loop forever
2026-09-25 22:00:28,016 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 22:00:28,021 INFO core: _init_accounts coroutine started
2026-09-25 22:00:28,021 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 22:00:28,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:05:43,145 INFO core: Event loop thread started, running loop forever
2026-09-25 22:05:43,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 22:05:43,451 INFO core: _init_accounts coroutine started
2026-09-25 22:05:43,451 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 22:05:43,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:10:11,229 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:15:07,886 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 22:15:07,886 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 22:15:07,887 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 22:15:07,888 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 22:15:07,904 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 22:15:07,904 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 22:15:07,908 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 22:15:07,908 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 22:15:07,916 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:20:13,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-25 22:20:31,190 INFO core: Event loop thread started, running loop forever
2026-09-25 22:20:31,490 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 22:20:31,494 INFO core: _init_accounts coroutine started
2026-09-25 22:20:31,496 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 22:20:31,505 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:25:10,770 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 22:25:10,772 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 22:25:10,777 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 22:25:10,777 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:30:16,422 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 22:30:16,423 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 22:30:16,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 22:30:16,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 22:30:46,396 INFO core: Event loop thread started, running loop forever
2026-09-25 22:30:46,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 22:30:46,711 INFO core: _init_accounts coroutine started
2026-09-25 22:30:46,713 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 22:30:46,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:35:51,479 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 22:35:51,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:40:39,481 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:45:25,426 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-25 22:45:25,427 INFO core: _init_accounts coroutine started
2026-09-25 22:45:25,427 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 22:45:25,430 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:50:47,752 INFO core: Event loop thread started, running loop forever
2026-09-25 22:50:48,053 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 22:50:48,057 INFO core: _init_accounts coroutine started
2026-09-25 22:50:48,059 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 22:50:48,068 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 22:55:16,098 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 22:55:16,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:00:37,111 INFO core: Event loop thread started, running loop forever
2026-09-25 23:00:37,415 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 23:00:37,418 INFO core: _init_accounts coroutine started
2026-09-25 23:00:37,420 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 23:00:37,425 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:05:40,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:10:08,024 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 23:10:08,025 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 23:10:08,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:15:15,466 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 23:15:15,466 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-25 23:15:15,467 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 23:15:15,467 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-25 23:15:15,467 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 23:15:15,467 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 23:15:21,526 INFO core: Event loop thread started, running loop forever
2026-09-25 23:15:21,828 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 23:15:21,831 INFO core: _init_accounts coroutine started
2026-09-25 23:15:21,833 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 23:15:21,838 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:20:28,406 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-25 23:20:40,604 INFO core: Event loop thread started, running loop forever
2026-09-25 23:20:40,905 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 23:20:40,909 INFO core: _init_accounts coroutine started
2026-09-25 23:20:40,910 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 23:20:40,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:25:06,596 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 23:25:06,597 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 23:25:06,599 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 23:25:06,608 INFO core: _init_accounts_inner: reloading LLM config
2026-09-25 23:25:06,629 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-25 23:25:06,629 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-25 23:25:06,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:30:13,431 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-25 23:30:13,434 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-25 23:30:47,211 INFO core: Event loop thread started, running loop forever
2026-09-25 23:30:47,513 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 23:30:47,516 INFO core: _init_accounts coroutine started
2026-09-25 23:30:47,518 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 23:30:47,532 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:35:33,345 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-25 23:35:33,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:40:16,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:45:37,171 INFO core: Event loop thread started, running loop forever
2026-09-25 23:45:37,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 23:45:37,487 INFO core: _init_accounts coroutine started
2026-09-25 23:45:37,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 23:45:37,489 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:50:43,932 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 23:50:43,934 INFO core: Event loop thread started, running loop forever
2026-09-25 23:50:44,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-25 23:50:44,239 INFO core: _init_accounts coroutine started
2026-09-25 23:50:44,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-25 23:50:44,255 INFO core: status() clients=0 connected=False forwarding=False
2026-09-25 23:55:40,225 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-25 23:55:40,225 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-25 23:55:40,229 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-25 23:55:40,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:00:10,116 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 00:00:10,136 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 00:00:10,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:00:10,137 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 00:05:16,532 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 00:05:45,451 INFO core: Event loop thread started, running loop forever
2026-09-26 00:05:45,755 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 00:05:45,765 INFO core: _init_accounts coroutine started
2026-09-26 00:05:45,765 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:05:45,766 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 00:10:44,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:15:51,953 INFO core: Event loop thread started, running loop forever
2026-09-26 00:15:52,254 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 00:15:52,258 INFO core: _init_accounts coroutine started
2026-09-26 00:15:52,261 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 00:15:52,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:20:27,637 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 00:20:27,637 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 00:20:27,639 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:25:28,207 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 00:25:28,213 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:30:29,476 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 00:30:29,496 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 00:30:29,496 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 00:30:29,502 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 00:30:29,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:30:29,504 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 00:35:20,529 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 00:35:20,530 WARNING core: Account 2: connect timed out after 35s
2026-09-26 00:35:20,530 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 00:35:20,531 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 00:35:20,531 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 00:35:20,532 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 00:35:20,532 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 00:35:20,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:40:24,156 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 00:40:24,156 WARNING core: Account 2: connect timed out after 35s
2026-09-26 00:40:24,157 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-26 00:40:24,157 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-26 00:40:24,158 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 00:40:24,160 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-26 00:40:24,160 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-26 00:40:24,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:45:30,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 00:45:30,416 WARNING core: Account 2: connect timed out after 35s
2026-09-26 00:45:48,590 INFO core: Event loop thread started, running loop forever
2026-09-26 00:45:48,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 00:45:48,896 INFO core: _init_accounts coroutine started
2026-09-26 00:45:48,897 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 00:45:48,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:50:51,860 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:55:28,238 INFO core: Event loop thread started, running loop forever
2026-09-26 00:55:28,539 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 00:55:28,543 INFO core: _init_accounts coroutine started
2026-09-26 00:55:28,545 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 00:55:28,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 00:55:58,277 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 01:00:11,238 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 01:00:11,239 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 01:00:11,240 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:05:11,323 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 01:05:11,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:10:18,499 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 01:10:18,529 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 01:10:18,529 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 01:10:18,529 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 01:10:28,672 INFO core: Event loop thread started, running loop forever
2026-09-26 01:10:28,974 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 01:10:28,980 INFO core: _init_accounts coroutine started
2026-09-26 01:10:28,981 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 01:10:28,993 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:15:34,467 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 01:15:47,437 INFO core: Event loop thread started, running loop forever
2026-09-26 01:15:47,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 01:15:47,744 INFO core: _init_accounts coroutine started
2026-09-26 01:15:47,745 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 01:15:47,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:20:24,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:20:24,233 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 01:20:24,233 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 01:25:30,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 01:25:30,411 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 01:25:30,412 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 01:25:30,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 01:25:30,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 01:25:30,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 01:25:31,676 INFO core: Event loop thread started, running loop forever
2026-09-26 01:25:31,977 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 01:25:31,981 INFO core: _init_accounts coroutine started
2026-09-26 01:25:31,983 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 01:25:31,992 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 01:25:31,992 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 01:25:31,993 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 01:25:31,994 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 01:25:32,003 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 01:25:32,003 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 01:25:32,008 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 01:25:32,009 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 01:25:32,008 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:30:38,422 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 01:30:38,424 WARNING core: Account 2: connect timed out after 35s
2026-09-26 01:30:47,727 INFO core: Event loop thread started, running loop forever
2026-09-26 01:30:48,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 01:30:48,035 INFO core: _init_accounts coroutine started
2026-09-26 01:30:48,036 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 01:30:48,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:35:34,671 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:35:34,671 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 01:35:34,671 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 01:40:23,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 01:40:23,389 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 01:40:23,395 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:45:28,134 INFO core: Event loop thread started, running loop forever
2026-09-26 01:45:28,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 01:45:28,439 INFO core: _init_accounts coroutine started
2026-09-26 01:45:28,441 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 01:45:28,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:45:30,161 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 01:45:30,162 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 01:45:30,162 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 01:50:35,191 INFO core: Event loop thread started, running loop forever
2026-09-26 01:50:35,493 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 01:50:35,498 INFO core: _init_accounts coroutine started
2026-09-26 01:50:35,499 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 01:50:35,503 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 01:55:05,856 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:00:40,426 INFO core: Event loop thread started, running loop forever
2026-09-26 02:00:40,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 02:00:40,731 INFO core: _init_accounts coroutine started
2026-09-26 02:00:40,732 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 02:00:40,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:05:41,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:10:14,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:15:15,086 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 02:15:15,086 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 02:15:15,088 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 02:15:15,091 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 02:15:15,092 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:20:45,250 INFO core: Event loop thread started, running loop forever
2026-09-26 02:20:45,551 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 02:20:45,555 INFO core: _init_accounts coroutine started
2026-09-26 02:20:45,558 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 02:20:45,572 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 02:20:45,572 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 02:20:45,575 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 02:20:45,578 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:25:52,433 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 02:25:53,227 INFO core: Event loop thread started, running loop forever
2026-09-26 02:25:53,528 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 02:25:53,534 INFO core: _init_accounts coroutine started
2026-09-26 02:25:53,534 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 02:25:53,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:30:16,864 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 02:30:16,864 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 02:30:16,886 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 02:30:16,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:30:16,896 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 02:35:09,160 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:40:16,482 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 02:40:16,483 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 02:40:16,483 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 02:40:22,690 INFO core: Event loop thread started, running loop forever
2026-09-26 02:40:22,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 02:40:22,997 INFO core: _init_accounts coroutine started
2026-09-26 02:40:22,997 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 02:40:23,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:45:29,469 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 02:45:29,469 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 02:45:49,924 INFO core: Event loop thread started, running loop forever
2026-09-26 02:45:50,225 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 02:45:50,228 INFO core: _init_accounts coroutine started
2026-09-26 02:45:50,230 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 02:45:50,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:50:13,878 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 02:50:13,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 02:50:13,885 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 02:50:13,888 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 02:50:13,907 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 02:50:13,907 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 02:50:13,912 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 02:50:13,912 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 02:50:13,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 02:55:50,361 INFO core: Event loop thread started, running loop forever
2026-09-26 02:55:50,663 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 02:55:50,668 INFO core: _init_accounts coroutine started
2026-09-26 02:55:50,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 02:55:50,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:00:27,184 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 03:00:27,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:05:27,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:10:47,989 INFO core: Event loop thread started, running loop forever
2026-09-26 03:10:48,290 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 03:10:48,296 INFO core: _init_accounts coroutine started
2026-09-26 03:10:48,296 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 03:10:48,301 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:15:43,852 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 03:15:43,853 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 03:15:43,855 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 03:15:43,857 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 03:15:43,872 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:15:43,873 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 03:15:43,874 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 03:15:43,879 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 03:15:43,880 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 03:20:40,663 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 03:20:40,665 WARNING core: Account 2: connect timed out after 35s
2026-09-26 03:20:40,665 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 03:20:40,665 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 03:20:40,666 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 03:20:40,667 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 03:20:40,667 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 03:20:40,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:25:23,171 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 03:25:23,173 WARNING core: Account 2: connect timed out after 35s
2026-09-26 03:25:23,174 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-26 03:25:23,174 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-26 03:25:23,174 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 03:25:23,176 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-26 03:25:23,176 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-26 03:25:23,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:30:30,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 03:30:30,418 WARNING core: Account 2: connect timed out after 35s
2026-09-26 03:30:44,838 INFO core: Event loop thread started, running loop forever
2026-09-26 03:30:45,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 03:30:45,145 INFO core: _init_accounts coroutine started
2026-09-26 03:30:45,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 03:30:45,166 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:35:47,783 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:40:25,216 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 03:40:25,216 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 03:40:25,219 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 03:40:25,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:45:16,350 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 03:45:16,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:50:18,442 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 03:50:18,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 03:50:18,443 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 03:55:04,129 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 837, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 03:55:04,171 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:00:19,387 INFO core: Event loop thread started, running loop forever
2026-09-26 04:00:19,697 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 04:00:19,708 INFO core: _init_accounts coroutine started
2026-09-26 04:00:19,708 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 04:00:19,714 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:05:12,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:10:41,186 INFO core: Event loop thread started, running loop forever
2026-09-26 04:10:41,487 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 04:10:41,493 INFO core: _init_accounts coroutine started
2026-09-26 04:10:41,493 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 04:10:41,506 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 04:10:41,506 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 04:10:41,508 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 04:10:41,510 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 04:10:41,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:15:04,331 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 04:15:24,044 INFO core: Event loop thread started, running loop forever
2026-09-26 04:15:24,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 04:15:24,348 INFO core: _init_accounts coroutine started
2026-09-26 04:15:24,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 04:15:24,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:20:21,813 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:25:27,415 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 04:25:46,428 INFO core: Event loop thread started, running loop forever
2026-09-26 04:25:46,729 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 04:25:46,733 INFO core: _init_accounts coroutine started
2026-09-26 04:25:46,734 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 04:25:46,743 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:30:54,088 INFO core: Event loop thread started, running loop forever
2026-09-26 04:30:54,389 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 04:30:54,394 INFO core: _init_accounts coroutine started
2026-09-26 04:30:54,394 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 04:30:54,401 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:35:21,278 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 04:35:21,279 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 04:35:21,285 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:40:12,326 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 04:40:12,331 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:45:27,545 INFO core: Event loop thread started, running loop forever
2026-09-26 04:45:27,847 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 04:45:27,852 INFO core: _init_accounts coroutine started
2026-09-26 04:45:27,853 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 04:45:27,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:50:16,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 04:55:12,993 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 04:55:12,993 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 04:55:12,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:00:08,971 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 05:00:08,975 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 05:00:08,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:05:15,482 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 05:05:15,483 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 05:05:15,483 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 05:05:27,810 INFO core: Event loop thread started, running loop forever
2026-09-26 05:05:28,111 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 05:05:28,120 INFO core: _init_accounts coroutine started
2026-09-26 05:05:28,121 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 05:05:28,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:10:24,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:15:16,814 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 05:15:16,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:20:30,486 INFO core: Event loop thread started, running loop forever
2026-09-26 05:20:30,788 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 05:20:30,794 INFO core: _init_accounts coroutine started
2026-09-26 05:20:30,794 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 05:20:30,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:25:05,530 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 05:25:05,550 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:30:36,471 INFO core: Event loop thread started, running loop forever
2026-09-26 05:30:36,772 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 05:30:36,776 INFO core: _init_accounts coroutine started
2026-09-26 05:30:36,779 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 05:30:36,784 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:35:43,437 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 05:35:45,082 INFO core: Event loop thread started, running loop forever
2026-09-26 05:35:45,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 05:35:45,388 INFO core: _init_accounts coroutine started
2026-09-26 05:35:45,389 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 05:35:45,400 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:40:19,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:45:12,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:50:20,379 INFO core: Event loop thread started, running loop forever
2026-09-26 05:50:20,680 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 05:50:20,684 INFO core: _init_accounts coroutine started
2026-09-26 05:50:20,686 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 05:50:20,692 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 05:55:27,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 05:55:35,269 INFO core: Event loop thread started, running loop forever
2026-09-26 05:55:35,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 05:55:35,573 INFO core: _init_accounts coroutine started
2026-09-26 05:55:35,576 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 05:55:35,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:00:23,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:05:23,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:10:28,235 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 06:10:28,235 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 06:10:28,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:15:31,352 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 06:15:31,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:20:37,423 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 06:20:37,423 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 06:20:37,424 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 06:20:37,424 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 06:20:37,639 INFO core: Event loop thread started, running loop forever
2026-09-26 06:20:37,940 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 06:20:37,945 INFO core: _init_accounts coroutine started
2026-09-26 06:20:37,945 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 06:20:37,960 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 06:20:37,960 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 06:20:37,962 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 06:20:37,963 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:25:33,117 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 06:25:33,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:30:16,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:35:14,557 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:40:15,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:45:43,589 INFO core: Event loop thread started, running loop forever
2026-09-26 06:45:43,890 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 06:45:43,897 INFO core: _init_accounts coroutine started
2026-09-26 06:45:43,899 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 06:45:43,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:50:30,378 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 06:50:30,378 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 06:50:30,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 06:50:30,382 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 06:50:30,390 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 06:50:30,391 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 06:50:30,395 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 06:50:30,396 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 06:50:30,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 06:55:12,050 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 06:55:12,052 WARNING core: Account 2: connect timed out after 35s
2026-09-26 06:55:12,053 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 06:55:12,053 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 06:55:12,054 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 06:55:12,055 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 06:55:12,055 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 06:55:12,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:00:07,754 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 07:00:07,757 WARNING core: Account 2: connect timed out after 35s
2026-09-26 07:00:07,758 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-26 07:00:07,758 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-26 07:00:07,759 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 07:00:07,760 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-26 07:00:07,760 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-26 07:00:07,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:05:14,384 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 07:05:14,385 WARNING core: Account 2: connect timed out after 35s
2026-09-26 07:05:49,062 INFO core: Event loop thread started, running loop forever
2026-09-26 07:05:49,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 07:05:49,370 INFO core: _init_accounts coroutine started
2026-09-26 07:05:49,371 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 07:05:49,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:10:39,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:15:46,444 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 07:15:46,444 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 07:15:46,445 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-26 07:15:46,445 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 07:15:46,455 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 07:15:53,231 INFO core: Event loop thread started, running loop forever
2026-09-26 07:15:53,532 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 07:15:53,535 INFO core: _init_accounts coroutine started
2026-09-26 07:15:53,537 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 07:15:53,544 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:20:50,312 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 07:20:50,314 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 07:20:50,317 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 07:20:50,319 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 07:20:50,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:25:40,390 INFO core: Event loop thread started, running loop forever
2026-09-26 07:25:40,691 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 07:25:40,694 INFO core: _init_accounts coroutine started
2026-09-26 07:25:40,696 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 07:25:40,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:25:57,423 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 07:30:40,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:30:40,387 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 07:30:40,388 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 07:35:38,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:40:25,085 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 07:40:25,097 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 07:40:25,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:45:31,777 INFO core: Event loop thread started, running loop forever
2026-09-26 07:45:32,078 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 07:45:32,081 INFO core: _init_accounts coroutine started
2026-09-26 07:45:32,084 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 07:45:32,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:50:13,874 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 07:50:13,874 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 07:50:13,875 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 07:50:13,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 07:55:19,474 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 07:55:19,475 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-26 07:55:19,476 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 07:55:19,476 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 07:55:47,713 INFO core: Event loop thread started, running loop forever
2026-09-26 07:55:48,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 07:55:48,017 INFO core: _init_accounts coroutine started
2026-09-26 07:55:48,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 07:55:48,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:00:34,981 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:00:34,981 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 08:00:34,982 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 08:05:26,752 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 08:05:26,757 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 08:05:26,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:10:11,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:15:17,389 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 08:15:17,390 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 08:15:17,390 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 08:15:19,327 INFO core: Event loop thread started, running loop forever
2026-09-26 08:15:19,628 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 08:15:19,635 INFO core: _init_accounts coroutine started
2026-09-26 08:15:19,635 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 08:15:19,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:20:26,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 08:20:40,352 INFO core: Event loop thread started, running loop forever
2026-09-26 08:20:40,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 08:20:40,658 INFO core: _init_accounts coroutine started
2026-09-26 08:20:40,659 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 08:20:40,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:25:38,296 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:25:38,296 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 08:25:38,297 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 08:30:24,090 INFO core: Event loop thread started, running loop forever
2026-09-26 08:30:24,391 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 08:30:24,394 INFO core: _init_accounts coroutine started
2026-09-26 08:30:24,395 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 08:30:24,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:35:30,381 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 08:35:33,630 INFO core: Event loop thread started, running loop forever
2026-09-26 08:35:33,930 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 08:35:33,935 INFO core: _init_accounts coroutine started
2026-09-26 08:35:33,937 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 08:35:33,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:40:38,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:45:45,418 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 08:45:46,136 INFO core: Event loop thread started, running loop forever
2026-09-26 08:45:46,439 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 08:45:46,445 INFO core: _init_accounts coroutine started
2026-09-26 08:45:46,445 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 08:45:46,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:50:16,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:55:31,478 INFO core: Event loop thread started, running loop forever
2026-09-26 08:55:31,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 08:55:31,783 INFO core: _init_accounts coroutine started
2026-09-26 08:55:31,785 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 08:55:31,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 08:55:31,795 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 08:55:31,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 08:55:31,796 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 08:55:31,797 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 09:00:32,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:05:23,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:10:29,438 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 09:10:32,968 INFO core: Event loop thread started, running loop forever
2026-09-26 09:10:33,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 09:10:33,273 INFO core: _init_accounts coroutine started
2026-09-26 09:10:33,274 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 09:10:33,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:15:39,403 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 09:15:41,823 INFO core: Event loop thread started, running loop forever
2026-09-26 09:15:42,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 09:15:42,129 INFO core: _init_accounts coroutine started
2026-09-26 09:15:42,131 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 09:15:42,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:20:47,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:25:47,602 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 09:25:47,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:30:41,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:35:47,891 INFO core: Event loop thread started, running loop forever
2026-09-26 09:35:48,192 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 09:35:48,198 INFO core: _init_accounts coroutine started
2026-09-26 09:35:48,200 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 09:35:48,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:40:13,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:45:20,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 09:45:36,943 INFO core: Event loop thread started, running loop forever
2026-09-26 09:45:37,244 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 09:45:37,247 INFO core: _init_accounts coroutine started
2026-09-26 09:45:37,247 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 09:45:37,265 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:50:11,118 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 09:55:38,107 INFO core: Event loop thread started, running loop forever
2026-09-26 09:55:38,409 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 09:55:38,412 INFO core: _init_accounts coroutine started
2026-09-26 09:55:38,413 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 09:55:38,421 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:00:40,832 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 10:00:40,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:05:38,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:10:04,528 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-26 10:10:04,529 INFO core: _init_accounts coroutine started
2026-09-26 10:10:04,529 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 10:10:04,533 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:15:06,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:20:11,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:25:07,335 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 10:25:07,335 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 10:25:07,341 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 10:25:07,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:30:14,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 10:30:14,399 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 10:30:14,400 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 10:30:14,401 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 10:30:37,240 INFO core: Event loop thread started, running loop forever
2026-09-26 10:30:37,541 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 10:30:37,545 INFO core: _init_accounts coroutine started
2026-09-26 10:30:37,546 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 10:30:37,558 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 10:30:37,558 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 10:30:37,560 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:30:37,560 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 10:35:44,397 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 10:35:48,313 INFO core: Event loop thread started, running loop forever
2026-09-26 10:35:48,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 10:35:48,621 INFO core: _init_accounts coroutine started
2026-09-26 10:35:48,621 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 10:35:48,627 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:40:08,095 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:45:15,361 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 10:45:15,361 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 10:45:15,361 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-26 10:45:15,362 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 10:45:15,362 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 10:45:15,362 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 10:45:15,362 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 10:45:15,362 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 10:45:15,362 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 10:45:48,094 INFO core: Event loop thread started, running loop forever
2026-09-26 10:45:48,395 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 10:45:48,397 INFO core: _init_accounts coroutine started
2026-09-26 10:45:48,398 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 10:45:48,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:50:02,932 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 10:55:41,301 INFO core: Event loop thread started, running loop forever
2026-09-26 10:55:41,605 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 10:55:41,609 INFO core: _init_accounts coroutine started
2026-09-26 10:55:41,609 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 10:55:41,624 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:00:18,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 11:00:18,574 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 11:00:18,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:05:27,610 INFO core: Event loop thread started, running loop forever
2026-09-26 11:05:27,912 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 11:05:27,917 INFO core: _init_accounts coroutine started
2026-09-26 11:05:27,917 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 11:05:27,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:10:17,480 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:15:44,387 INFO core: Event loop thread started, running loop forever
2026-09-26 11:15:44,688 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 11:15:44,693 INFO core: _init_accounts coroutine started
2026-09-26 11:15:44,693 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 11:15:44,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:20:12,250 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 11:20:12,251 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 11:20:12,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:25:15,173 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 11:25:15,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:25:15,179 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 11:30:26,373 INFO core: Event loop thread started, running loop forever
2026-09-26 11:30:26,677 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 11:30:26,681 INFO core: _init_accounts coroutine started
2026-09-26 11:30:26,683 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 11:30:26,691 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:35:06,605 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 11:35:06,605 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 11:35:06,612 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 11:35:06,619 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 11:35:06,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:40:13,462 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 11:40:13,463 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 11:40:13,473 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 11:40:13,474 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 11:40:39,269 INFO core: Event loop thread started, running loop forever
2026-09-26 11:40:39,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 11:40:39,574 INFO core: _init_accounts coroutine started
2026-09-26 11:40:39,576 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 11:40:39,586 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:45:05,333 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 11:45:45,450 INFO core: Event loop thread started, running loop forever
2026-09-26 11:45:45,751 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 11:45:45,755 INFO core: _init_accounts coroutine started
2026-09-26 11:45:45,755 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 11:45:45,759 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:50:10,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 11:50:10,287 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 11:50:10,287 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 11:55:08,147 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 11:55:08,150 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 11:55:08,158 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:00:34,769 INFO core: Event loop thread started, running loop forever
2026-09-26 12:00:35,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 12:00:35,075 INFO core: _init_accounts coroutine started
2026-09-26 12:00:35,077 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 12:00:35,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:05:17,694 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 12:05:17,695 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 12:05:17,698 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:10:05,707 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 12:10:05,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:10:05,711 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 12:15:16,550 INFO core: Event loop thread started, running loop forever
2026-09-26 12:15:16,852 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 12:15:16,857 INFO core: _init_accounts coroutine started
2026-09-26 12:15:16,857 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 12:15:16,868 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:15:16,868 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 12:15:16,869 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 12:20:12,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:25:19,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 12:25:35,698 INFO core: Event loop thread started, running loop forever
2026-09-26 12:25:35,999 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 12:25:36,003 INFO core: _init_accounts coroutine started
2026-09-26 12:25:36,005 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 12:25:36,013 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 12:25:36,013 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 12:25:36,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:30:42,399 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 12:30:44,651 INFO core: Event loop thread started, running loop forever
2026-09-26 12:30:44,952 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 12:30:44,959 INFO core: _init_accounts coroutine started
2026-09-26 12:30:44,959 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 12:30:44,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:35:20,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:40:26,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 12:40:30,032 INFO core: Event loop thread started, running loop forever
2026-09-26 12:40:30,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 12:40:30,338 INFO core: _init_accounts coroutine started
2026-09-26 12:40:30,339 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 12:40:30,347 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:45:48,209 INFO core: Event loop thread started, running loop forever
2026-09-26 12:45:48,510 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 12:45:48,513 INFO core: _init_accounts coroutine started
2026-09-26 12:45:48,515 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 12:45:48,520 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:50:39,989 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 12:50:39,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:50:39,990 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 12:55:24,091 INFO core: Event loop thread started, running loop forever
2026-09-26 12:55:24,392 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 12:55:24,395 INFO core: _init_accounts coroutine started
2026-09-26 12:55:24,397 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 12:55:24,403 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 12:55:45,121 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 13:00:32,655 INFO core: Event loop thread started, running loop forever
2026-09-26 13:00:32,956 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 13:00:32,960 INFO core: _init_accounts coroutine started
2026-09-26 13:00:32,961 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 13:00:32,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:05:38,391 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 13:05:38,391 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 13:05:38,391 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-26 13:05:38,392 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 13:05:38,392 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 13:05:39,775 INFO core: Event loop thread started, running loop forever
2026-09-26 13:05:40,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 13:05:40,079 INFO core: _init_accounts coroutine started
2026-09-26 13:05:40,081 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 13:05:40,090 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:10:39,059 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 13:10:39,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:15:44,770 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:20:30,173 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-26 13:20:30,174 INFO core: _init_accounts coroutine started
2026-09-26 13:20:30,174 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 13:20:30,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:25:29,773 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:30:22,545 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 13:30:22,552 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:35:47,317 INFO core: Event loop thread started, running loop forever
2026-09-26 13:35:47,621 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 13:35:47,628 INFO core: _init_accounts coroutine started
2026-09-26 13:35:47,630 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 13:35:47,637 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:40:35,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:45:22,165 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:50:21,459 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 13:50:21,460 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 13:50:21,464 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 13:50:21,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 13:55:38,646 INFO core: Event loop thread started, running loop forever
2026-09-26 13:55:38,947 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 13:55:38,951 INFO core: _init_accounts coroutine started
2026-09-26 13:55:38,952 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 13:55:38,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:00:08,298 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 14:00:42,033 INFO core: Event loop thread started, running loop forever
2026-09-26 14:00:42,333 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 14:00:42,337 INFO core: _init_accounts coroutine started
2026-09-26 14:00:42,338 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 14:00:42,342 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:05:31,859 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 14:05:31,860 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 14:05:31,861 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 14:05:31,862 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 14:05:31,863 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:10:05,579 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:15:12,460 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 14:15:12,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 14:15:12,462 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 14:15:26,221 INFO core: Event loop thread started, running loop forever
2026-09-26 14:15:26,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 14:15:26,525 INFO core: _init_accounts coroutine started
2026-09-26 14:15:26,528 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 14:15:26,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:20:31,317 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 14:20:31,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:25:08,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:30:19,047 INFO core: Event loop thread started, running loop forever
2026-09-26 14:30:19,348 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 14:30:19,354 INFO core: _init_accounts coroutine started
2026-09-26 14:30:19,355 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 14:30:19,363 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:35:26,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 14:35:50,300 INFO core: Event loop thread started, running loop forever
2026-09-26 14:35:50,602 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 14:35:50,604 INFO core: _init_accounts coroutine started
2026-09-26 14:35:50,606 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 14:35:50,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:40:34,267 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 14:40:34,267 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 14:40:34,267 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:45:41,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 14:45:41,378 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 14:45:50,342 INFO core: Event loop thread started, running loop forever
2026-09-26 14:45:50,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 14:45:50,648 INFO core: _init_accounts coroutine started
2026-09-26 14:45:50,648 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 14:45:50,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:50:43,365 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:55:04,081 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 14:55:04,081 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 14:55:04,082 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 14:55:04,089 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 15:00:11,456 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 15:00:11,470 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 15:00:11,470 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 15:00:11,470 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 15:00:51,065 INFO core: Event loop thread started, running loop forever
2026-09-26 15:00:51,367 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 15:00:51,371 INFO core: _init_accounts coroutine started
2026-09-26 15:00:51,374 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 15:00:51,379 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:05:19,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:10:26,450 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 15:10:26,987 INFO core: Event loop thread started, running loop forever
2026-09-26 15:10:27,288 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 15:10:27,293 INFO core: _init_accounts coroutine started
2026-09-26 15:10:27,295 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 15:10:27,300 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:15:28,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:20:35,426 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 15:20:35,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 15:20:35,427 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-26 15:20:35,428 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 15:20:35,428 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 15:20:35,428 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 15:20:35,428 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 15:20:35,428 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 15:20:35,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 15:20:43,152 INFO core: Event loop thread started, running loop forever
2026-09-26 15:20:43,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 15:20:43,457 INFO core: _init_accounts coroutine started
2026-09-26 15:20:43,460 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 15:20:43,468 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:25:32,265 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 15:25:32,265 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 15:25:32,267 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 15:25:32,269 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 15:25:32,281 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 15:25:32,281 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 15:25:32,287 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 15:25:32,288 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 15:25:32,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:30:36,945 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 15:30:36,946 WARNING core: Account 2: connect timed out after 35s
2026-09-26 15:30:36,947 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 15:30:36,947 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 15:30:36,948 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 15:30:36,949 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 15:30:36,950 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 15:30:36,960 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:35:42,425 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 15:35:42,427 WARNING core: Account 2: connect timed out after 35s
2026-09-26 15:35:42,979 INFO core: Event loop thread started, running loop forever
2026-09-26 15:35:43,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 15:35:43,287 INFO core: _init_accounts coroutine started
2026-09-26 15:35:43,287 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 15:35:43,293 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:40:46,429 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:45:09,532 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 15:45:09,532 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 15:45:09,536 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 15:45:09,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:50:16,363 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 15:50:27,515 INFO core: Event loop thread started, running loop forever
2026-09-26 15:50:27,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 15:50:27,820 INFO core: _init_accounts coroutine started
2026-09-26 15:50:27,823 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 15:50:27,830 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:55:34,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 15:55:44,831 INFO core: Event loop thread started, running loop forever
2026-09-26 15:55:45,131 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 15:55:45,138 INFO core: _init_accounts coroutine started
2026-09-26 15:55:45,138 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 15:55:45,156 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 15:55:45,156 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 15:55:45,157 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 15:55:45,158 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 15:55:45,166 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 15:55:45,166 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 15:55:45,166 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 16:00:29,648 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 16:00:29,650 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 16:00:29,653 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:05:33,938 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 16:05:33,939 WARNING core: Account 2: connect timed out after 35s
2026-09-26 16:05:33,941 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 16:05:33,941 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 16:05:33,942 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 16:05:33,942 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 16:05:33,943 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 16:05:33,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:10:29,517 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 16:10:29,518 WARNING core: Account 2: connect timed out after 35s
2026-09-26 16:10:29,519 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-26 16:10:29,520 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-26 16:10:29,520 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 16:10:29,521 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-26 16:10:29,522 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-26 16:10:29,528 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:15:05,350 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 16:15:05,351 WARNING core: Account 2: connect timed out after 35s
2026-09-26 16:15:05,351 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-26 16:15:05,352 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-26 16:15:05,352 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 16:15:05,353 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-26 16:15:05,354 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-26 16:15:13,325 INFO core: Event loop thread started, running loop forever
2026-09-26 16:15:13,626 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 16:15:13,629 INFO core: _init_accounts coroutine started
2026-09-26 16:15:13,631 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 16:15:13,636 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:20:14,206 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 16:20:14,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:25:38,797 INFO core: Event loop thread started, running loop forever
2026-09-26 16:25:39,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 16:25:39,103 INFO core: _init_accounts coroutine started
2026-09-26 16:25:39,103 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 16:25:39,110 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:30:07,713 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 16:30:07,734 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:35:45,855 INFO core: Event loop thread started, running loop forever
2026-09-26 16:35:46,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 16:35:46,160 INFO core: _init_accounts coroutine started
2026-09-26 16:35:46,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 16:35:46,170 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:40:18,013 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:45:51,503 INFO core: Event loop thread started, running loop forever
2026-09-26 16:45:51,804 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 16:45:51,808 INFO core: _init_accounts coroutine started
2026-09-26 16:45:51,810 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 16:45:51,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:50:42,064 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 16:50:42,064 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 16:50:42,070 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 16:50:42,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 16:55:37,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:00:26,266 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 17:00:26,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:05:26,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:05:26,282 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 17:10:13,912 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 17:10:13,918 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 17:10:13,919 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 17:10:13,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:15:19,376 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 17:15:19,377 WARNING core: Account 2: connect timed out after 35s
2026-09-26 17:15:19,377 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 17:15:19,377 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 17:15:19,378 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 17:15:19,379 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 17:15:19,379 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 17:15:44,348 INFO core: Event loop thread started, running loop forever
2026-09-26 17:15:44,653 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 17:15:44,658 INFO core: _init_accounts coroutine started
2026-09-26 17:15:44,659 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 17:15:44,665 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:20:44,736 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:25:11,234 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 17:25:11,241 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 17:25:11,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:30:13,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:35:07,483 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 17:35:07,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:40:14,404 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 17:40:14,837 INFO core: Event loop thread started, running loop forever
2026-09-26 17:40:15,139 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 17:40:15,142 INFO core: _init_accounts coroutine started
2026-09-26 17:40:15,143 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 17:40:15,151 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:45:22,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 17:45:33,847 INFO core: Event loop thread started, running loop forever
2026-09-26 17:45:34,148 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 17:45:34,153 INFO core: _init_accounts coroutine started
2026-09-26 17:45:34,154 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 17:45:34,157 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:50:23,916 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 17:55:36,726 INFO core: Event loop thread started, running loop forever
2026-09-26 17:55:37,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 17:55:37,032 INFO core: _init_accounts coroutine started
2026-09-26 17:55:37,032 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 17:55:37,037 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:00:29,302 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 18:00:29,311 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:05:16,669 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:10:14,678 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-26 18:10:14,679 INFO core: _init_accounts coroutine started
2026-09-26 18:10:14,679 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 18:10:14,685 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:15:20,475 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 18:15:31,393 INFO core: Event loop thread started, running loop forever
2026-09-26 18:15:31,694 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 18:15:31,698 INFO core: _init_accounts coroutine started
2026-09-26 18:15:31,700 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 18:15:31,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:20:06,957 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:25:44,635 INFO core: Event loop thread started, running loop forever
2026-09-26 18:25:44,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 18:25:44,941 INFO core: _init_accounts coroutine started
2026-09-26 18:25:44,942 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 18:25:44,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:25:44,972 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 18:25:44,972 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 18:30:47,895 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 18:30:47,898 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:35:42,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:40:20,342 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 18:40:20,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:45:27,422 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 18:45:48,416 INFO core: Event loop thread started, running loop forever
2026-09-26 18:45:48,717 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 18:45:48,721 INFO core: _init_accounts coroutine started
2026-09-26 18:45:48,722 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 18:45:48,728 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:50:46,282 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 18:50:46,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 18:55:14,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:00:37,512 INFO core: Event loop thread started, running loop forever
2026-09-26 19:00:37,813 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 19:00:37,816 INFO core: _init_accounts coroutine started
2026-09-26 19:00:37,817 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 19:00:37,826 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:00:37,829 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 19:00:37,831 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 19:00:37,833 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 19:00:37,834 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 19:05:40,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:10:19,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:15:26,399 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 19:15:26,400 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 19:15:26,406 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 19:15:26,407 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 19:15:39,435 INFO core: Event loop thread started, running loop forever
2026-09-26 19:15:39,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 19:15:39,740 INFO core: _init_accounts coroutine started
2026-09-26 19:15:39,741 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 19:15:39,749 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 19:15:39,749 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 19:15:39,750 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 19:15:39,751 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 19:15:39,758 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 19:15:39,759 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 19:15:39,762 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 19:15:39,763 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 19:15:39,769 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:20:20,764 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 19:20:20,765 WARNING core: Account 2: connect timed out after 35s
2026-09-26 19:20:20,765 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 19:20:20,766 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 19:20:20,767 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 19:20:20,768 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 19:20:20,768 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 19:20:20,771 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:25:26,437 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 19:25:26,438 WARNING core: Account 2: connect timed out after 35s
2026-09-26 19:25:26,439 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-26 19:25:26,439 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-26 19:25:26,441 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 19:25:26,442 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-26 19:25:26,442 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-26 19:25:29,768 INFO core: Event loop thread started, running loop forever
2026-09-26 19:25:30,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 19:25:30,073 INFO core: _init_accounts coroutine started
2026-09-26 19:25:30,075 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 19:25:30,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:30:15,875 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 19:30:15,876 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 19:30:15,884 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 19:30:15,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:35:05,764 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 19:35:05,766 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:40:53,648 INFO core: Event loop thread started, running loop forever
2026-09-26 19:40:53,950 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 19:40:53,952 INFO core: _init_accounts coroutine started
2026-09-26 19:40:53,953 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 19:40:53,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:45:10,871 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:45:10,872 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 19:50:16,466 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 19:50:16,466 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-26 19:50:16,467 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 19:50:16,467 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-26 19:50:16,467 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 19:50:16,468 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-26 19:50:16,468 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 19:50:16,468 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-26 19:50:43,583 INFO core: Event loop thread started, running loop forever
2026-09-26 19:50:43,884 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 19:50:43,888 INFO core: _init_accounts coroutine started
2026-09-26 19:50:43,889 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 19:50:43,894 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 19:55:35,873 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 19:55:35,873 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 19:55:35,874 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 19:55:35,875 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 19:55:35,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:00:31,084 INFO core: Event loop thread started, running loop forever
2026-09-26 20:00:31,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 20:00:31,391 INFO core: _init_accounts coroutine started
2026-09-26 20:00:31,392 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 20:00:31,398 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:00:42,128 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 20:05:08,260 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:10:15,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 20:10:15,433 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 20:10:15,434 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-26 20:10:15,434 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 20:10:15,434 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 20:10:15,434 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 20:10:15,434 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 20:10:15,434 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 20:10:15,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 20:10:41,885 INFO core: Event loop thread started, running loop forever
2026-09-26 20:10:42,186 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 20:10:42,189 INFO core: _init_accounts coroutine started
2026-09-26 20:10:42,190 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 20:10:42,197 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:10:42,198 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 20:10:42,199 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 20:15:48,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 20:15:48,392 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 20:15:48,419 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 20:15:51,220 INFO core: Event loop thread started, running loop forever
2026-09-26 20:15:51,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 20:15:51,526 INFO core: _init_accounts coroutine started
2026-09-26 20:15:51,528 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 20:15:51,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:20:27,314 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 20:20:27,314 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 20:20:27,316 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 20:20:27,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:20:27,319 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 20:25:20,994 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:30:27,437 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 20:30:27,438 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 20:30:27,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 20:30:28,681 INFO core: Event loop thread started, running loop forever
2026-09-26 20:30:28,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 20:30:28,988 INFO core: _init_accounts coroutine started
2026-09-26 20:30:28,988 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 20:30:28,996 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 20:30:28,996 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 20:30:28,997 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 20:30:28,998 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 20:30:29,008 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 20:30:29,008 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 20:30:29,012 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 20:30:29,012 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 20:30:29,017 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:35:34,908 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 20:35:34,908 WARNING core: Account 2: connect timed out after 35s
2026-09-26 20:35:34,909 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 20:35:34,909 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 20:35:34,910 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 20:35:34,911 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 20:35:34,911 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 20:35:34,918 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:40:36,378 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 20:40:36,379 WARNING core: Account 2: connect timed out after 35s
2026-09-26 20:40:36,379 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-26 20:40:36,379 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-26 20:40:36,380 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 20:40:36,380 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-26 20:40:36,381 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-26 20:40:36,386 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:45:11,916 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 20:45:11,917 WARNING core: Account 2: connect timed out after 35s
2026-09-26 20:45:11,917 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-26 20:45:11,917 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-26 20:45:11,917 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 20:45:11,918 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-26 20:45:11,918 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-26 20:45:11,923 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:50:17,427 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 20:50:17,429 WARNING core: Account 2: connect timed out after 35s
2026-09-26 20:50:50,042 INFO core: Event loop thread started, running loop forever
2026-09-26 20:50:50,345 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 20:50:50,349 INFO core: _init_accounts coroutine started
2026-09-26 20:50:50,351 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 20:50:50,357 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 20:55:17,062 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 20:55:17,062 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 20:55:17,063 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 20:55:17,065 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 20:55:17,067 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:00:05,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:05:31,056 INFO core: Event loop thread started, running loop forever
2026-09-26 21:05:31,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 21:05:31,362 INFO core: _init_accounts coroutine started
2026-09-26 21:05:31,362 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 21:05:31,373 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:10:16,275 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:15:23,449 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 21:15:23,449 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 21:15:23,449 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-26 21:15:23,450 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 21:15:23,451 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 21:15:23,451 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 21:15:23,452 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 21:15:23,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 21:15:23,452 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 21:15:50,329 INFO core: Event loop thread started, running loop forever
2026-09-26 21:15:50,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 21:15:50,634 INFO core: _init_accounts coroutine started
2026-09-26 21:15:50,636 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 21:15:50,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:20:38,752 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:25:35,663 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 21:25:35,663 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 21:25:35,665 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 21:25:35,666 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 21:25:35,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:25:35,679 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 21:30:32,249 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 21:30:32,257 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 21:30:32,260 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 21:30:32,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:35:13,960 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 21:35:13,961 WARNING core: Account 2: connect timed out after 35s
2026-09-26 21:35:13,963 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-26 21:35:13,963 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-26 21:35:13,964 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 21:35:13,967 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-26 21:35:13,968 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-26 21:35:13,972 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:40:10,952 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 21:40:10,953 WARNING core: Account 2: connect timed out after 35s
2026-09-26 21:40:10,953 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-26 21:40:10,953 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-26 21:40:10,954 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-26 21:40:10,955 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-26 21:40:10,955 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-26 21:40:10,960 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:45:17,396 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 21:45:17,397 WARNING core: Account 2: connect timed out after 35s
2026-09-26 21:45:45,816 INFO core: Event loop thread started, running loop forever
2026-09-26 21:45:46,117 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 21:45:46,122 INFO core: _init_accounts coroutine started
2026-09-26 21:45:46,125 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 21:45:46,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:50:44,317 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 21:50:44,323 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 21:55:03,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:00:47,481 INFO core: Event loop thread started, running loop forever
2026-09-26 22:00:47,782 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 22:00:47,786 INFO core: _init_accounts coroutine started
2026-09-26 22:00:47,789 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 22:00:47,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:05:24,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:05:24,117 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 22:05:24,117 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 22:10:29,229 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 22:10:29,232 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:15:17,170 INFO core: Event loop thread started, running loop forever
2026-09-26 22:15:17,479 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 22:15:17,482 INFO core: _init_accounts coroutine started
2026-09-26 22:15:17,485 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 22:15:17,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:15:35,191 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 22:20:16,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:25:23,373 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 22:25:49,392 INFO core: Event loop thread started, running loop forever
2026-09-26 22:25:49,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 22:25:49,697 INFO core: _init_accounts coroutine started
2026-09-26 22:25:49,698 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 22:25:49,705 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:30:21,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:35:27,388 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 22:35:40,681 INFO core: Event loop thread started, running loop forever
2026-09-26 22:35:40,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 22:35:40,987 INFO core: _init_accounts coroutine started
2026-09-26 22:35:40,987 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 22:35:41,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:40:45,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:45:43,475 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 22:45:43,475 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 22:45:43,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:50:40,945 INFO core: Event loop thread started, running loop forever
2026-09-26 22:50:41,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 22:50:41,256 INFO core: _init_accounts coroutine started
2026-09-26 22:50:41,257 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 22:50:41,264 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 22:50:50,957 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-26 22:55:33,638 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-26 22:55:33,644 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-26 23:00:16,476 INFO core: Event loop thread started, running loop forever
2026-09-26 23:00:16,777 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 23:00:16,780 INFO core: _init_accounts coroutine started
2026-09-26 23:00:16,781 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 23:00:16,792 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:05:23,494 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 23:05:40,344 INFO core: Event loop thread started, running loop forever
2026-09-26 23:05:40,645 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 23:05:40,649 INFO core: _init_accounts coroutine started
2026-09-26 23:05:40,651 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 23:05:40,667 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:05:40,669 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 23:05:40,669 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 23:10:42,704 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 23:10:42,708 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:15:23,095 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 23:15:23,104 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-26 23:15:23,104 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 23:15:23,108 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-26 23:15:23,108 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-26 23:15:23,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:20:30,392 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-26 23:20:30,394 WARNING core: Account 2: connect timed out after 35s
2026-09-26 23:20:44,067 INFO core: Event loop thread started, running loop forever
2026-09-26 23:20:44,368 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 23:20:44,372 INFO core: _init_accounts coroutine started
2026-09-26 23:20:44,374 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 23:20:44,377 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:25:43,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:30:34,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:35:26,331 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 23:35:26,331 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 23:35:26,333 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:35:26,335 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 23:40:10,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:45:16,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 23:45:25,614 INFO core: Event loop thread started, running loop forever
2026-09-26 23:45:25,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 23:45:25,920 INFO core: _init_accounts coroutine started
2026-09-26 23:45:25,922 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 23:45:25,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:50:31,381 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-26 23:50:31,382 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-26 23:50:31,382 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-26 23:50:31,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-26 23:50:31,382 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-26 23:50:31,382 INFO core: _init_accounts_inner: reloading LLM config
2026-09-26 23:50:31,382 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-26 23:50:31,382 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-26 23:50:31,382 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-26 23:50:47,759 INFO core: Event loop thread started, running loop forever
2026-09-26 23:50:48,060 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-26 23:50:48,065 INFO core: _init_accounts coroutine started
2026-09-26 23:50:48,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-26 23:50:48,072 INFO core: status() clients=0 connected=False forwarding=False
2026-09-26 23:55:11,090 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:00:37,809 INFO core: Event loop thread started, running loop forever
2026-09-27 00:00:38,111 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 00:00:38,120 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:00:38,124 INFO core: _init_accounts coroutine started
2026-09-27 00:00:38,125 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 00:05:39,501 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:10:18,633 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 00:10:18,661 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:15:34,664 INFO core: Event loop thread started, running loop forever
2026-09-27 00:15:34,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 00:15:34,969 INFO core: _init_accounts coroutine started
2026-09-27 00:15:34,972 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 00:15:34,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:20:39,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:25:05,333 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 00:25:05,351 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:30:32,277 INFO core: Event loop thread started, running loop forever
2026-09-27 00:30:32,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 00:30:32,584 INFO core: _init_accounts coroutine started
2026-09-27 00:30:32,586 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 00:30:32,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:35:14,502 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:40:20,311 INFO core: Event loop thread started, running loop forever
2026-09-27 00:40:20,307 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 00:40:20,612 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 00:40:20,619 INFO core: _init_accounts coroutine started
2026-09-27 00:40:20,620 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 00:40:20,626 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:45:12,994 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 00:45:12,994 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 00:45:12,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:50:18,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 00:50:18,421 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 00:50:18,422 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 00:50:18,422 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 00:50:18,422 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 00:50:18,422 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 00:50:44,811 INFO core: Event loop thread started, running loop forever
2026-09-27 00:50:45,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 00:50:45,117 INFO core: _init_accounts coroutine started
2026-09-27 00:50:45,119 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 00:50:45,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 00:55:15,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:00:11,940 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 01:00:11,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:05:16,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:10:52,196 INFO core: Event loop thread started, running loop forever
2026-09-27 01:10:52,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 01:10:52,501 INFO core: _init_accounts coroutine started
2026-09-27 01:10:52,503 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 01:10:52,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:15:05,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 01:15:52,859 INFO core: Event loop thread started, running loop forever
2026-09-27 01:15:53,160 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 01:15:53,165 INFO core: _init_accounts coroutine started
2026-09-27 01:15:53,165 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 01:15:53,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:20:26,270 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 01:20:26,270 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 01:20:26,273 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 01:20:26,275 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 01:20:26,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:25:32,688 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:30:47,195 INFO core: Event loop thread started, running loop forever
2026-09-27 01:30:47,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 01:30:47,504 INFO core: _init_accounts coroutine started
2026-09-27 01:30:47,507 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 01:30:47,507 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:35:35,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:40:41,397 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 01:40:49,279 INFO core: Event loop thread started, running loop forever
2026-09-27 01:40:49,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 01:40:49,586 INFO core: _init_accounts coroutine started
2026-09-27 01:40:49,587 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 01:40:49,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:45:49,620 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 01:45:49,628 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:50:42,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 01:55:33,790 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-27 01:55:33,791 INFO core: _init_accounts coroutine started
2026-09-27 01:55:33,791 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 01:55:33,795 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:00:09,147 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 02:00:09,147 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 02:00:09,156 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 02:00:09,168 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 02:00:09,190 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 02:00:09,191 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 02:00:09,203 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 02:00:09,204 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 02:00:09,221 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:05:08,097 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 02:05:08,098 WARNING core: Account 2: connect timed out after 35s
2026-09-27 02:05:08,098 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-27 02:05:08,099 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-27 02:05:08,100 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 02:05:08,101 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-27 02:05:08,102 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-27 02:05:08,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:10:15,459 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 02:10:15,461 WARNING core: Account 2: connect timed out after 35s
2026-09-27 02:10:15,461 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-27 02:10:15,462 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-27 02:10:15,462 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 02:10:15,464 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-27 02:10:15,464 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-27 02:10:31,002 INFO core: Event loop thread started, running loop forever
2026-09-27 02:10:31,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 02:10:31,308 INFO core: _init_accounts coroutine started
2026-09-27 02:10:31,310 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 02:10:31,316 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 02:10:31,317 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 02:10:31,319 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 02:10:31,321 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:10:31,321 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 02:15:27,325 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:20:25,118 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 02:20:25,119 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 02:20:25,125 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 02:20:25,127 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 02:20:25,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:25:32,380 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 02:25:32,381 WARNING core: Account 2: connect timed out after 35s
2026-09-27 02:25:32,381 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-27 02:25:32,382 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-27 02:25:32,382 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 02:25:32,383 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-27 02:25:32,384 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-27 02:25:36,327 INFO core: Event loop thread started, running loop forever
2026-09-27 02:25:36,628 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 02:25:36,634 INFO core: _init_accounts coroutine started
2026-09-27 02:25:36,635 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 02:25:36,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:30:43,448 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 02:30:45,408 INFO core: Event loop thread started, running loop forever
2026-09-27 02:30:45,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 02:30:45,715 INFO core: _init_accounts coroutine started
2026-09-27 02:30:45,716 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 02:30:45,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:35:14,966 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 02:35:14,966 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 02:35:14,967 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:40:07,900 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 02:40:07,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:45:13,444 WARNING core: ensure_pair_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 02:45:13,445 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 02:45:34,691 INFO core: Event loop thread started, running loop forever
2026-09-27 02:45:34,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 02:45:34,995 INFO core: _init_accounts coroutine started
2026-09-27 02:45:34,997 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 02:45:35,002 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:50:30,896 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 02:55:41,711 INFO core: Event loop thread started, running loop forever
2026-09-27 02:55:42,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 02:55:42,019 INFO core: _init_accounts coroutine started
2026-09-27 02:55:42,021 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 02:55:42,030 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:00:21,984 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:05:41,430 INFO core: Event loop thread started, running loop forever
2026-09-27 03:05:41,731 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 03:05:41,735 INFO core: _init_accounts coroutine started
2026-09-27 03:05:41,736 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 03:05:41,743 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:10:11,856 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:15:04,215 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 03:15:04,218 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 03:15:04,239 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 03:15:04,242 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 03:15:04,260 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:20:11,444 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 03:20:11,445 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 03:20:11,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 03:20:40,219 INFO core: Event loop thread started, running loop forever
2026-09-27 03:20:40,520 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 03:20:40,523 INFO core: _init_accounts coroutine started
2026-09-27 03:20:40,525 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 03:20:40,530 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:25:30,347 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 03:25:30,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:30:34,422 INFO core: Event loop thread started, running loop forever
2026-09-27 03:30:34,723 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 03:30:34,728 INFO core: _init_accounts coroutine started
2026-09-27 03:30:34,728 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 03:30:34,736 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:35:46,453 INFO core: Event loop thread started, running loop forever
2026-09-27 03:35:46,755 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 03:35:46,760 INFO core: _init_accounts coroutine started
2026-09-27 03:35:46,761 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 03:35:46,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:40:46,697 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 03:40:46,697 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 03:40:46,699 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 03:40:46,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:45:07,750 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 03:45:07,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:50:04,870 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 03:55:09,347 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 03:55:09,348 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 03:55:09,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:00:16,377 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 04:00:16,379 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 04:00:49,487 INFO core: Event loop thread started, running loop forever
2026-09-27 04:00:49,789 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 04:00:49,794 INFO core: _init_accounts coroutine started
2026-09-27 04:00:49,795 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 04:00:49,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:05:07,080 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 04:05:07,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:10:54,459 INFO core: Event loop thread started, running loop forever
2026-09-27 04:10:54,760 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 04:10:54,764 INFO core: _init_accounts coroutine started
2026-09-27 04:10:54,767 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 04:10:54,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:15:32,999 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 04:15:33,004 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:20:36,192 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:25:16,367 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-27 04:25:16,369 INFO core: _init_accounts coroutine started
2026-09-27 04:25:16,369 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 04:25:16,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:30:15,538 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 04:30:15,538 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 04:30:15,539 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:35:21,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 04:35:21,420 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 04:35:21,420 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 04:35:21,421 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 04:35:21,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 04:35:21,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 04:35:52,308 INFO core: Event loop thread started, running loop forever
2026-09-27 04:35:52,611 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 04:35:52,614 INFO core: _init_accounts coroutine started
2026-09-27 04:35:52,617 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 04:35:52,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:40:45,227 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 04:40:45,227 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 04:40:45,238 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:45:43,096 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 04:45:43,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:50:22,661 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 04:50:22,674 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 04:55:16,946 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 04:55:16,947 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 04:55:16,952 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 04:55:16,953 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 04:55:16,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:00:22,402 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 05:00:22,403 WARNING core: Account 2: connect timed out after 35s
2026-09-27 05:00:22,404 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-27 05:00:22,404 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-27 05:00:22,405 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 05:00:22,406 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-27 05:00:22,406 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-27 05:00:40,742 INFO core: Event loop thread started, running loop forever
2026-09-27 05:00:41,043 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 05:00:41,047 INFO core: _init_accounts coroutine started
2026-09-27 05:00:41,049 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 05:00:41,055 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:05:09,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:10:21,407 INFO core: Event loop thread started, running loop forever
2026-09-27 05:10:21,708 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 05:10:21,714 INFO core: _init_accounts coroutine started
2026-09-27 05:10:21,715 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 05:10:21,721 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:15:13,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:20:41,270 INFO core: Event loop thread started, running loop forever
2026-09-27 05:20:41,571 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 05:20:41,578 INFO core: _init_accounts coroutine started
2026-09-27 05:20:41,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 05:20:41,593 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:25:24,884 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 05:25:24,885 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 05:25:24,887 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 05:25:24,892 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 05:25:24,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:30:17,895 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:30:17,899 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 05:30:17,903 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 05:30:17,908 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 05:30:17,909 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 05:35:23,451 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 05:35:28,969 INFO core: Event loop thread started, running loop forever
2026-09-27 05:35:29,270 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 05:35:29,274 INFO core: _init_accounts coroutine started
2026-09-27 05:35:29,274 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 05:35:29,289 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:40:26,389 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 05:40:26,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 05:40:26,393 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 05:40:26,395 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 05:40:26,404 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:45:31,276 INFO core: Event loop thread started, running loop forever
2026-09-27 05:45:31,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 05:45:31,584 INFO core: _init_accounts coroutine started
2026-09-27 05:45:31,584 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 05:45:31,588 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:50:15,172 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 05:50:15,189 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 05:55:30,318 INFO core: Event loop thread started, running loop forever
2026-09-27 05:55:30,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 05:55:30,627 INFO core: _init_accounts coroutine started
2026-09-27 05:55:30,628 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 05:55:30,638 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 05:55:30,638 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 05:55:30,640 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 05:55:30,642 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 05:55:30,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:00:39,135 INFO core: Event loop thread started, running loop forever
2026-09-27 06:00:39,437 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:00:39,444 INFO core: _init_accounts coroutine started
2026-09-27 06:00:39,445 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:00:39,450 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:05:14,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:10:30,850 INFO core: Event loop thread started, running loop forever
2026-09-27 06:10:31,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:10:31,154 INFO core: _init_accounts coroutine started
2026-09-27 06:10:31,155 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:10:31,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:15:37,982 INFO core: Event loop thread started, running loop forever
2026-09-27 06:15:38,283 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:15:38,287 INFO core: _init_accounts coroutine started
2026-09-27 06:15:38,288 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:15:38,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:20:05,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:25:12,352 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 06:25:12,405 INFO core: Event loop thread started, running loop forever
2026-09-27 06:25:12,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:25:12,716 INFO core: _init_accounts coroutine started
2026-09-27 06:25:12,716 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:25:12,723 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:30:40,925 INFO core: Event loop thread started, running loop forever
2026-09-27 06:30:41,226 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:30:41,237 INFO core: _init_accounts coroutine started
2026-09-27 06:30:41,238 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:30:41,242 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:35:52,353 INFO core: Event loop thread started, running loop forever
2026-09-27 06:35:52,654 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:35:52,659 INFO core: _init_accounts coroutine started
2026-09-27 06:35:52,660 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:35:52,664 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:40:33,144 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:45:51,300 INFO core: Event loop thread started, running loop forever
2026-09-27 06:45:51,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:45:51,607 INFO core: _init_accounts coroutine started
2026-09-27 06:45:51,607 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:45:51,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:50:22,112 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 06:50:22,113 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 06:50:22,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 06:55:32,837 INFO core: Event loop thread started, running loop forever
2026-09-27 06:55:33,138 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 06:55:33,142 INFO core: _init_accounts coroutine started
2026-09-27 06:55:33,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 06:55:33,155 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:00:39,437 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 07:00:52,053 INFO core: Event loop thread started, running loop forever
2026-09-27 07:00:52,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 07:00:52,358 INFO core: _init_accounts coroutine started
2026-09-27 07:00:52,361 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 07:00:52,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:05:25,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:10:23,946 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 07:10:23,947 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 07:10:23,948 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 07:10:23,950 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:10:23,950 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 07:15:29,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 07:15:48,422 INFO core: Event loop thread started, running loop forever
2026-09-27 07:15:48,723 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 07:15:48,726 INFO core: _init_accounts coroutine started
2026-09-27 07:15:48,728 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 07:15:48,735 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:20:18,813 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:25:24,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 07:25:32,658 INFO core: Event loop thread started, running loop forever
2026-09-27 07:25:32,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 07:25:32,963 INFO core: _init_accounts coroutine started
2026-09-27 07:25:32,964 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 07:25:32,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:30:23,153 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:35:19,610 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 07:35:19,612 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:35:19,612 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 07:40:11,276 INFO core: Event loop thread started, running loop forever
2026-09-27 07:40:11,576 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 07:40:11,582 INFO core: _init_accounts coroutine started
2026-09-27 07:40:11,585 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 07:40:11,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:40:25,302 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 07:40:25,303 WARNING core: ensure_pair_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-27 07:40:25,304 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 07:40:25,304 WARNING core: LLM config load failed: cannot schedule new futures after interpreter shutdown
2026-09-27 07:40:25,304 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 07:40:25,304 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-27 07:45:17,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 07:45:43,270 INFO core: Event loop thread started, running loop forever
2026-09-27 07:45:43,572 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 07:45:43,579 INFO core: _init_accounts coroutine started
2026-09-27 07:45:43,581 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 07:45:43,582 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:50:24,113 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 07:55:30,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 07:55:30,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 07:55:30,414 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 07:55:30,415 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 07:55:30,433 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:00:06,476 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 08:00:06,477 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 08:00:06,477 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 08:00:17,346 INFO core: Event loop thread started, running loop forever
2026-09-27 08:00:17,648 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 08:00:17,652 INFO core: _init_accounts coroutine started
2026-09-27 08:00:17,652 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 08:00:17,656 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:05:28,426 INFO core: Event loop thread started, running loop forever
2026-09-27 08:05:28,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 08:05:28,730 INFO core: _init_accounts coroutine started
2026-09-27 08:05:28,731 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 08:05:28,752 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 08:05:28,752 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 08:05:28,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:05:28,759 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 08:10:35,543 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 08:10:35,544 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 08:10:35,544 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 08:10:35,545 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 08:10:44,340 INFO core: Event loop thread started, running loop forever
2026-09-27 08:10:44,641 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 08:10:44,646 INFO core: _init_accounts coroutine started
2026-09-27 08:10:44,647 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 08:10:44,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:15:29,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:15:29,812 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 08:15:29,821 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 08:20:32,237 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 08:20:32,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:25:40,812 INFO core: Event loop thread started, running loop forever
2026-09-27 08:25:41,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 08:25:41,117 INFO core: _init_accounts coroutine started
2026-09-27 08:25:41,119 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 08:25:41,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:30:47,465 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 08:30:54,677 INFO core: Event loop thread started, running loop forever
2026-09-27 08:30:54,978 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 08:30:54,982 INFO core: _init_accounts coroutine started
2026-09-27 08:30:54,986 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 08:30:54,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:35:17,452 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:40:32,668 INFO core: Event loop thread started, running loop forever
2026-09-27 08:40:32,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 08:40:32,973 INFO core: _init_accounts coroutine started
2026-09-27 08:40:32,977 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 08:40:32,984 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 08:40:32,984 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 08:40:32,985 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 08:40:32,986 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 08:40:33,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:45:12,372 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 08:45:12,383 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 08:45:12,390 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 08:45:12,390 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:45:12,391 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 08:50:19,460 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 08:50:19,460 WARNING core: Account 2: connect timed out after 35s
2026-09-27 08:50:19,461 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-27 08:50:19,461 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-27 08:50:19,462 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 08:50:19,463 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-27 08:50:19,463 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-27 08:50:44,252 INFO core: Event loop thread started, running loop forever
2026-09-27 08:50:44,553 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 08:50:44,556 INFO core: _init_accounts coroutine started
2026-09-27 08:50:44,558 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 08:50:44,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 08:55:31,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:00:23,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 09:00:23,400 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 09:00:23,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 09:00:23,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:05:13,192 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 09:05:13,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:10:26,507 INFO core: Event loop thread started, running loop forever
2026-09-27 09:10:26,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 09:10:26,816 INFO core: _init_accounts coroutine started
2026-09-27 09:10:26,816 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 09:10:26,822 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:15:27,911 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 09:15:27,911 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 09:15:27,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:20:51,660 INFO core: Event loop thread started, running loop forever
2026-09-27 09:20:51,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 09:20:51,964 INFO core: _init_accounts coroutine started
2026-09-27 09:20:51,966 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 09:20:51,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:25:40,963 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 09:25:40,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:30:36,287 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:35:36,386 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-27 09:35:36,388 INFO core: _init_accounts coroutine started
2026-09-27 09:35:36,388 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 09:35:36,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:40:42,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 09:40:42,411 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 09:40:42,411 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-27 09:40:42,412 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 09:40:42,412 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 09:40:42,412 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 09:40:42,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 09:40:42,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 09:40:42,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 09:40:51,769 INFO core: Event loop thread started, running loop forever
2026-09-27 09:40:52,071 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 09:40:52,076 INFO core: _init_accounts coroutine started
2026-09-27 09:40:52,078 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 09:40:52,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:45:46,436 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 09:45:46,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 09:45:46,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 09:45:46,442 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 09:45:46,458 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 09:45:46,459 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 09:45:46,460 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:45:46,463 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 09:45:46,466 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 09:50:15,868 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 09:50:15,869 WARNING core: Account 2: connect timed out after 35s
2026-09-27 09:50:15,869 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-27 09:50:15,870 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-27 09:50:15,870 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 09:50:15,871 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-27 09:50:15,871 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-27 09:50:15,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 09:55:08,980 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 09:55:08,981 WARNING core: Account 2: connect timed out after 35s
2026-09-27 09:55:08,983 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-27 09:55:08,984 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-27 09:55:08,984 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 09:55:08,986 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-27 09:55:08,986 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-27 09:55:08,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:00:10,798 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 10:00:10,798 WARNING core: Account 2: connect timed out after 35s
2026-09-27 10:00:10,799 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-27 10:00:10,799 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-27 10:00:10,799 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 10:00:10,800 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-27 10:00:10,800 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-27 10:00:10,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:05:16,452 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 10:05:16,454 WARNING core: Account 2: connect timed out after 35s
2026-09-27 10:05:16,455 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.186:443/TcpAbridged...
2026-09-27 10:05:16,455 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.186:443/TcpAbridged complete!
2026-09-27 10:05:16,455 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 10:05:16,457 INFO core: Account 2: connecting to Telegram via 91.108.56.187...
2026-09-27 10:05:16,457 INFO telethon.network.mtprotosender: Connecting to 91.108.56.187:443/TcpAbridged...
2026-09-27 10:05:39,965 INFO core: Event loop thread started, running loop forever
2026-09-27 10:05:40,267 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 10:05:40,270 INFO core: _init_accounts coroutine started
2026-09-27 10:05:40,270 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 10:05:40,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:10:12,120 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 10:10:12,120 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 10:10:12,123 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 10:10:12,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:15:04,432 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 10:15:04,433 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 10:15:41,957 INFO core: Event loop thread started, running loop forever
2026-09-27 10:15:42,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 10:15:42,265 INFO core: _init_accounts coroutine started
2026-09-27 10:15:42,265 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 10:15:42,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:20:36,400 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 10:20:36,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:25:45,783 INFO core: Event loop thread started, running loop forever
2026-09-27 10:25:46,085 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 10:25:46,090 INFO core: _init_accounts coroutine started
2026-09-27 10:25:46,091 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 10:25:46,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:30:36,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:35:45,621 INFO core: Event loop thread started, running loop forever
2026-09-27 10:35:45,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 10:35:45,929 INFO core: _init_accounts coroutine started
2026-09-27 10:35:45,930 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 10:35:45,943 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:40:15,276 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 10:40:15,276 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 10:40:15,284 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:40:15,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 10:45:51,284 INFO core: Event loop thread started, running loop forever
2026-09-27 10:45:51,588 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 10:45:51,596 INFO core: _init_accounts coroutine started
2026-09-27 10:45:51,597 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 10:45:51,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:50:11,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 10:55:17,427 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 10:55:17,427 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 10:55:17,428 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-27 10:55:17,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 10:55:17,429 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 10:55:17,429 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 10:55:50,030 INFO core: Event loop thread started, running loop forever
2026-09-27 10:55:50,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 10:55:50,336 INFO core: _init_accounts coroutine started
2026-09-27 10:55:50,340 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 10:55:50,340 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:00:14,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:05:21,469 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-27 11:05:47,279 INFO core: Event loop thread started, running loop forever
2026-09-27 11:05:47,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 11:05:47,584 INFO core: _init_accounts coroutine started
2026-09-27 11:05:47,586 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 11:05:47,592 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:05:47,595 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 11:05:47,599 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 11:10:28,824 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 11:10:28,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:15:32,087 INFO core: Event loop thread started, running loop forever
2026-09-27 11:15:32,389 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 11:15:32,394 INFO core: _init_accounts coroutine started
2026-09-27 11:15:32,396 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 11:15:32,414 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:15:32,423 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-27 11:15:35,086 INFO core: _init_accounts_inner: reloading LLM config
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-27 11:20:11,496 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-27 11:25:16,520 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:30:34,307 INFO core: Event loop thread started, running loop forever
2026-09-27 11:30:34,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 11:30:34,612 INFO core: _init_accounts coroutine started
2026-09-27 11:30:34,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 11:30:34,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:35:34,497 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:40:40,411 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 11:40:47,374 INFO core: Event loop thread started, running loop forever
2026-09-27 11:40:47,675 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 11:40:47,681 INFO core: _init_accounts coroutine started
2026-09-27 11:40:47,681 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 11:40:47,688 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:45:32,472 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 11:45:32,472 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 11:45:32,474 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 11:45:32,475 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 11:45:32,490 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:50:10,270 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 11:50:10,272 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 11:50:10,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 11:55:38,611 INFO core: Event loop thread started, running loop forever
2026-09-27 11:55:38,912 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 11:55:38,922 INFO core: _init_accounts coroutine started
2026-09-27 11:55:38,922 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 11:55:38,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:00:14,890 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 12:00:14,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 12:00:14,898 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 12:00:14,900 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 12:00:14,903 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:05:19,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:10:26,468 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 12:10:26,469 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 12:10:26,469 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 12:10:37,089 INFO core: Event loop thread started, running loop forever
2026-09-27 12:10:37,389 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 12:10:37,392 INFO core: _init_accounts coroutine started
2026-09-27 12:10:37,393 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 12:10:37,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:15:43,490 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 12:15:43,506 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:20:54,107 INFO core: Event loop thread started, running loop forever
2026-09-27 12:20:54,408 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 12:20:54,411 INFO core: _init_accounts coroutine started
2026-09-27 12:20:54,413 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 12:20:54,418 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:25:35,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:30:05,349 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 12:30:05,352 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 12:30:05,358 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 12:30:05,358 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 12:30:05,358 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 12:30:05,358 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 12:30:05,359 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 12:30:05,359 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 12:30:55,601 INFO core: Event loop thread started, running loop forever
2026-09-27 12:30:55,903 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 12:30:55,907 INFO core: _init_accounts coroutine started
2026-09-27 12:30:55,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 12:30:55,913 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:35:42,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:40:26,525 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:45:18,512 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 12:45:18,513 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 12:45:18,527 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 12:45:18,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:50:23,256 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 12:50:23,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 12:55:19,075 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:00:32,711 INFO core: Event loop thread started, running loop forever
2026-09-27 13:00:33,012 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 13:00:33,026 INFO core: _init_accounts coroutine started
2026-09-27 13:00:33,026 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 13:00:33,052 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 13:00:33,052 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 13:00:33,059 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 13:00:33,062 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 13:00:33,063 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:05:41,133 INFO core: Event loop thread started, running loop forever
2026-09-27 13:05:41,434 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 13:05:41,481 INFO core: _init_accounts coroutine started
2026-09-27 13:05:41,483 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 13:05:41,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:10:30,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:15:37,462 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 13:15:37,464 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 13:15:37,464 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-27 13:15:37,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 13:15:37,465 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 13:15:37,465 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 13:15:37,465 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 13:15:37,465 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 13:15:37,465 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 13:15:47,638 INFO core: Event loop thread started, running loop forever
2026-09-27 13:15:47,946 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 13:15:47,950 INFO core: _init_accounts coroutine started
2026-09-27 13:15:47,951 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 13:15:47,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:20:22,353 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:25:37,681 INFO core: Event loop thread started, running loop forever
2026-09-27 13:25:37,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 13:25:37,985 INFO core: _init_accounts coroutine started
2026-09-27 13:25:37,988 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 13:25:37,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:30:21,703 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:35:42,852 INFO core: Event loop thread started, running loop forever
2026-09-27 13:35:43,154 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 13:35:43,157 INFO core: _init_accounts coroutine started
2026-09-27 13:35:43,160 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 13:35:43,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:40:17,350 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:45:24,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 13:45:55,058 INFO core: Event loop thread started, running loop forever
2026-09-27 13:45:55,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 13:45:55,362 INFO core: _init_accounts coroutine started
2026-09-27 13:45:55,365 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 13:45:55,370 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:45:55,376 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 13:45:55,376 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 13:45:55,381 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 13:50:21,773 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 13:50:21,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 13:55:22,193 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 13:55:22,193 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 13:55:22,198 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 13:55:22,199 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 13:55:22,202 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:00:09,306 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 14:00:09,307 WARNING core: Account 2: connect timed out after 35s
2026-09-27 14:00:09,308 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-27 14:00:09,308 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-27 14:00:09,310 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 14:00:09,311 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-27 14:00:09,311 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-27 14:00:09,320 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:05:16,421 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 14:05:16,421 WARNING core: Account 2: connect timed out after 35s
2026-09-27 14:05:16,422 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-27 14:05:16,422 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-27 14:05:16,423 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 14:05:16,424 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-27 14:05:16,424 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-27 14:05:25,167 INFO core: Event loop thread started, running loop forever
2026-09-27 14:05:25,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 14:05:25,474 INFO core: _init_accounts coroutine started
2026-09-27 14:05:25,475 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 14:05:25,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:10:10,705 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 14:10:10,706 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 14:10:10,706 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:15:16,439 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 14:15:33,536 INFO core: Event loop thread started, running loop forever
2026-09-27 14:15:33,837 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 14:15:33,851 INFO core: _init_accounts coroutine started
2026-09-27 14:15:33,852 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 14:15:33,863 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:20:08,031 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 14:20:08,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:25:53,329 INFO core: Event loop thread started, running loop forever
2026-09-27 14:25:53,630 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 14:25:53,637 INFO core: _init_accounts coroutine started
2026-09-27 14:25:53,639 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 14:25:53,643 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:30:23,257 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:35:15,273 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 14:35:15,294 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:40:46,960 INFO core: Event loop thread started, running loop forever
2026-09-27 14:40:47,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 14:40:47,275 INFO core: _init_accounts coroutine started
2026-09-27 14:40:47,276 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 14:40:47,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:45:40,297 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 14:45:40,299 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 14:45:40,301 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 14:45:40,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:50:47,407 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 14:50:47,407 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 14:50:47,408 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 14:50:47,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 14:50:49,915 INFO core: Event loop thread started, running loop forever
2026-09-27 14:50:50,217 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 14:50:50,221 INFO core: _init_accounts coroutine started
2026-09-27 14:50:50,222 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 14:50:50,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 14:55:11,756 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 14:55:11,771 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:00:40,738 INFO core: Event loop thread started, running loop forever
2026-09-27 15:00:41,039 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 15:00:41,051 INFO core: _init_accounts coroutine started
2026-09-27 15:00:41,052 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 15:00:41,061 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:05:51,564 INFO core: Event loop thread started, running loop forever
2026-09-27 15:05:51,865 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 15:05:51,868 INFO core: _init_accounts coroutine started
2026-09-27 15:05:51,869 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 15:05:51,877 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:10:30,023 INFO core: Event loop thread started, running loop forever
2026-09-27 15:10:30,331 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 15:10:30,334 INFO core: _init_accounts coroutine started
2026-09-27 15:10:30,334 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 15:10:30,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:10:58,053 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 15:15:22,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:20:07,671 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 15:20:07,671 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 15:20:07,677 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:25:13,465 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 15:25:53,516 INFO core: Event loop thread started, running loop forever
2026-09-27 15:25:53,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 15:25:53,823 INFO core: _init_accounts coroutine started
2026-09-27 15:25:53,823 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 15:25:53,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:30:49,536 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 15:30:49,536 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 15:30:49,538 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:30:49,539 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 15:35:15,916 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:40:15,053 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 15:40:15,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:45:34,370 INFO core: Event loop thread started, running loop forever
2026-09-27 15:45:34,671 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 15:45:34,675 INFO core: _init_accounts coroutine started
2026-09-27 15:45:34,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 15:45:34,686 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:50:28,753 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:55:10,807 INFO core: Event loop thread started, running loop forever
2026-09-27 15:55:11,108 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 15:55:11,112 INFO core: _init_accounts coroutine started
2026-09-27 15:55:11,114 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 15:55:11,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 15:55:34,848 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 15:55:34,848 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 15:55:34,848 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-27 15:55:34,849 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 15:55:34,849 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 15:55:34,849 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 15:55:34,849 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 15:55:34,849 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 15:55:34,850 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 16:00:21,569 INFO core: Event loop thread started, running loop forever
2026-09-27 16:00:21,870 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 16:00:21,875 INFO core: _init_accounts coroutine started
2026-09-27 16:00:21,877 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 16:00:21,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:05:34,318 INFO core: Event loop thread started, running loop forever
2026-09-27 16:05:34,620 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 16:05:34,625 INFO core: _init_accounts coroutine started
2026-09-27 16:05:34,626 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 16:05:34,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:10:40,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:15:42,785 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 16:15:42,801 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:20:36,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:25:17,854 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-27 16:25:17,858 INFO core: _init_accounts coroutine started
2026-09-27 16:25:17,858 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 16:25:17,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:30:09,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:30:09,592 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 16:35:16,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 16:35:17,055 INFO core: Event loop thread started, running loop forever
2026-09-27 16:35:17,356 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 16:35:17,359 INFO core: _init_accounts coroutine started
2026-09-27 16:35:17,360 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 16:35:17,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:40:11,433 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 16:40:11,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 16:40:11,438 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 16:40:11,443 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 16:40:11,484 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 16:40:11,484 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 16:40:11,498 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 16:40:11,499 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:40:11,500 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 16:45:18,394 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-27 16:45:18,395 WARNING core: Account 2: connect timed out after 35s
2026-09-27 16:45:18,395 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-27 16:45:18,395 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-27 16:45:18,396 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-27 16:45:18,397 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-27 16:45:18,398 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-27 16:45:25,068 INFO core: Event loop thread started, running loop forever
2026-09-27 16:45:25,369 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 16:45:25,374 INFO core: _init_accounts coroutine started
2026-09-27 16:45:25,375 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 16:45:25,383 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:50:28,125 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 16:50:28,125 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 16:50:28,127 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 16:50:28,128 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 16:50:28,133 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 16:55:20,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:00:38,855 INFO core: Event loop thread started, running loop forever
2026-09-27 17:00:39,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 17:00:39,161 INFO core: _init_accounts coroutine started
2026-09-27 17:00:39,162 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 17:00:39,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:05:11,638 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:10:17,421 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 17:10:46,188 INFO core: Event loop thread started, running loop forever
2026-09-27 17:10:46,489 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 17:10:46,492 INFO core: _init_accounts coroutine started
2026-09-27 17:10:46,504 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 17:10:46,509 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:10:46,515 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 17:10:46,515 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 17:10:46,516 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 17:15:54,486 INFO core: Event loop thread started, running loop forever
2026-09-27 17:15:54,786 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 17:15:54,789 INFO core: _init_accounts coroutine started
2026-09-27 17:15:54,790 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 17:15:54,797 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:19:49,348 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 17:19:49,348 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 17:19:49,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:19:49,352 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 17:20:23,464 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 17:20:23,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:25:11,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:30:10,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:35:08,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:40:17,600 INFO core: Event loop thread started, running loop forever
2026-09-27 17:40:17,901 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 17:40:17,905 INFO core: _init_accounts coroutine started
2026-09-27 17:40:17,906 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 17:40:17,921 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 17:40:17,921 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 17:40:17,922 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 17:40:17,924 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 17:40:17,934 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:45:24,424 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 17:45:30,666 INFO core: Event loop thread started, running loop forever
2026-09-27 17:45:30,967 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 17:45:30,970 INFO core: _init_accounts coroutine started
2026-09-27 17:45:30,972 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 17:45:30,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:50:32,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 17:55:17,591 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 17:55:17,591 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 17:55:17,597 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 17:55:17,598 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 17:55:17,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:00:22,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:00:22,621 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 18:05:29,440 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 18:05:29,447 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-27 18:05:29,448 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-27 18:05:48,192 INFO core: Event loop thread started, running loop forever
2026-09-27 18:05:48,494 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 18:05:48,498 INFO core: _init_accounts coroutine started
2026-09-27 18:05:48,501 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 18:05:48,508 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:10:32,979 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 18:10:32,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:15:11,769 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:20:20,111 INFO core: Event loop thread started, running loop forever
2026-09-27 18:20:20,412 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 18:20:20,416 INFO core: _init_accounts coroutine started
2026-09-27 18:20:20,419 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 18:20:20,427 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:25:34,366 INFO core: Event loop thread started, running loop forever
2026-09-27 18:25:34,667 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 18:25:34,671 INFO core: _init_accounts coroutine started
2026-09-27 18:25:34,673 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 18:25:34,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:30:33,079 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 18:30:33,079 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 18:30:33,081 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 18:30:33,082 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:35:39,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 18:35:39,417 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 18:35:53,442 INFO core: Event loop thread started, running loop forever
2026-09-27 18:35:53,743 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 18:35:53,747 INFO core: _init_accounts coroutine started
2026-09-27 18:35:53,749 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 18:35:53,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:40:21,402 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:45:21,087 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 18:45:21,087 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 18:45:21,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:50:06,667 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 18:50:06,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:55:24,229 INFO core: Event loop thread started, running loop forever
2026-09-27 18:55:24,530 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 18:55:24,542 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 18:55:24,543 INFO core: _init_accounts coroutine started
2026-09-27 18:55:24,544 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 19:00:18,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:05:24,455 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 19:05:50,984 INFO core: Event loop thread started, running loop forever
2026-09-27 19:05:51,285 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 19:05:51,292 INFO core: _init_accounts coroutine started
2026-09-27 19:05:51,292 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 19:05:51,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:05:51,315 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 19:10:30,690 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 19:10:30,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:15:32,866 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 19:15:32,875 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:20:36,479 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:25:38,473 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 19:25:38,486 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:30:28,159 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:35:15,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:40:17,201 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 19:40:17,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:40:17,211 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 19:45:39,330 INFO core: Event loop thread started, running loop forever
2026-09-27 19:45:39,632 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 19:45:39,636 INFO core: _init_accounts coroutine started
2026-09-27 19:45:39,637 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 19:45:39,646 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:50:15,492 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 19:50:15,492 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 19:50:15,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:55:17,039 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 19:55:17,042 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 20:00:24,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 20:00:24,416 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 20:00:52,723 INFO core: Event loop thread started, running loop forever
2026-09-27 20:00:53,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 20:00:53,028 INFO core: _init_accounts coroutine started
2026-09-27 20:00:53,029 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 20:00:53,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:05:45,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:05:45,303 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 20:05:45,307 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 20:10:41,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:15:32,701 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 20:15:32,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:20:38,489 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 20:20:46,434 INFO core: Event loop thread started, running loop forever
2026-09-27 20:20:46,735 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 20:20:46,738 INFO core: _init_accounts coroutine started
2026-09-27 20:20:46,741 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 20:20:46,748 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:25:28,134 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:25:28,135 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 20:25:28,136 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 20:30:35,945 INFO core: Event loop thread started, running loop forever
2026-09-27 20:30:36,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 20:30:36,249 INFO core: _init_accounts coroutine started
2026-09-27 20:30:36,250 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 20:30:36,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:35:43,358 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 20:35:44,401 INFO core: Event loop thread started, running loop forever
2026-09-27 20:35:44,705 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 20:35:44,712 INFO core: _init_accounts coroutine started
2026-09-27 20:35:44,712 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 20:35:44,717 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:40:10,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:45:12,519 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 20:45:12,520 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 20:45:12,521 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:50:08,218 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 20:50:08,225 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 20:50:08,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 20:55:14,442 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 20:55:14,442 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 20:55:28,480 INFO core: Event loop thread started, running loop forever
2026-09-27 20:55:28,781 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 20:55:28,786 INFO core: _init_accounts coroutine started
2026-09-27 20:55:28,786 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 20:55:28,794 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:00:19,737 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 21:00:19,740 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 21:00:19,745 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 21:00:19,751 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 21:00:19,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:05:25,395 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 21:05:25,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 21:05:25,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 21:05:40,628 INFO core: Event loop thread started, running loop forever
2026-09-27 21:05:40,929 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 21:05:40,932 INFO core: _init_accounts coroutine started
2026-09-27 21:05:40,933 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 21:05:40,939 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:10:45,000 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 21:10:45,000 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 21:10:45,002 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:10:45,002 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 21:10:45,004 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 21:15:12,816 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:20:24,272 INFO core: Event loop thread started, running loop forever
2026-09-27 21:20:24,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 21:20:24,577 INFO core: _init_accounts coroutine started
2026-09-27 21:20:24,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 21:20:24,592 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:25:29,295 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 21:25:29,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:25:29,296 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 21:25:29,297 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 21:30:13,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:35:19,443 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 21:35:19,444 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 21:35:19,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 21:35:19,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 21:35:23,949 INFO core: Event loop thread started, running loop forever
2026-09-27 21:35:24,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 21:35:24,256 INFO core: _init_accounts coroutine started
2026-09-27 21:35:24,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 21:35:24,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:40:03,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:45:33,580 INFO core: Event loop thread started, running loop forever
2026-09-27 21:45:33,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 21:45:33,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:50:06,960 INFO core: _init_accounts coroutine started
2026-09-27 21:50:06,961 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 21:50:06,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 21:55:13,374 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 21:55:48,783 INFO core: Event loop thread started, running loop forever
2026-09-27 21:55:49,084 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 21:55:49,087 INFO core: _init_accounts coroutine started
2026-09-27 21:55:49,089 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 21:55:49,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:00:07,345 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 22:00:26,205 INFO core: Event loop thread started, running loop forever
2026-09-27 22:00:26,506 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 22:00:26,510 INFO core: _init_accounts coroutine started
2026-09-27 22:00:26,510 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 22:00:26,514 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:05:33,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 22:05:33,639 INFO core: Event loop thread started, running loop forever
2026-09-27 22:05:33,940 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 22:05:33,944 INFO core: _init_accounts coroutine started
2026-09-27 22:05:33,946 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 22:05:33,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:10:20,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:10:20,244 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 22:10:20,248 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 22:15:12,215 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 22:15:12,222 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 22:15:12,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:20:16,847 INFO core: Event loop thread started, running loop forever
2026-09-27 22:20:17,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 22:20:17,154 INFO core: _init_accounts coroutine started
2026-09-27 22:20:17,156 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 22:20:17,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:25:04,278 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:30:46,254 INFO core: Event loop thread started, running loop forever
2026-09-27 22:30:46,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 22:30:46,563 INFO core: _init_accounts coroutine started
2026-09-27 22:30:46,564 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 22:30:46,574 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:35:23,654 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 22:35:23,670 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:40:06,865 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:45:44,268 INFO core: Event loop thread started, running loop forever
2026-09-27 22:45:44,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 22:45:44,573 INFO core: _init_accounts coroutine started
2026-09-27 22:45:44,573 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 22:45:44,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:50:15,777 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 22:50:15,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 22:55:22,524 INFO core: Event loop thread started, running loop forever
2026-09-27 22:55:22,825 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 22:55:22,828 INFO core: _init_accounts coroutine started
2026-09-27 22:55:22,830 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 22:55:22,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:00:11,936 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 23:00:11,936 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 23:00:11,970 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:05:17,443 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 23:05:17,444 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-27 23:05:17,445 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 23:05:17,446 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-27 23:05:17,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-27 23:05:17,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 23:05:36,696 INFO core: Event loop thread started, running loop forever
2026-09-27 23:05:36,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 23:05:37,007 INFO core: _init_accounts coroutine started
2026-09-27 23:05:37,007 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 23:05:37,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:05:37,024 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 23:05:37,024 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 23:05:37,025 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 23:05:37,027 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 23:10:17,139 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:15:24,220 INFO core: Event loop thread started, running loop forever
2026-09-27 23:15:24,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 23:15:24,527 INFO core: _init_accounts coroutine started
2026-09-27 23:15:24,530 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 23:15:24,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:20:30,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-27 23:20:42,060 INFO core: Event loop thread started, running loop forever
2026-09-27 23:20:42,361 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 23:20:42,364 INFO core: _init_accounts coroutine started
2026-09-27 23:20:42,366 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 23:20:42,379 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:25:48,515 INFO core: Event loop thread started, running loop forever
2026-09-27 23:25:48,513 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-27 23:25:48,817 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 23:25:48,822 INFO core: _init_accounts coroutine started
2026-09-27 23:25:48,823 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 23:25:48,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:30:52,861 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-27 23:30:52,861 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-27 23:30:52,863 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-27 23:30:52,865 INFO core: _init_accounts_inner: reloading LLM config
2026-09-27 23:30:52,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:35:44,274 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:40:41,366 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:45:24,569 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:50:30,420 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-27 23:50:34,301 INFO core: Event loop thread started, running loop forever
2026-09-27 23:50:34,601 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-27 23:50:34,613 INFO core: _init_accounts coroutine started
2026-09-27 23:50:34,614 INFO core: _init_accounts_inner: starting DB migrations
2026-09-27 23:50:34,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-27 23:55:24,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:00:20,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:05:27,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 00:05:27,398 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 00:05:27,398 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 00:05:27,399 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 00:05:27,399 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 00:05:27,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 00:05:27,399 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 00:05:27,399 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 00:05:27,400 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 00:05:38,262 INFO core: Event loop thread started, running loop forever
2026-09-28 00:05:38,564 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 00:05:38,571 INFO core: _init_accounts coroutine started
2026-09-28 00:05:38,575 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 00:05:38,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:10:33,848 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:15:07,433 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 00:15:48,142 INFO core: Event loop thread started, running loop forever
2026-09-28 00:15:48,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 00:15:48,453 INFO core: _init_accounts coroutine started
2026-09-28 00:15:48,454 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 00:15:48,459 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:20:42,405 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:25:40,990 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:30:52,623 INFO core: Event loop thread started, running loop forever
2026-09-28 00:30:52,924 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 00:30:52,927 INFO core: _init_accounts coroutine started
2026-09-28 00:30:52,929 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 00:30:52,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:35:11,256 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:40:18,453 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 00:40:18,454 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 00:40:18,454 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 00:40:22,795 INFO core: Event loop thread started, running loop forever
2026-09-28 00:40:23,098 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 00:40:23,102 INFO core: _init_accounts coroutine started
2026-09-28 00:40:23,112 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 00:40:23,112 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:45:45,935 INFO core: Event loop thread started, running loop forever
2026-09-28 00:45:46,237 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 00:45:46,242 INFO core: _init_accounts coroutine started
2026-09-28 00:45:46,244 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 00:45:46,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:50:13,861 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 00:55:25,122 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 00:55:25,128 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 00:55:25,126 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:00:38,593 INFO core: Event loop thread started, running loop forever
2026-09-28 01:00:38,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 01:00:38,899 INFO core: _init_accounts coroutine started
2026-09-28 01:00:38,902 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 01:00:38,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:05:33,563 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:10:34,873 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 01:10:34,874 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 01:10:34,881 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:15:26,567 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 01:15:26,568 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 01:15:26,573 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:15:26,574 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 01:20:08,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:25:05,651 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:30:08,271 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 01:30:08,272 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 01:30:08,297 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 01:30:08,299 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 01:30:08,315 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:35:07,356 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 01:35:07,357 WARNING core: Account 2: connect timed out after 35s
2026-09-28 01:35:07,358 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-28 01:35:07,358 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-28 01:35:07,359 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-28 01:35:07,361 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-28 01:35:07,361 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-28 01:35:07,367 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:40:13,351 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 01:40:13,351 WARNING core: Account 2: connect timed out after 35s
2026-09-28 01:40:13,359 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-28 01:40:20,411 INFO core: Event loop thread started, running loop forever
2026-09-28 01:40:20,712 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 01:40:20,715 INFO core: _init_accounts coroutine started
2026-09-28 01:40:20,718 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 01:40:20,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:45:34,172 INFO core: Event loop thread started, running loop forever
2026-09-28 01:45:34,473 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 01:45:34,477 INFO core: _init_accounts coroutine started
2026-09-28 01:45:34,479 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 01:45:34,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:50:37,946 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 01:50:37,946 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 01:50:37,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 01:50:37,949 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 01:55:44,618 INFO core: Event loop thread started, running loop forever
2026-09-28 01:55:44,921 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 01:55:44,928 INFO core: _init_accounts coroutine started
2026-09-28 01:55:44,928 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 01:55:44,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:00:46,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:00:46,088 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-28 02:05:37,837 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-28 02:10:04,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:15:23,598 INFO core: Event loop thread started, running loop forever
2026-09-28 02:15:23,899 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 02:15:23,915 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:20:27,987 INFO core: _init_accounts coroutine started
2026-09-28 02:20:27,988 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 02:20:27,996 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:25:33,486 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 02:25:38,387 INFO core: Event loop thread started, running loop forever
2026-09-28 02:25:38,688 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 02:25:38,694 INFO core: _init_accounts coroutine started
2026-09-28 02:25:38,694 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 02:25:38,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:30:06,394 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 02:30:34,131 INFO core: Event loop thread started, running loop forever
2026-09-28 02:30:34,433 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 02:30:34,436 INFO core: _init_accounts coroutine started
2026-09-28 02:30:34,437 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 02:30:34,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:35:10,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:40:17,393 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 02:40:17,394 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 02:40:29,296 INFO core: Event loop thread started, running loop forever
2026-09-28 02:40:29,597 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 02:40:29,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:45:20,194 INFO core: _init_accounts coroutine started
2026-09-28 02:45:20,196 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 02:45:20,202 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:50:07,872 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 02:55:13,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 02:55:13,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 02:55:13,418 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 02:55:13,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 02:55:13,419 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 02:55:13,419 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 02:55:13,419 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 02:55:13,419 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 02:55:13,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 02:55:51,620 INFO core: Event loop thread started, running loop forever
2026-09-28 02:55:51,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 02:55:51,925 INFO core: _init_accounts coroutine started
2026-09-28 02:55:51,927 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 02:55:51,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:00:34,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:05:40,398 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 03:05:51,364 INFO core: Event loop thread started, running loop forever
2026-09-28 03:05:51,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 03:05:51,669 INFO core: _init_accounts coroutine started
2026-09-28 03:05:51,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 03:05:51,678 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:10:44,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:15:19,983 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 03:15:19,985 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 03:15:19,989 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 03:15:19,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:20:26,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 03:20:34,220 INFO core: Event loop thread started, running loop forever
2026-09-28 03:20:34,521 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 03:20:34,524 INFO core: _init_accounts coroutine started
2026-09-28 03:20:34,526 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 03:20:34,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:25:32,106 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 03:25:32,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:30:37,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:35:21,912 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-28 03:35:21,916 INFO core: _init_accounts coroutine started
2026-09-28 03:35:21,916 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 03:35:21,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:40:53,389 INFO core: Event loop thread started, running loop forever
2026-09-28 03:40:53,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 03:40:53,693 INFO core: _init_accounts coroutine started
2026-09-28 03:40:53,695 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 03:40:53,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:45:45,584 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:50:20,809 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 03:50:20,809 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 03:50:20,812 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 03:55:16,197 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 03:55:16,233 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 03:55:16,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:00:23,450 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 04:00:23,451 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 04:00:23,486 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 04:00:23,487 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 04:00:34,607 INFO core: Event loop thread started, running loop forever
2026-09-28 04:00:34,908 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 04:00:34,912 INFO core: _init_accounts coroutine started
2026-09-28 04:00:34,913 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 04:00:34,922 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:05:45,433 INFO core: Event loop thread started, running loop forever
2026-09-28 04:05:45,734 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 04:05:45,740 INFO core: _init_accounts coroutine started
2026-09-28 04:05:45,740 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 04:05:45,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:10:09,079 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 04:10:09,079 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 04:10:09,081 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 04:10:09,086 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:15:09,993 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 04:15:10,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:20:17,516 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 04:20:17,516 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 04:20:17,516 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 04:20:19,498 INFO core: Event loop thread started, running loop forever
2026-09-28 04:20:19,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 04:20:19,803 INFO core: _init_accounts coroutine started
2026-09-28 04:20:19,806 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 04:20:19,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:25:25,573 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 04:25:25,573 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 04:25:25,575 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 04:25:25,576 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 04:25:25,576 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 04:25:25,576 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 04:25:25,576 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 04:25:25,576 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 04:25:25,576 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 04:25:46,062 INFO core: Event loop thread started, running loop forever
2026-09-28 04:25:46,371 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 04:25:46,379 INFO core: _init_accounts coroutine started
2026-09-28 04:25:46,379 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 04:25:46,414 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:30:30,054 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 04:30:30,055 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 04:30:30,062 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 04:30:30,064 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 04:30:30,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:35:17,144 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:35:17,147 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 04:35:17,149 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 04:40:24,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 04:40:40,080 INFO core: Event loop thread started, running loop forever
2026-09-28 04:40:40,390 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 04:40:40,397 INFO core: _init_accounts coroutine started
2026-09-28 04:40:40,398 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 04:40:40,407 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 04:40:40,410 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:40:40,413 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 04:45:05,432 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 04:45:05,433 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 04:45:05,434 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 04:45:05,434 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 04:45:05,434 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 04:45:05,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 04:45:23,324 INFO core: Event loop thread started, running loop forever
2026-09-28 04:45:23,626 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 04:45:23,631 INFO core: _init_accounts coroutine started
2026-09-28 04:45:23,632 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 04:45:23,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:50:35,839 INFO core: Event loop thread started, running loop forever
2026-09-28 04:50:36,140 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 04:50:36,143 INFO core: _init_accounts coroutine started
2026-09-28 04:50:36,145 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 04:50:36,235 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 04:55:29,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:00:13,264 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 05:00:13,264 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 05:00:13,266 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 05:00:13,269 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 05:00:13,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:05:20,496 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 05:05:42,991 INFO core: Event loop thread started, running loop forever
2026-09-28 05:05:43,292 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 05:05:43,301 INFO core: _init_accounts coroutine started
2026-09-28 05:05:43,308 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 05:05:43,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:10:19,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:10:19,103 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 05:10:19,104 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 05:10:39,956 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 05:10:39,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:10:39,959 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 05:15:23,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:20:13,047 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:25:20,480 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 05:25:49,389 INFO core: Event loop thread started, running loop forever
2026-09-28 05:25:49,690 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 05:25:49,693 INFO core: _init_accounts coroutine started
2026-09-28 05:25:49,695 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 05:25:49,700 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:30:56,242 INFO core: Event loop thread started, running loop forever
2026-09-28 05:30:56,543 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 05:30:56,548 INFO core: _init_accounts coroutine started
2026-09-28 05:30:56,548 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 05:30:56,554 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:35:37,631 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:40:06,020 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:45:12,437 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 05:45:16,204 INFO core: Event loop thread started, running loop forever
2026-09-28 05:45:16,505 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 05:45:16,509 INFO core: _init_accounts coroutine started
2026-09-28 05:45:16,512 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 05:45:16,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:50:23,496 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 05:50:37,360 INFO core: Event loop thread started, running loop forever
2026-09-28 05:50:37,661 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 05:50:37,668 INFO core: _init_accounts coroutine started
2026-09-28 05:50:37,669 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 05:50:37,675 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 05:55:38,334 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 05:55:38,345 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:00:36,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:05:34,211 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-28 06:05:34,222 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:05:34,223 INFO core: _init_accounts coroutine started
2026-09-28 06:05:34,224 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 06:10:31,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:15:37,426 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 06:15:37,434 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 06:15:49,228 INFO core: Event loop thread started, running loop forever
2026-09-28 06:15:49,529 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 06:15:49,534 INFO core: _init_accounts coroutine started
2026-09-28 06:15:49,536 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 06:15:49,546 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:20:14,165 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 06:20:14,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:25:21,364 INFO core: Event loop thread started, running loop forever
2026-09-28 06:25:21,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 06:25:21,669 INFO core: _init_accounts coroutine started
2026-09-28 06:25:21,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 06:25:21,675 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:30:20,313 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 06:30:20,314 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 06:30:20,316 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 06:30:20,317 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 06:30:20,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:35:27,489 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 06:35:29,964 INFO core: Event loop thread started, running loop forever
2026-09-28 06:35:30,265 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 06:35:30,270 INFO core: _init_accounts coroutine started
2026-09-28 06:35:30,271 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 06:35:30,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:40:27,529 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:40:27,531 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 06:40:27,531 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 06:45:19,995 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:50:26,420 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 06:50:40,674 INFO core: Event loop thread started, running loop forever
2026-09-28 06:50:40,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 06:50:40,982 INFO core: _init_accounts coroutine started
2026-09-28 06:50:40,983 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 06:50:40,988 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 06:55:44,725 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:00:07,379 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 07:00:39,132 INFO core: Event loop thread started, running loop forever
2026-09-28 07:00:39,435 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 07:00:39,440 INFO core: _init_accounts coroutine started
2026-09-28 07:00:39,441 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 07:00:39,446 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:05:38,396 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:05:38,397 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 07:05:38,397 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 07:10:45,486 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 07:10:45,510 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 07:10:47,370 INFO core: Event loop thread started, running loop forever
2026-09-28 07:10:47,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 07:10:47,676 INFO core: _init_accounts coroutine started
2026-09-28 07:10:47,678 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 07:10:47,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:15:48,024 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 07:15:48,024 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 07:15:48,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:20:52,271 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 07:20:52,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:25:26,806 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 07:25:26,807 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:30:19,848 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:35:25,537 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 07:35:38,588 INFO core: Event loop thread started, running loop forever
2026-09-28 07:35:38,889 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 07:35:38,897 INFO core: _init_accounts coroutine started
2026-09-28 07:35:38,898 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 07:35:38,905 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:40:22,627 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:45:35,068 INFO core: Event loop thread started, running loop forever
2026-09-28 07:45:35,369 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 07:45:35,373 INFO core: _init_accounts coroutine started
2026-09-28 07:45:35,374 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 07:45:35,381 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:50:29,371 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 07:50:29,411 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:55:44,066 INFO core: Event loop thread started, running loop forever
2026-09-28 07:55:44,367 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 07:55:44,370 INFO core: _init_accounts coroutine started
2026-09-28 07:55:44,371 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 07:55:44,392 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 07:55:44,392 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 07:55:44,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 07:55:44,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 08:00:37,994 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 08:00:38,007 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:05:44,469 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 08:05:44,471 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 08:05:44,472 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-28 08:05:51,012 INFO core: Event loop thread started, running loop forever
2026-09-28 08:05:51,321 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 08:05:51,326 INFO core: _init_accounts coroutine started
2026-09-28 08:05:51,327 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 08:05:51,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:10:41,323 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 08:10:41,323 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 08:10:41,326 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:10:41,327 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 08:10:41,329 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 08:15:33,701 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 08:15:33,701 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 08:15:33,707 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 08:15:33,708 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 08:15:33,709 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:20:24,675 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 08:20:24,676 WARNING core: Account 2: connect timed out after 35s
2026-09-28 08:20:24,677 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-28 08:20:24,677 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-28 08:20:24,678 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-28 08:20:24,680 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-28 08:20:24,680 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-28 08:20:24,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:25:30,407 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 08:25:37,707 INFO core: Event loop thread started, running loop forever
2026-09-28 08:25:38,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 08:25:38,025 INFO core: _init_accounts coroutine started
2026-09-28 08:25:38,026 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 08:25:38,026 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:30:15,587 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:35:13,658 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 08:35:13,672 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 08:35:13,675 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 08:35:13,676 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 08:35:13,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:40:19,475 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 08:40:19,476 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 08:40:19,476 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 08:40:28,942 INFO core: Event loop thread started, running loop forever
2026-09-28 08:40:29,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 08:40:29,247 INFO core: _init_accounts coroutine started
2026-09-28 08:40:29,248 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 08:40:29,258 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:45:10,400 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:50:17,466 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 08:50:47,157 INFO core: Event loop thread started, running loop forever
2026-09-28 08:50:47,459 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 08:50:47,462 INFO core: _init_accounts coroutine started
2026-09-28 08:50:47,462 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 08:50:47,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 08:55:36,136 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 08:55:36,138 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 08:55:36,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:00:33,165 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 09:00:33,167 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 09:00:33,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:05:46,626 INFO core: Event loop thread started, running loop forever
2026-09-28 09:05:46,927 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 09:05:46,933 INFO core: _init_accounts coroutine started
2026-09-28 09:05:46,934 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 09:05:46,947 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 09:05:46,947 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 09:05:46,949 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 09:05:46,950 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 09:05:46,952 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:10:32,536 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:15:07,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:20:07,586 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 09:20:07,586 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:20:07,593 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 09:25:14,451 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 09:25:14,459 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 09:25:41,675 INFO core: Event loop thread started, running loop forever
2026-09-28 09:25:41,976 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 09:25:41,982 INFO core: _init_accounts coroutine started
2026-09-28 09:25:41,983 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 09:25:41,988 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:30:06,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:35:13,495 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 09:35:13,495 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 09:35:13,495 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 09:35:13,496 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 09:35:13,496 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 09:35:13,496 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 09:35:13,496 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 09:35:13,497 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 09:35:13,497 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 09:35:31,947 INFO core: Event loop thread started, running loop forever
2026-09-28 09:35:32,248 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 09:35:32,252 INFO core: _init_accounts coroutine started
2026-09-28 09:35:32,253 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 09:35:32,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:40:24,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:45:17,113 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 09:45:17,114 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 09:45:17,122 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 09:45:17,123 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 09:45:17,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:50:24,397 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 09:50:24,397 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 09:50:24,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 09:50:31,554 INFO core: Event loop thread started, running loop forever
2026-09-28 09:50:31,855 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 09:50:31,859 INFO core: _init_accounts coroutine started
2026-09-28 09:50:31,861 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 09:50:31,867 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:55:26,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 09:55:26,731 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 09:55:26,734 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 10:00:28,094 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:05:31,642 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 10:05:31,654 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 10:05:31,659 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:10:40,399 INFO core: Event loop thread started, running loop forever
2026-09-28 10:10:40,700 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 10:10:40,703 INFO core: _init_accounts coroutine started
2026-09-28 10:10:40,705 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 10:10:40,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:15:05,785 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:20:11,386 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 10:20:11,387 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 10:20:26,706 INFO core: Event loop thread started, running loop forever
2026-09-28 10:20:27,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 10:20:27,015 INFO core: _init_accounts coroutine started
2026-09-28 10:20:27,016 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 10:20:27,019 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:25:14,627 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 10:25:14,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:30:38,095 INFO core: Event loop thread started, running loop forever
2026-09-28 10:30:38,397 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 10:30:38,401 INFO core: _init_accounts coroutine started
2026-09-28 10:30:38,404 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 10:30:38,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:35:31,726 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:40:04,672 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 10:40:04,673 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 10:40:04,679 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 10:40:04,692 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 10:40:04,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:45:10,450 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 10:45:10,450 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 10:45:10,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 10:45:50,617 INFO core: Event loop thread started, running loop forever
2026-09-28 10:45:50,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 10:45:50,922 INFO core: _init_accounts coroutine started
2026-09-28 10:45:50,924 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 10:45:50,932 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:50:28,498 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 10:50:28,499 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 10:50:28,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 10:55:34,677 INFO core: Event loop thread started, running loop forever
2026-09-28 10:55:34,978 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 10:55:34,983 INFO core: _init_accounts coroutine started
2026-09-28 10:55:34,984 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 10:55:34,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:00:56,868 INFO core: Event loop thread started, running loop forever
2026-09-28 11:00:57,169 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 11:00:57,172 INFO core: _init_accounts coroutine started
2026-09-28 11:00:57,173 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 11:00:57,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:05:12,085 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:10:19,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 11:10:19,413 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 11:10:19,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 11:10:21,663 INFO core: Event loop thread started, running loop forever
2026-09-28 11:10:21,965 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 11:10:21,970 INFO core: _init_accounts coroutine started
2026-09-28 11:10:21,971 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 11:10:21,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:15:22,639 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:20:29,445 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 11:20:29,572 INFO core: Event loop thread started, running loop forever
2026-09-28 11:20:29,873 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 11:20:29,880 INFO core: _init_accounts coroutine started
2026-09-28 11:20:29,880 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 11:20:29,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:25:48,520 INFO core: Event loop thread started, running loop forever
2026-09-28 11:25:48,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 11:25:48,825 INFO core: _init_accounts coroutine started
2026-09-28 11:25:48,826 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 11:25:48,832 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:30:15,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:35:22,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 11:35:22,501 INFO core: Event loop thread started, running loop forever
2026-09-28 11:35:22,803 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 11:35:22,806 INFO core: _init_accounts coroutine started
2026-09-28 11:35:22,808 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 11:35:22,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:40:48,612 INFO core: Event loop thread started, running loop forever
2026-09-28 11:40:48,913 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 11:40:48,916 INFO core: _init_accounts coroutine started
2026-09-28 11:40:48,917 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 11:40:48,928 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:45:51,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:50:06,272 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 11:50:06,278 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 11:50:06,282 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 11:50:06,288 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 11:50:06,299 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 11:55:13,523 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 11:55:13,525 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 11:55:13,525 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 11:55:24,702 INFO core: Event loop thread started, running loop forever
2026-09-28 11:55:25,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 11:55:25,010 INFO core: _init_accounts coroutine started
2026-09-28 11:55:25,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 11:55:25,033 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:00:31,446 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 12:00:47,751 INFO core: Event loop thread started, running loop forever
2026-09-28 12:00:48,057 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 12:00:48,060 INFO core: _init_accounts coroutine started
2026-09-28 12:00:48,063 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 12:00:48,079 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:05:15,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:10:15,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 12:10:15,878 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 12:10:15,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 12:10:15,882 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 12:10:15,885 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:15:21,494 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 12:15:21,494 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 12:15:21,494 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 12:15:28,446 INFO core: Event loop thread started, running loop forever
2026-09-28 12:15:28,747 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 12:15:28,751 INFO core: _init_accounts coroutine started
2026-09-28 12:15:28,753 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 12:15:28,757 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:20:25,042 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:25:25,344 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 12:25:25,350 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 12:25:25,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:30:29,361 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 12:30:29,363 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 12:30:29,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:35:34,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:40:17,213 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 12:40:17,216 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 12:40:17,218 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:40:17,224 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 12:40:17,225 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 12:45:06,150 WARNING core: Account 2: connect timed out after 35s
2026-09-28 12:45:06,152 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-28 12:45:06,152 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-28 12:45:06,153 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-28 12:45:06,155 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-28 12:45:06,155 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-28 12:45:06,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:50:12,476 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 12:50:12,479 WARNING core: Account 2: connect timed out after 35s
2026-09-28 12:50:31,320 INFO core: Event loop thread started, running loop forever
2026-09-28 12:50:31,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 12:50:31,626 INFO core: _init_accounts coroutine started
2026-09-28 12:50:31,627 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 12:50:31,639 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 12:50:31,640 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 12:50:31,640 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 12:50:31,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 12:55:38,412 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 12:55:38,412 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 12:55:38,413 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 12:55:48,161 INFO core: Event loop thread started, running loop forever
2026-09-28 12:55:48,463 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 12:55:48,469 INFO core: _init_accounts coroutine started
2026-09-28 12:55:48,469 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 12:55:48,488 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:00:24,654 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:05:19,569 INFO core: Event loop thread started, running loop forever
2026-09-28 13:05:19,870 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 13:05:19,875 INFO core: _init_accounts coroutine started
2026-09-28 13:05:19,876 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 13:05:19,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:05:19,884 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-28 13:05:31,580 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-28 13:10:53,770 INFO core: Event loop thread started, running loop forever
2026-09-28 13:10:54,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 13:10:54,075 INFO core: _init_accounts coroutine started
2026-09-28 13:10:54,076 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 13:10:54,089 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:15:11,934 INFO core: Event loop thread started, running loop forever
2026-09-28 13:15:12,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 13:15:12,238 INFO core: _init_accounts coroutine started
2026-09-28 13:15:12,240 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 13:15:12,245 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:20:18,482 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 13:20:33,713 INFO core: Event loop thread started, running loop forever
2026-09-28 13:20:34,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 13:20:34,021 INFO core: _init_accounts coroutine started
2026-09-28 13:20:34,021 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 13:20:34,044 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:25:40,471 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-28 13:25:44,960 INFO core: Event loop thread started, running loop forever
2026-09-28 13:25:45,262 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 13:25:45,268 INFO core: _init_accounts coroutine started
2026-09-28 13:25:45,268 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 13:25:45,272 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:30:37,078 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:35:35,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:40:42,500 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 13:40:42,501 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 13:40:42,501 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 13:40:42,502 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 13:40:42,502 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 13:40:42,503 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 13:40:53,657 INFO core: Event loop thread started, running loop forever
2026-09-28 13:40:53,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 13:40:53,964 INFO core: _init_accounts coroutine started
2026-09-28 13:40:53,965 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 13:40:53,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:45:53,735 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 13:45:53,736 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 13:45:53,738 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 13:45:53,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:45:53,739 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 13:50:32,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 13:55:28,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:00:35,473 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 14:00:44,901 INFO core: Event loop thread started, running loop forever
2026-09-28 14:00:45,202 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 14:00:45,207 INFO core: _init_accounts coroutine started
2026-09-28 14:00:45,208 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 14:00:45,215 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:05:39,801 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 14:05:39,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:10:17,505 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:15:52,800 INFO core: Event loop thread started, running loop forever
2026-09-28 14:15:53,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 14:15:53,105 INFO core: _init_accounts coroutine started
2026-09-28 14:15:53,107 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 14:15:53,128 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:20:09,287 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 14:20:09,287 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 14:20:09,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:20:09,290 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 14:25:16,453 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 14:25:16,454 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 14:25:16,455 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 14:25:16,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 14:25:20,967 INFO core: Event loop thread started, running loop forever
2026-09-28 14:25:21,271 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 14:25:21,276 INFO core: _init_accounts coroutine started
2026-09-28 14:25:21,277 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 14:25:21,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:30:06,689 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 14:30:06,704 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:35:43,054 INFO core: Event loop thread started, running loop forever
2026-09-28 14:35:43,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 14:35:43,358 INFO core: _init_accounts coroutine started
2026-09-28 14:35:43,360 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 14:35:43,365 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:40:33,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:45:45,284 INFO core: Event loop thread started, running loop forever
2026-09-28 14:45:45,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 14:45:45,591 INFO core: _init_accounts coroutine started
2026-09-28 14:45:45,591 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 14:45:45,604 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:50:42,764 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 14:50:42,765 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 14:50:42,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 14:55:18,209 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 14:55:18,212 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:00:17,824 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 15:00:17,835 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 15:00:17,835 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 15:00:17,839 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 15:00:17,840 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 15:00:17,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:05:13,664 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 15:05:13,665 WARNING core: Account 2: connect timed out after 35s
2026-09-28 15:05:13,666 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-28 15:05:13,668 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-28 15:05:13,670 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-28 15:05:13,671 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-28 15:05:13,671 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-28 15:05:13,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:10:16,947 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 15:10:16,948 WARNING core: Account 2: connect timed out after 35s
2026-09-28 15:10:16,949 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-28 15:10:16,949 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-28 15:10:16,950 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-28 15:10:16,951 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-28 15:10:16,951 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-28 15:10:16,959 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:15:22,416 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 15:15:22,417 WARNING core: Account 2: connect timed out after 35s
2026-09-28 15:15:31,785 INFO core: Event loop thread started, running loop forever
2026-09-28 15:15:32,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 15:15:32,094 INFO core: _init_accounts coroutine started
2026-09-28 15:15:32,094 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 15:15:32,104 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:20:38,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 15:20:46,100 INFO core: Event loop thread started, running loop forever
2026-09-28 15:20:46,402 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 15:20:46,406 INFO core: _init_accounts coroutine started
2026-09-28 15:20:46,409 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 15:20:46,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 15:20:46,417 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 15:20:46,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:25:36,372 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 15:25:36,376 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 15:25:36,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:30:30,138 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:35:25,398 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:40:12,826 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:45:18,407 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 15:45:25,708 INFO core: Event loop thread started, running loop forever
2026-09-28 15:45:26,008 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 15:45:26,012 INFO core: _init_accounts coroutine started
2026-09-28 15:45:26,015 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 15:45:26,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:50:32,875 INFO core: Event loop thread started, running loop forever
2026-09-28 15:50:33,176 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 15:50:33,178 INFO core: _init_accounts coroutine started
2026-09-28 15:50:33,181 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 15:50:33,189 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 15:55:34,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:00:41,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 16:00:41,402 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 16:00:41,402 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 16:00:41,403 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 16:00:41,404 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 16:00:41,404 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 16:00:41,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 16:00:41,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 16:00:41,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 16:00:44,824 INFO core: Event loop thread started, running loop forever
2026-09-28 16:00:45,129 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 16:00:45,133 INFO core: _init_accounts coroutine started
2026-09-28 16:00:45,136 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 16:00:45,140 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:05:48,327 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 16:05:48,334 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:10:25,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:15:30,951 INFO core: Event loop thread started, running loop forever
2026-09-28 16:15:31,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 16:15:31,259 INFO core: _init_accounts coroutine started
2026-09-28 16:15:31,259 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 16:15:31,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:20:11,458 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 16:20:11,458 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 16:20:11,460 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 16:20:11,462 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:20:11,463 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 16:25:10,177 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:30:48,648 INFO core: Event loop thread started, running loop forever
2026-09-28 16:30:48,949 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 16:30:48,953 INFO core: _init_accounts coroutine started
2026-09-28 16:30:48,954 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 16:30:48,961 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:35:17,928 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 16:35:17,929 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 16:35:17,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:40:06,578 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 16:40:06,581 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 16:40:06,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:45:12,675 INFO core: Event loop thread started, running loop forever
2026-09-28 16:45:12,977 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 16:45:12,980 INFO core: _init_accounts coroutine started
2026-09-28 16:45:12,980 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 16:45:12,991 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:50:06,940 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 16:55:12,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 16:55:12,411 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 16:55:28,811 INFO core: Event loop thread started, running loop forever
2026-09-28 16:55:29,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 16:55:29,115 INFO core: _init_accounts coroutine started
2026-09-28 16:55:29,116 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 16:55:29,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:00:45,355 INFO core: Event loop thread started, running loop forever
2026-09-28 17:00:45,656 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 17:00:45,660 INFO core: _init_accounts coroutine started
2026-09-28 17:00:45,663 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 17:00:45,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:05:10,360 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:10:16,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 17:10:16,425 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 17:10:16,425 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 17:10:16,426 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 17:10:16,426 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 17:10:16,426 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 17:10:16,426 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 17:10:16,427 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 17:10:16,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 17:10:23,706 INFO core: Event loop thread started, running loop forever
2026-09-28 17:10:24,008 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 17:10:24,013 INFO core: _init_accounts coroutine started
2026-09-28 17:10:24,013 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 17:10:24,032 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:15:22,134 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 17:15:22,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:15:22,147 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 17:20:29,444 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 17:20:38,323 INFO core: Event loop thread started, running loop forever
2026-09-28 17:20:38,624 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 17:20:38,629 INFO core: _init_accounts coroutine started
2026-09-28 17:20:38,630 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 17:20:38,635 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:25:45,434 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 17:25:49,786 INFO core: Event loop thread started, running loop forever
2026-09-28 17:25:50,087 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 17:25:50,092 INFO core: _init_accounts coroutine started
2026-09-28 17:25:50,093 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 17:25:50,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:30:09,442 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 17:30:09,460 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:35:48,117 INFO core: Event loop thread started, running loop forever
2026-09-28 17:35:48,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 17:35:48,427 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:40:44,948 INFO core: _init_accounts coroutine started
2026-09-28 17:40:44,950 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 17:40:44,955 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:45:23,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:50:17,960 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 17:50:17,960 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 17:50:17,960 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 17:55:17,537 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:00:05,441 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 18:00:05,460 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 18:00:05,460 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 18:00:05,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 18:00:05,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 18:00:39,137 INFO core: Event loop thread started, running loop forever
2026-09-28 18:00:39,438 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 18:00:39,443 INFO core: _init_accounts coroutine started
2026-09-28 18:00:39,443 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 18:00:39,447 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:05:34,984 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:10:34,008 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 18:10:34,009 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 18:10:34,035 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:15:07,394 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 18:15:07,401 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 18:15:07,406 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:20:14,418 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 18:20:14,418 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 18:20:14,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 18:20:34,042 INFO core: Event loop thread started, running loop forever
2026-09-28 18:20:34,343 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 18:20:34,347 INFO core: _init_accounts coroutine started
2026-09-28 18:20:34,348 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 18:20:34,357 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 18:20:34,358 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 18:20:34,358 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 18:20:34,360 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 18:20:34,375 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 18:20:34,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:20:34,375 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 18:25:10,754 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:30:17,412 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 18:30:41,090 INFO core: Event loop thread started, running loop forever
2026-09-28 18:30:41,400 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 18:30:41,404 INFO core: _init_accounts coroutine started
2026-09-28 18:30:41,405 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 18:30:41,411 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:35:10,224 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:40:47,210 INFO core: Event loop thread started, running loop forever
2026-09-28 18:40:47,511 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 18:40:47,514 INFO core: _init_accounts coroutine started
2026-09-28 18:40:47,516 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 18:40:47,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:45:49,568 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 18:45:49,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:50:35,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 18:55:51,941 INFO core: Event loop thread started, running loop forever
2026-09-28 18:55:52,242 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 18:55:52,245 INFO core: _init_accounts coroutine started
2026-09-28 18:55:52,245 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 18:55:52,259 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:00:25,591 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:05:32,423 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 19:05:32,424 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 19:05:32,424 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-28 19:05:32,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 19:05:32,425 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 19:05:32,426 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 19:05:32,426 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 19:05:32,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 19:05:32,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 19:05:36,950 INFO core: Event loop thread started, running loop forever
2026-09-28 19:05:37,252 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 19:05:37,255 INFO core: _init_accounts coroutine started
2026-09-28 19:05:37,257 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 19:05:37,262 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:10:19,597 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:15:25,000 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 19:15:25,000 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 19:15:25,003 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 19:15:25,020 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 19:15:25,027 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:20:06,179 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:25:12,974 INFO core: Event loop thread started, running loop forever
2026-09-28 19:25:13,275 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 19:25:13,279 INFO core: _init_accounts coroutine started
2026-09-28 19:25:13,281 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 19:25:13,295 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:30:20,404 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 19:30:21,474 INFO core: Event loop thread started, running loop forever
2026-09-28 19:30:21,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 19:30:21,785 INFO core: _init_accounts coroutine started
2026-09-28 19:30:21,785 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 19:30:21,793 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:35:28,444 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 19:35:45,035 INFO core: Event loop thread started, running loop forever
2026-09-28 19:35:45,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 19:35:45,348 INFO core: _init_accounts coroutine started
2026-09-28 19:35:45,348 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 19:35:45,352 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:40:25,132 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:40:25,132 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 19:40:25,133 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 19:45:32,408 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 19:45:32,409 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-28 19:45:32,410 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 19:45:32,410 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 19:45:32,410 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 19:45:32,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 19:45:33,222 INFO core: Event loop thread started, running loop forever
2026-09-28 19:45:33,523 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 19:45:33,526 INFO core: _init_accounts coroutine started
2026-09-28 19:45:33,527 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 19:45:33,536 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:45:33,537 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 19:45:33,538 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 19:50:32,766 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 19:50:32,767 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 19:50:32,778 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 19:50:32,778 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 19:50:32,783 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 19:50:32,784 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 19:50:32,790 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 19:55:03,050 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 19:55:03,052 WARNING core: Account 2: connect timed out after 35s
2026-09-28 19:55:03,053 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-28 19:55:03,053 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-28 19:55:03,054 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-28 19:55:03,055 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-28 19:55:03,055 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-28 19:55:03,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:00:10,408 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 20:00:39,361 INFO core: Event loop thread started, running loop forever
2026-09-28 20:00:39,662 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 20:00:39,666 INFO core: _init_accounts coroutine started
2026-09-28 20:00:39,667 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 20:00:39,673 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:05:21,351 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 20:05:21,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:10:50,121 INFO core: Event loop thread started, running loop forever
2026-09-28 20:10:50,422 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 20:10:50,427 INFO core: _init_accounts coroutine started
2026-09-28 20:10:50,427 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 20:10:50,432 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:15:48,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:20:09,239 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:20:09,241 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 20:25:10,305 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 20:25:10,310 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 20:25:10,310 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:30:17,392 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 20:30:30,436 INFO core: Event loop thread started, running loop forever
2026-09-28 20:30:30,737 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 20:30:30,741 INFO core: _init_accounts coroutine started
2026-09-28 20:30:30,742 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 20:30:30,756 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 20:30:30,756 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 20:30:30,763 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:30:30,764 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 20:35:37,524 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 20:35:37,525 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-28 20:35:37,525 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 20:35:37,525 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 20:35:49,416 INFO core: Event loop thread started, running loop forever
2026-09-28 20:35:49,717 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 20:35:49,723 INFO core: _init_accounts coroutine started
2026-09-28 20:35:49,723 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 20:35:49,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:40:39,877 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:45:41,788 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 20:45:41,796 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:50:42,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 20:55:48,958 INFO core: Event loop thread started, running loop forever
2026-09-28 20:55:49,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 20:55:49,264 INFO core: _init_accounts coroutine started
2026-09-28 20:55:49,267 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 20:55:49,273 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:00:50,133 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 21:00:50,133 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 21:00:50,135 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 21:00:50,136 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 21:00:50,145 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:05:10,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 21:05:10,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 21:05:10,442 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-28 21:05:10,444 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-28 21:05:10,451 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:10:17,399 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-28 21:10:17,400 WARNING core: Account 2: connect timed out after 35s
2026-09-28 21:10:17,401 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-28 21:10:17,401 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-28 21:10:17,402 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-28 21:10:17,403 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-28 21:10:17,403 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-28 21:10:38,116 INFO core: Event loop thread started, running loop forever
2026-09-28 21:10:38,418 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 21:10:38,427 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:15:06,284 INFO core: _init_accounts coroutine started
2026-09-28 21:15:06,284 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 21:15:06,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:20:13,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 21:20:45,478 INFO core: Event loop thread started, running loop forever
2026-09-28 21:20:45,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 21:20:45,786 INFO core: _init_accounts coroutine started
2026-09-28 21:20:45,787 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 21:20:45,791 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:25:52,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 21:25:52,976 INFO core: Event loop thread started, running loop forever
2026-09-28 21:25:53,277 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 21:25:53,282 INFO core: _init_accounts coroutine started
2026-09-28 21:25:53,284 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 21:25:53,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:30:48,875 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:35:07,663 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 21:35:07,664 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 21:35:07,671 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 21:35:07,675 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 21:35:07,681 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:40:13,519 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 21:40:13,519 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 21:40:13,520 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 21:40:25,402 INFO core: Event loop thread started, running loop forever
2026-09-28 21:40:25,703 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 21:40:25,707 INFO core: _init_accounts coroutine started
2026-09-28 21:40:25,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:40:25,730 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 21:45:32,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 21:45:53,263 INFO core: Event loop thread started, running loop forever
2026-09-28 21:45:53,564 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 21:45:53,568 INFO core: _init_accounts coroutine started
2026-09-28 21:45:53,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 21:45:53,575 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:50:06,168 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 21:50:06,169 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 21:50:06,172 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 21:50:06,173 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 21:50:06,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 21:55:46,731 INFO core: Event loop thread started, running loop forever
2026-09-28 21:55:47,033 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 21:55:47,037 INFO core: _init_accounts coroutine started
2026-09-28 21:55:47,039 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 21:55:47,048 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:00:32,623 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 22:00:32,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:05:04,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:10:15,026 INFO core: Event loop thread started, running loop forever
2026-09-28 22:10:15,327 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 22:10:15,332 INFO core: _init_accounts coroutine started
2026-09-28 22:10:15,337 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 22:10:15,338 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:15:09,702 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:20:15,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 22:20:35,410 INFO core: Event loop thread started, running loop forever
2026-09-28 22:20:35,711 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 22:20:35,714 INFO core: _init_accounts coroutine started
2026-09-28 22:20:35,715 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 22:20:35,722 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:25:42,440 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 22:25:51,426 INFO core: Event loop thread started, running loop forever
2026-09-28 22:25:51,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 22:25:51,731 INFO core: _init_accounts coroutine started
2026-09-28 22:25:51,733 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 22:25:51,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:30:39,414 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 22:30:39,414 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 22:30:39,415 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 22:30:39,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 22:30:39,431 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:30:39,432 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 22:30:39,432 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 22:35:18,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:40:24,416 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 562, in get_account_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 22:40:39,689 INFO core: Event loop thread started, running loop forever
2026-09-28 22:40:39,991 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 22:40:39,994 INFO core: _init_accounts coroutine started
2026-09-28 22:40:39,996 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 22:40:40,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:45:51,579 INFO core: Event loop thread started, running loop forever
2026-09-28 22:45:51,881 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 22:45:51,884 INFO core: _init_accounts coroutine started
2026-09-28 22:45:51,885 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 22:45:51,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:50:52,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 22:55:29,105 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 22:55:29,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 22:55:29,113 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 22:55:29,115 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 22:55:29,117 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:00:21,729 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:05:04,576 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:10:11,494 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 23:10:11,495 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 23:10:11,495 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-28 23:10:34,175 INFO core: Event loop thread started, running loop forever
2026-09-28 23:10:34,476 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 23:10:34,480 INFO core: _init_accounts coroutine started
2026-09-28 23:10:34,482 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 23:10:34,487 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:15:38,311 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:15:38,316 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 23:20:07,053 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 23:20:07,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:25:31,789 INFO core: Event loop thread started, running loop forever
2026-09-28 23:25:32,090 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 23:25:32,093 INFO core: _init_accounts coroutine started
2026-09-28 23:25:32,094 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 23:25:32,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:30:05,180 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-28 23:30:05,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:35:22,157 INFO core: Event loop thread started, running loop forever
2026-09-28 23:35:22,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 23:35:22,462 INFO core: _init_accounts coroutine started
2026-09-28 23:35:22,465 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 23:35:22,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:40:23,943 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 23:40:23,944 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-28 23:40:23,946 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-28 23:40:23,951 INFO core: _init_accounts_inner: reloading LLM config
2026-09-28 23:40:23,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:45:29,456 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-28 23:45:29,457 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-28 23:45:31,779 INFO core: Event loop thread started, running loop forever
2026-09-28 23:45:32,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 23:45:32,085 INFO core: _init_accounts coroutine started
2026-09-28 23:45:32,085 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 23:45:32,092 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:50:25,346 INFO core: status() clients=0 connected=False forwarding=False
2026-09-28 23:55:32,288 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-28 23:55:32,294 INFO core: Event loop thread started, running loop forever
2026-09-28 23:55:32,595 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-28 23:55:32,598 INFO core: _init_accounts coroutine started
2026-09-28 23:55:32,600 INFO core: _init_accounts_inner: starting DB migrations
2026-09-28 23:55:32,615 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:00:07,386 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-29 00:00:37,768 INFO core: Event loop thread started, running loop forever
2026-09-29 00:00:38,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 00:00:38,072 INFO core: _init_accounts coroutine started
2026-09-29 00:00:38,073 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 00:00:38,077 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:05:44,488 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 00:05:47,745 INFO core: Event loop thread started, running loop forever
2026-09-29 00:05:48,045 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 00:05:48,052 INFO core: _init_accounts coroutine started
2026-09-29 00:05:48,055 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 00:05:48,083 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:10:33,824 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 00:10:33,825 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 00:10:33,832 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 00:10:33,833 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:15:06,241 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 00:15:06,283 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:20:48,703 INFO core: Event loop thread started, running loop forever
2026-09-29 00:20:49,004 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 00:20:49,014 INFO core: _init_accounts coroutine started
2026-09-29 00:20:49,014 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 00:20:49,028 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:25:40,050 INFO core: Event loop thread started, running loop forever
2026-09-29 00:25:40,352 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 00:25:40,355 INFO core: _init_accounts coroutine started
2026-09-29 00:25:40,356 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 00:25:40,365 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:30:49,143 INFO core: Event loop thread started, running loop forever
2026-09-29 00:30:49,444 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 00:30:49,449 INFO core: _init_accounts coroutine started
2026-09-29 00:30:49,450 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 00:30:49,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:35:42,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:40:08,463 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 00:40:08,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:45:04,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:50:24,814 INFO core: Event loop thread started, running loop forever
2026-09-29 00:50:25,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 00:50:25,118 INFO core: _init_accounts coroutine started
2026-09-29 00:50:25,121 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 00:50:25,130 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 00:55:31,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 00:55:33,757 INFO core: Event loop thread started, running loop forever
2026-09-29 00:55:34,059 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 00:55:34,063 INFO core: _init_accounts coroutine started
2026-09-29 00:55:34,066 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 00:55:34,069 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:00:06,282 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:05:05,853 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 01:05:05,870 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:10:06,444 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:15:44,530 INFO core: Event loop thread started, running loop forever
2026-09-29 01:15:44,831 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 01:15:44,835 INFO core: _init_accounts coroutine started
2026-09-29 01:15:44,837 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 01:15:44,844 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:20:21,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:25:27,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 01:25:43,715 INFO core: Event loop thread started, running loop forever
2026-09-29 01:25:44,017 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 01:25:44,027 INFO core: _init_accounts coroutine started
2026-09-29 01:25:44,027 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 01:25:44,028 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:30:19,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 01:30:19,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 01:30:19,385 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 01:30:19,387 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:35:26,478 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 01:35:26,478 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-29 01:35:26,479 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 01:35:26,479 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 01:35:48,283 INFO core: Event loop thread started, running loop forever
2026-09-29 01:35:48,584 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 01:35:48,591 INFO core: _init_accounts coroutine started
2026-09-29 01:35:48,594 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 01:35:48,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:40:29,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:45:48,542 INFO core: Event loop thread started, running loop forever
2026-09-29 01:45:48,843 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 01:45:48,852 INFO core: _init_accounts coroutine started
2026-09-29 01:45:48,853 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 01:45:48,857 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:50:19,789 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 01:50:19,805 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 01:55:16,746 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:00:30,444 INFO core: Event loop thread started, running loop forever
2026-09-29 02:00:30,746 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 02:00:30,752 INFO core: _init_accounts coroutine started
2026-09-29 02:00:30,753 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 02:00:30,781 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:05:21,826 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:10:06,911 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:15:05,417 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 02:15:05,418 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 02:15:05,466 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 02:15:05,467 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 02:15:05,478 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 02:15:42,806 INFO core: Event loop thread started, running loop forever
2026-09-29 02:15:43,107 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 02:15:43,112 INFO core: _init_accounts coroutine started
2026-09-29 02:15:43,112 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 02:15:43,129 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:20:28,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:25:14,586 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 02:25:14,589 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 02:25:14,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:30:21,461 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 02:30:23,923 INFO core: Event loop thread started, running loop forever
2026-09-29 02:30:24,224 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 02:30:24,239 INFO core: _init_accounts coroutine started
2026-09-29 02:30:24,239 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 02:30:24,268 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 02:30:24,268 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 02:30:24,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:35:26,362 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:40:15,720 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 02:40:15,726 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:40:15,729 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 02:45:21,477 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 02:45:21,478 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 02:45:21,478 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 02:45:26,647 INFO core: Event loop thread started, running loop forever
2026-09-29 02:45:26,948 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 02:45:26,953 INFO core: _init_accounts coroutine started
2026-09-29 02:45:26,954 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 02:45:26,965 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:50:19,901 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 02:50:19,933 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 02:55:16,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:00:33,013 INFO core: Event loop thread started, running loop forever
2026-09-29 03:00:33,315 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 03:00:33,326 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:05:10,723 INFO core: _init_accounts coroutine started
2026-09-29 03:05:10,724 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 03:05:10,736 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:10:16,914 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 03:10:47,528 INFO core: Event loop thread started, running loop forever
2026-09-29 03:10:47,829 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 03:10:47,832 INFO core: _init_accounts coroutine started
2026-09-29 03:10:47,834 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 03:10:47,841 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:15:14,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:20:20,452 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 03:20:45,800 INFO core: Event loop thread started, running loop forever
2026-09-29 03:20:46,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 03:20:46,109 INFO core: _init_accounts coroutine started
2026-09-29 03:20:46,109 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 03:20:46,122 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 03:20:46,122 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 03:20:46,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:25:04,124 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 03:25:04,149 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:25:04,150 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 03:30:49,935 INFO core: Event loop thread started, running loop forever
2026-09-29 03:30:50,236 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 03:30:50,239 INFO core: _init_accounts coroutine started
2026-09-29 03:30:50,241 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 03:30:50,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:35:32,446 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 03:35:32,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:40:50,896 INFO core: Event loop thread started, running loop forever
2026-09-29 03:40:51,197 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 03:40:51,205 INFO core: _init_accounts coroutine started
2026-09-29 03:40:51,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 03:40:51,208 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:45:41,971 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:50:35,807 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 03:50:35,808 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 03:50:35,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:55:16,539 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 03:55:16,545 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 03:55:16,562 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 03:55:16,563 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 03:55:16,563 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 04:00:17,857 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 04:00:17,859 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 04:00:17,882 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:05:05,452 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 04:05:05,452 WARNING core: Account 2: connect timed out after 35s
2026-09-29 04:05:05,453 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 04:05:05,453 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 04:05:05,454 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 04:05:05,454 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 04:05:05,455 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 04:05:05,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:10:12,547 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 04:10:12,550 WARNING core: Account 2: connect timed out after 35s
2026-09-29 04:10:12,551 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-29 04:10:12,552 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-29 04:10:12,552 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 04:10:13,984 INFO core: Event loop thread started, running loop forever
2026-09-29 04:10:14,286 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 04:10:14,302 INFO core: _init_accounts coroutine started
2026-09-29 04:10:14,302 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 04:10:14,313 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:15:43,743 INFO core: Event loop thread started, running loop forever
2026-09-29 04:15:44,045 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 04:15:44,051 INFO core: _init_accounts coroutine started
2026-09-29 04:15:44,051 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 04:15:44,065 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:20:34,410 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 04:20:34,422 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:25:16,778 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:30:13,163 INFO core: Event loop thread started, running loop forever
2026-09-29 04:30:13,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 04:30:13,471 INFO core: _init_accounts coroutine started
2026-09-29 04:30:13,472 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 04:30:13,476 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:35:12,261 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 04:35:12,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:40:27,918 INFO core: Event loop thread started, running loop forever
2026-09-29 04:40:28,219 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 04:40:28,224 INFO core: _init_accounts coroutine started
2026-09-29 04:40:28,226 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 04:40:28,232 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:45:31,919 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 04:45:31,920 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 04:45:31,921 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:50:48,305 INFO core: Event loop thread started, running loop forever
2026-09-29 04:50:48,606 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 04:50:48,609 INFO core: _init_accounts coroutine started
2026-09-29 04:50:48,611 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 04:50:48,617 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:55:11,303 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 04:55:11,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 04:55:11,305 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 05:00:19,377 INFO core: Event loop thread started, running loop forever
2026-09-29 05:00:19,678 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 05:00:19,686 INFO core: _init_accounts coroutine started
2026-09-29 05:00:19,687 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 05:00:19,722 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 05:00:19,723 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 05:00:19,724 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 05:00:19,725 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 05:00:19,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:05:04,712 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:10:10,437 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 05:10:10,437 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 05:10:10,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 05:10:27,671 INFO core: Event loop thread started, running loop forever
2026-09-29 05:10:27,973 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 05:10:27,977 INFO core: _init_accounts coroutine started
2026-09-29 05:10:27,978 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 05:10:27,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:15:24,834 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:20:12,917 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 05:20:12,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:25:50,293 INFO core: Event loop thread started, running loop forever
2026-09-29 05:25:50,594 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 05:25:50,598 INFO core: _init_accounts coroutine started
2026-09-29 05:25:50,600 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 05:25:50,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:30:52,532 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 05:30:52,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:35:43,312 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:40:19,253 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-29 05:40:19,255 INFO core: _init_accounts coroutine started
2026-09-29 05:40:19,256 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 05:40:19,260 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:45:26,469 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 05:45:42,520 INFO core: Event loop thread started, running loop forever
2026-09-29 05:45:42,821 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 05:45:42,839 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:50:48,499 INFO core: _init_accounts coroutine started
2026-09-29 05:50:48,500 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 05:50:48,517 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 05:50:53,298 INFO core: Event loop thread started, running loop forever
2026-09-29 05:50:53,599 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 05:50:53,605 INFO core: _init_accounts coroutine started
2026-09-29 05:50:53,605 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 05:50:53,610 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 05:55:31,005 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:00:37,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 06:00:48,184 INFO core: Event loop thread started, running loop forever
2026-09-29 06:00:48,485 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 06:00:48,501 INFO core: _init_accounts coroutine started
2026-09-29 06:00:48,501 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 06:00:48,534 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:05:52,981 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 06:05:52,984 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:10:30,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:15:40,898 INFO core: Event loop thread started, running loop forever
2026-09-29 06:15:41,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 06:15:41,204 INFO core: _init_accounts coroutine started
2026-09-29 06:15:41,205 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 06:15:41,211 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:20:49,736 INFO core: Event loop thread started, running loop forever
2026-09-29 06:20:50,044 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 06:20:50,053 INFO core: _init_accounts coroutine started
2026-09-29 06:20:50,053 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 06:20:50,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:25:17,201 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:30:35,136 INFO core: Event loop thread started, running loop forever
2026-09-29 06:30:35,437 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 06:30:35,447 INFO core: _init_accounts coroutine started
2026-09-29 06:30:35,447 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 06:30:35,456 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:30:35,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 06:30:35,467 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 06:35:11,203 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 06:35:11,278 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 06:35:11,301 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:40:08,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:45:04,405 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 06:45:42,039 INFO core: Event loop thread started, running loop forever
2026-09-29 06:45:42,340 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 06:45:42,343 INFO core: _init_accounts coroutine started
2026-09-29 06:45:42,344 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 06:45:42,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:50:17,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 06:50:17,148 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 06:50:17,149 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 06:55:24,452 WARNING core: ensure_llm_schema failed: cannot schedule new futures after interpreter shutdown
2026-09-29 06:55:24,458 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 06:55:41,034 INFO core: Event loop thread started, running loop forever
2026-09-29 06:55:41,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 06:55:41,341 INFO core: _init_accounts coroutine started
2026-09-29 06:55:41,342 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 06:55:41,348 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:00:06,634 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:05:13,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 07:05:13,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 07:05:13,421 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-29 07:05:13,422 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 07:05:13,422 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 07:05:13,422 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 07:05:13,422 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-29 07:05:13,422 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 07:05:13,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 07:05:26,674 INFO core: Event loop thread started, running loop forever
2026-09-29 07:05:26,975 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 07:05:26,979 INFO core: _init_accounts coroutine started
2026-09-29 07:05:26,982 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 07:05:26,987 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:10:17,962 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:15:32,770 INFO core: Event loop thread started, running loop forever
2026-09-29 07:15:33,071 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 07:15:33,074 INFO core: _init_accounts coroutine started
2026-09-29 07:15:33,077 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 07:15:33,090 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:20:38,287 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 07:20:38,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:25:09,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:30:52,530 INFO core: Event loop thread started, running loop forever
2026-09-29 07:30:52,831 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 07:30:52,836 INFO core: _init_accounts coroutine started
2026-09-29 07:30:52,837 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 07:30:52,845 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:30:52,847 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 07:30:52,847 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 07:35:46,123 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 07:35:46,139 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 07:35:46,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:40:13,127 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:45:20,451 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 07:45:20,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 07:45:43,228 INFO core: Event loop thread started, running loop forever
2026-09-29 07:45:43,529 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 07:45:43,533 INFO core: _init_accounts coroutine started
2026-09-29 07:45:43,535 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 07:45:43,543 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:50:22,279 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 07:50:22,280 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 07:50:22,281 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 07:55:35,141 INFO core: Event loop thread started, running loop forever
2026-09-29 07:55:35,442 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 07:55:35,447 INFO core: _init_accounts coroutine started
2026-09-29 07:55:35,448 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 07:55:35,454 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:00:12,491 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 08:00:12,493 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 08:00:12,494 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:05:19,480 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 08:05:43,261 INFO core: Event loop thread started, running loop forever
2026-09-29 08:05:43,562 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 08:05:43,567 INFO core: _init_accounts coroutine started
2026-09-29 08:05:43,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 08:05:43,577 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:10:26,975 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 08:10:26,988 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:15:07,660 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:20:11,159 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-29 08:20:11,161 INFO core: _init_accounts coroutine started
2026-09-29 08:20:11,161 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 08:20:11,165 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:25:18,488 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 08:25:21,466 INFO core: Event loop thread started, running loop forever
2026-09-29 08:25:21,767 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 08:25:21,773 INFO core: _init_accounts coroutine started
2026-09-29 08:25:21,775 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 08:25:21,787 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:30:47,841 INFO core: Event loop thread started, running loop forever
2026-09-29 08:30:48,142 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 08:30:48,148 INFO core: _init_accounts coroutine started
2026-09-29 08:30:48,148 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 08:30:48,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:35:27,758 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 08:35:27,760 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 08:35:27,761 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 08:35:27,762 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 08:35:27,778 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 08:35:27,779 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 08:35:27,784 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 08:35:27,785 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 08:35:27,799 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:40:07,782 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 08:40:07,783 WARNING core: Account 2: connect timed out after 35s
2026-09-29 08:40:07,784 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 08:40:07,784 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 08:40:07,785 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 08:40:07,786 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 08:40:07,787 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 08:40:07,795 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:45:13,481 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 08:45:13,482 WARNING core: Account 2: connect timed out after 35s
2026-09-29 08:45:13,482 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-29 08:45:13,483 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-29 08:45:13,483 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 08:45:13,484 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-29 08:45:13,484 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-29 08:45:51,822 INFO core: Event loop thread started, running loop forever
2026-09-29 08:45:52,123 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 08:45:52,130 INFO core: _init_accounts coroutine started
2026-09-29 08:45:52,132 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 08:45:52,137 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:50:18,465 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 08:50:18,465 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 08:50:18,470 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 08:50:18,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 08:50:18,472 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 08:55:24,302 INFO core: Event loop thread started, running loop forever
2026-09-29 08:55:24,602 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 08:55:24,617 INFO core: _init_accounts coroutine started
2026-09-29 08:55:24,618 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 08:55:24,625 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-29 08:55:24,629 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-29 09:00:19,823 INFO core: Event loop thread started, running loop forever
2026-09-29 09:00:20,125 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 09:00:20,131 INFO core: _init_accounts coroutine started
2026-09-29 09:00:20,131 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 09:00:20,135 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:05:32,578 INFO core: Event loop thread started, running loop forever
2026-09-29 09:05:32,884 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 09:05:32,891 INFO core: _init_accounts coroutine started
2026-09-29 09:05:32,891 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 09:05:32,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:10:39,874 INFO core: Event loop thread started, running loop forever
2026-09-29 09:10:40,175 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 09:10:40,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:15:19,598 INFO core: _init_accounts coroutine started
2026-09-29 09:15:19,600 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 09:15:19,605 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:20:31,616 INFO core: Event loop thread started, running loop forever
2026-09-29 09:20:31,917 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 09:20:31,922 INFO core: _init_accounts coroutine started
2026-09-29 09:20:31,923 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 09:20:31,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:25:19,134 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:30:26,450 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 09:30:40,542 INFO core: Event loop thread started, running loop forever
2026-09-29 09:30:40,843 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 09:30:40,847 INFO core: _init_accounts coroutine started
2026-09-29 09:30:40,848 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 09:30:40,859 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 09:30:40,859 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 09:30:40,860 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 09:30:40,863 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 09:30:40,867 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:35:47,501 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 09:35:47,501 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 09:35:47,502 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 09:35:49,883 INFO core: Event loop thread started, running loop forever
2026-09-29 09:35:50,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 09:35:50,188 INFO core: _init_accounts coroutine started
2026-09-29 09:35:50,190 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 09:35:50,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:40:15,711 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:45:15,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:50:07,457 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 09:50:07,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 09:55:22,563 INFO core: Event loop thread started, running loop forever
2026-09-29 09:55:22,864 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 09:55:22,868 INFO core: _init_accounts coroutine started
2026-09-29 09:55:22,871 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 09:55:22,876 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:00:14,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:05:39,832 INFO core: Event loop thread started, running loop forever
2026-09-29 10:05:40,134 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 10:05:40,138 INFO core: _init_accounts coroutine started
2026-09-29 10:05:40,144 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 10:05:40,148 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:10:40,065 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 10:10:40,065 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 10:10:40,066 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:15:29,729 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 10:15:29,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:15:52,866 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 10:15:52,869 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:20:26,051 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:25:32,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 10:25:32,429 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 10:25:32,429 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 10:25:48,438 INFO core: Event loop thread started, running loop forever
2026-09-29 10:25:48,739 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 10:25:48,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:25:48,751 INFO core: _init_accounts coroutine started
2026-09-29 10:25:48,753 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 10:30:34,025 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:35:11,355 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:35:11,355 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 10:35:11,356 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 10:40:12,367 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 10:40:12,372 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:45:19,459 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 10:45:23,035 INFO core: Event loop thread started, running loop forever
2026-09-29 10:45:23,336 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 10:45:23,343 INFO core: _init_accounts coroutine started
2026-09-29 10:45:23,344 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 10:45:23,353 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 10:45:23,353 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 10:45:23,354 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 10:45:23,356 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 10:45:23,375 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 10:45:23,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 10:45:23,379 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:50:21,650 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 10:50:21,651 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 10:50:21,655 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 10:55:27,414 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 10:55:27,416 WARNING core: Account 2: connect timed out after 35s
2026-09-29 10:55:27,417 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 10:55:27,417 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 10:55:27,418 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 10:55:27,419 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 10:55:43,959 INFO core: Event loop thread started, running loop forever
2026-09-29 10:55:44,260 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 10:55:44,267 INFO core: _init_accounts coroutine started
2026-09-29 10:55:44,268 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 10:55:44,280 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:00:42,412 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 11:00:42,412 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 11:00:42,414 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:05:11,927 INFO core: Event loop thread started, running loop forever
2026-09-29 11:05:12,228 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 11:05:12,236 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:05:49,975 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 11:05:49,976 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 11:05:49,977 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 11:05:49,977 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 11:10:19,426 INFO core: _init_accounts coroutine started
2026-09-29 11:10:19,427 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 11:10:19,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 11:10:23,269 INFO core: Event loop thread started, running loop forever
2026-09-29 11:10:23,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 11:10:23,574 INFO core: _init_accounts coroutine started
2026-09-29 11:10:23,576 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 11:10:23,590 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:15:51,640 INFO core: Event loop thread started, running loop forever
2026-09-29 11:15:51,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 11:15:51,944 INFO core: _init_accounts coroutine started
2026-09-29 11:15:51,945 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 11:15:51,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:20:13,055 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 11:20:13,055 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 11:20:13,057 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 11:20:13,060 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:25:11,793 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 11:25:11,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:30:17,392 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 11:30:17,392 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 11:30:17,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 11:30:42,968 INFO core: Event loop thread started, running loop forever
2026-09-29 11:30:43,269 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 11:30:43,273 INFO core: _init_accounts coroutine started
2026-09-29 11:30:43,275 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 11:30:43,285 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 11:30:43,285 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 11:30:43,286 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 11:30:43,287 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 11:30:43,290 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:35:53,697 INFO core: Event loop thread started, running loop forever
2026-09-29 11:35:53,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 11:35:54,007 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:40:29,582 INFO core: _init_accounts coroutine started
2026-09-29 11:40:29,582 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 11:40:29,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:45:19,629 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 11:45:19,629 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 11:45:19,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:50:25,621 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 11:50:54,035 INFO core: Event loop thread started, running loop forever
2026-09-29 11:50:54,338 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 11:50:54,342 INFO core: _init_accounts coroutine started
2026-09-29 11:50:54,345 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 11:50:54,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 11:55:23,478 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 11:55:23,531 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:00:50,702 INFO core: Event loop thread started, running loop forever
2026-09-29 12:00:51,003 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 12:00:51,009 INFO core: _init_accounts coroutine started
2026-09-29 12:00:51,021 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 12:00:51,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:05:37,141 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 12:05:37,143 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:05:37,143 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 12:10:10,438 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:15:17,491 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 12:15:17,501 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 12:15:17,501 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-29 12:15:17,502 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 12:15:17,503 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 12:15:19,571 INFO core: Event loop thread started, running loop forever
2026-09-29 12:15:19,872 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 12:15:19,876 INFO core: _init_accounts coroutine started
2026-09-29 12:15:19,878 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 12:15:19,884 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:20:16,594 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 12:20:16,595 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 12:20:16,614 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:25:22,533 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 12:25:22,535 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 12:25:37,437 INFO core: Event loop thread started, running loop forever
2026-09-29 12:25:37,738 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 12:25:37,742 INFO core: _init_accounts coroutine started
2026-09-29 12:25:37,742 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 12:25:37,755 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:30:44,437 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 12:30:50,001 INFO core: Event loop thread started, running loop forever
2026-09-29 12:30:50,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 12:30:50,307 INFO core: _init_accounts coroutine started
2026-09-29 12:30:50,309 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 12:30:50,317 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:35:05,904 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 12:35:05,904 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 12:35:05,906 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 12:35:05,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:35:05,909 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 12:40:12,523 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 12:40:43,270 INFO core: Event loop thread started, running loop forever
2026-09-29 12:40:43,572 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 12:40:43,575 INFO core: _init_accounts coroutine started
2026-09-29 12:40:43,575 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 12:40:43,588 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:45:50,472 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 12:45:51,359 INFO core: Event loop thread started, running loop forever
2026-09-29 12:45:51,661 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 12:45:51,670 INFO core: _init_accounts coroutine started
2026-09-29 12:45:51,670 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 12:45:51,675 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:50:49,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 12:55:24,553 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:00:30,420 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 13:00:30,429 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 13:00:30,563 INFO core: Event loop thread started, running loop forever
2026-09-29 13:00:30,871 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:00:30,878 INFO core: _init_accounts coroutine started
2026-09-29 13:00:30,879 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 13:00:30,886 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:00:30,891 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-29 13:05:22,184 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-29 13:10:43,066 INFO core: Event loop thread started, running loop forever
2026-09-29 13:10:43,367 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:10:43,371 INFO core: _init_accounts coroutine started
2026-09-29 13:10:43,373 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 13:10:43,378 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:15:50,408 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 13:15:52,421 INFO core: Event loop thread started, running loop forever
2026-09-29 13:15:52,722 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:15:52,728 INFO core: _init_accounts coroutine started
2026-09-29 13:15:52,729 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 13:15:52,732 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:20:34,247 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:25:40,488 INFO core: Event loop thread started, running loop forever
2026-09-29 13:25:40,790 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:25:40,797 INFO core: _init_accounts coroutine started
2026-09-29 13:25:40,798 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 13:25:40,820 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-29 13:25:40,853 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-29 13:30:29,312 INFO core: Event loop thread started, running loop forever
2026-09-29 13:30:29,613 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:30:29,616 INFO core: _init_accounts coroutine started
2026-09-29 13:30:29,616 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 13:30:29,625 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 13:30:29,625 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 13:30:29,627 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 13:30:29,627 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:30:29,630 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 13:35:07,697 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 13:35:07,697 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 13:35:07,702 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 13:35:07,703 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 13:35:07,767 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:40:13,476 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 13:40:13,477 WARNING core: Account 2: connect timed out after 35s
2026-09-29 13:40:13,478 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 13:40:13,478 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 13:40:13,480 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 13:40:13,481 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 13:40:13,482 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 13:40:20,234 INFO core: Event loop thread started, running loop forever
2026-09-29 13:40:20,542 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:40:20,553 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:45:27,468 INFO core: _init_accounts coroutine started
2026-09-29 13:45:53,167 INFO core: Event loop thread started, running loop forever
2026-09-29 13:45:53,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:45:53,483 INFO core: _init_accounts coroutine started
2026-09-29 13:45:53,483 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 13:45:53,499 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 13:45:53,499 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 13:45:53,501 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 13:45:53,504 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:50:16,920 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 13:50:16,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 13:55:22,427 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 13:55:29,975 INFO core: Event loop thread started, running loop forever
2026-09-29 13:55:30,276 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 13:55:30,281 INFO core: _init_accounts coroutine started
2026-09-29 13:55:30,282 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 13:55:30,286 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:00:35,950 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 14:00:35,950 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 14:00:35,954 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 14:00:35,957 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 14:00:35,977 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:05:46,100 INFO core: Event loop thread started, running loop forever
2026-09-29 14:05:46,401 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 14:05:46,404 INFO core: _init_accounts coroutine started
2026-09-29 14:05:46,407 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 14:05:46,413 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:10:23,457 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 14:10:23,457 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 14:10:23,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 14:10:23,461 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:12:45,584 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 14:12:45,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:15:49,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:15:49,811 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 14:20:25,296 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 14:20:25,325 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 14:20:25,326 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 14:20:25,330 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:25:16,082 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 14:25:16,083 WARNING core: Account 2: connect timed out after 35s
2026-09-29 14:25:16,084 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 14:25:16,085 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 14:25:16,086 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 14:25:16,086 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 14:25:16,087 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 14:25:16,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:30:22,417 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 14:30:22,418 WARNING core: Account 2: connect timed out after 35s
2026-09-29 14:30:22,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-29 14:30:22,419 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-29 14:30:22,420 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 14:30:22,421 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-29 14:30:22,422 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-29 14:30:46,079 INFO core: Event loop thread started, running loop forever
2026-09-29 14:30:46,380 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 14:30:46,388 INFO core: _init_accounts coroutine started
2026-09-29 14:30:46,399 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 14:30:46,437 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 14:30:46,437 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 14:30:46,445 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:30:46,449 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 14:30:46,451 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 14:35:42,168 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:40:49,502 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 14:40:52,251 INFO core: Event loop thread started, running loop forever
2026-09-29 14:40:52,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 14:40:52,565 INFO core: _init_accounts coroutine started
2026-09-29 14:40:52,565 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 14:40:52,580 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:45:49,019 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:50:30,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:55:37,467 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 14:55:53,313 INFO core: Event loop thread started, running loop forever
2026-09-29 14:55:53,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 14:55:53,620 INFO core: _init_accounts coroutine started
2026-09-29 14:55:53,620 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 14:55:53,628 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 14:55:53,628 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 14:55:53,629 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 14:55:53,632 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 15:00:10,185 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 15:00:10,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:05:50,698 INFO core: Event loop thread started, running loop forever
2026-09-29 15:05:50,998 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 15:05:51,002 INFO core: _init_accounts coroutine started
2026-09-29 15:05:51,004 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 15:05:51,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:10:11,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:15:17,468 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 15:15:47,719 INFO core: Event loop thread started, running loop forever
2026-09-29 15:15:48,020 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 15:15:48,024 INFO core: _init_accounts coroutine started
2026-09-29 15:15:48,024 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 15:15:48,049 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:20:07,355 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 15:20:07,368 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:25:28,660 INFO core: Event loop thread started, running loop forever
2026-09-29 15:25:28,961 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 15:25:28,967 INFO core: _init_accounts coroutine started
2026-09-29 15:25:28,969 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 15:25:28,975 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:30:53,671 INFO core: Event loop thread started, running loop forever
2026-09-29 15:30:53,972 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 15:30:53,980 INFO core: _init_accounts coroutine started
2026-09-29 15:30:53,980 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 15:30:53,986 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:35:37,178 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 15:35:37,194 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:40:48,866 INFO core: Event loop thread started, running loop forever
2026-09-29 15:40:49,167 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 15:40:49,177 INFO core: _init_accounts coroutine started
2026-09-29 15:40:49,179 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 15:40:49,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:45:22,457 INFO core: Event loop thread started, running loop forever
2026-09-29 15:45:22,768 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 15:45:22,776 INFO core: _init_accounts coroutine started
2026-09-29 15:45:22,777 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 15:45:22,780 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:50:17,595 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 15:55:23,467 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 15:55:23,469 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 15:55:30,234 INFO core: Event loop thread started, running loop forever
2026-09-29 15:55:30,548 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 15:55:30,554 INFO core: _init_accounts coroutine started
2026-09-29 15:55:30,554 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 15:55:30,561 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:00:32,862 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:05:38,412 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 16:05:39,160 INFO core: Event loop thread started, running loop forever
2026-09-29 16:05:39,461 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 16:05:39,465 INFO core: _init_accounts coroutine started
2026-09-29 16:05:39,466 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 16:05:39,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:10:46,418 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 16:10:48,920 INFO core: Event loop thread started, running loop forever
2026-09-29 16:10:49,220 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 16:10:49,223 INFO core: _init_accounts coroutine started
2026-09-29 16:10:49,224 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 16:10:49,230 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:15:21,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:20:10,518 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:25:17,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 16:25:28,314 INFO core: Event loop thread started, running loop forever
2026-09-29 16:25:28,615 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 16:25:28,621 INFO core: _init_accounts coroutine started
2026-09-29 16:25:28,621 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 16:25:28,630 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:30:15,036 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:35:21,726 INFO core: Event loop thread started, running loop forever
2026-09-29 16:35:22,027 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 16:35:22,033 INFO core: _init_accounts coroutine started
2026-09-29 16:35:22,033 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 16:35:22,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:40:13,400 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 16:40:13,400 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 16:40:13,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 16:40:13,405 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 16:40:13,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:45:17,168 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 16:45:17,169 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 16:45:17,176 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 16:45:17,177 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 16:45:17,183 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:50:10,232 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 16:50:10,233 WARNING core: Account 2: connect timed out after 35s
2026-09-29 16:50:10,234 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 16:50:10,234 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 16:50:10,235 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 16:50:10,236 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 16:50:10,237 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 16:50:10,248 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 16:55:17,534 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 16:55:17,534 WARNING core: Account 2: connect timed out after 35s
2026-09-29 16:55:17,535 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-29 16:55:17,535 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-29 16:55:17,535 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 16:55:17,536 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-29 16:55:17,536 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-29 16:55:33,180 INFO core: Event loop thread started, running loop forever
2026-09-29 16:55:33,481 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 16:55:33,485 INFO core: _init_accounts coroutine started
2026-09-29 16:55:33,487 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 16:55:33,492 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:00:38,059 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:05:34,779 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 17:05:34,780 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 17:05:34,783 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 17:05:34,784 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:10:08,432 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 17:10:08,442 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:15:09,909 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:20:47,286 INFO core: Event loop thread started, running loop forever
2026-09-29 17:20:47,588 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 17:20:47,592 INFO core: _init_accounts coroutine started
2026-09-29 17:20:47,594 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 17:20:47,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:25:16,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:30:22,416 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 17:30:49,480 INFO core: Event loop thread started, running loop forever
2026-09-29 17:30:49,781 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 17:30:49,787 INFO core: _init_accounts coroutine started
2026-09-29 17:30:49,788 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 17:30:49,806 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 17:30:49,806 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 17:30:49,806 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:30:49,808 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 17:35:04,166 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 17:35:04,211 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 17:35:04,211 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 17:35:04,229 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 17:35:04,230 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 17:35:04,232 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:40:10,470 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 17:40:10,470 WARNING core: Account 2: connect timed out after 35s
2026-09-29 17:40:10,471 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 17:40:10,471 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 17:40:10,471 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 17:40:10,472 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 17:40:10,472 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 17:40:52,792 INFO core: Event loop thread started, running loop forever
2026-09-29 17:40:53,093 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 17:40:53,107 INFO core: _init_accounts coroutine started
2026-09-29 17:40:53,107 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 17:40:53,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:45:07,721 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 17:45:07,728 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:50:29,561 INFO core: Event loop thread started, running loop forever
2026-09-29 17:50:29,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 17:50:29,866 INFO core: _init_accounts coroutine started
2026-09-29 17:50:29,867 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 17:50:29,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:55:09,561 INFO core: Event loop thread started, running loop forever
2026-09-29 17:55:09,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 17:55:09,869 INFO core: _init_accounts coroutine started
2026-09-29 17:55:09,870 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 17:55:09,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 17:55:36,595 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 18:00:16,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 18:00:40,559 INFO core: Event loop thread started, running loop forever
2026-09-29 18:00:40,860 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 18:00:40,866 INFO core: _init_accounts coroutine started
2026-09-29 18:00:40,867 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 18:00:40,873 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:05:19,899 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:10:24,813 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 18:10:24,821 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:15:06,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:20:04,879 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-29 18:20:04,881 INFO core: _init_accounts coroutine started
2026-09-29 18:20:04,881 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 18:20:04,890 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 18:20:04,890 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 18:20:04,897 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 18:20:04,900 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 18:20:04,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:25:10,408 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 18:25:24,183 INFO core: Event loop thread started, running loop forever
2026-09-29 18:25:24,484 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 18:25:24,488 INFO core: _init_accounts coroutine started
2026-09-29 18:25:24,490 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 18:25:24,495 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:30:50,421 INFO core: Event loop thread started, running loop forever
2026-09-29 18:30:50,724 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 18:30:50,738 INFO core: _init_accounts coroutine started
2026-09-29 18:30:50,742 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 18:30:50,738 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:35:29,434 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:40:39,172 INFO core: Event loop thread started, running loop forever
2026-09-29 18:40:39,475 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 18:40:39,478 INFO core: _init_accounts coroutine started
2026-09-29 18:40:39,481 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 18:40:39,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:45:30,776 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:50:23,361 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 18:55:30,469 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 18:55:30,469 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 18:55:30,469 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-29 18:55:30,470 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 18:55:30,470 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 18:55:30,470 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 18:55:30,470 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-29 18:55:30,470 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 18:55:30,471 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 18:55:36,112 INFO core: Event loop thread started, running loop forever
2026-09-29 18:55:36,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 18:55:36,416 INFO core: _init_accounts coroutine started
2026-09-29 18:55:36,417 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 18:55:36,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:00:09,745 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:05:16,505 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 19:05:16,506 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 19:05:16,506 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-29 19:05:16,507 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 19:05:16,507 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 19:05:16,507 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 19:05:16,507 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-29 19:05:16,507 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 19:05:16,508 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 19:05:41,617 INFO core: Event loop thread started, running loop forever
2026-09-29 19:05:41,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 19:05:41,925 INFO core: _init_accounts coroutine started
2026-09-29 19:05:41,925 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 19:05:41,932 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:10:13,332 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:15:15,549 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 19:15:15,550 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 19:15:15,564 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:20:33,840 INFO core: Event loop thread started, running loop forever
2026-09-29 19:20:34,147 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 19:20:34,163 INFO core: _init_accounts coroutine started
2026-09-29 19:20:34,163 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 19:20:34,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:25:40,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 19:25:43,679 INFO core: Event loop thread started, running loop forever
2026-09-29 19:25:43,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 19:25:43,986 INFO core: _init_accounts coroutine started
2026-09-29 19:25:43,987 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 19:25:43,993 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:30:09,043 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:35:16,400 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 19:35:16,400 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 19:35:16,400 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-29 19:35:16,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 19:35:16,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 19:35:16,401 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 19:35:16,401 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-29 19:35:47,043 INFO core: Event loop thread started, running loop forever
2026-09-29 19:35:47,344 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 19:35:47,352 INFO core: _init_accounts coroutine started
2026-09-29 19:35:47,353 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 19:35:47,356 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:40:10,616 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 19:40:10,617 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 19:40:10,618 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 19:40:10,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:45:21,324 INFO core: Event loop thread started, running loop forever
2026-09-29 19:45:21,625 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 19:45:21,630 INFO core: _init_accounts coroutine started
2026-09-29 19:45:21,630 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 19:45:21,637 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:50:28,409 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 19:50:43,767 INFO core: Event loop thread started, running loop forever
2026-09-29 19:50:44,069 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 19:50:44,072 INFO core: _init_accounts coroutine started
2026-09-29 19:50:44,072 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 19:50:44,081 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:55:26,260 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 19:55:26,261 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 19:55:26,261 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 20:00:33,413 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 20:00:41,845 INFO core: Event loop thread started, running loop forever
2026-09-29 20:00:42,149 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 20:00:42,158 INFO core: _init_accounts coroutine started
2026-09-29 20:00:42,159 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 20:00:42,163 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:05:48,496 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 20:05:48,812 INFO core: Event loop thread started, running loop forever
2026-09-29 20:05:49,113 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 20:05:49,121 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:10:45,117 INFO core: _init_accounts coroutine started
2026-09-29 20:10:45,118 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 20:10:45,123 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 20:10:45,124 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 20:10:45,125 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 20:10:45,125 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 20:10:45,136 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:15:51,943 INFO core: Event loop thread started, running loop forever
2026-09-29 20:15:52,247 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 20:15:52,252 INFO core: _init_accounts coroutine started
2026-09-29 20:15:52,254 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 20:15:52,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:20:46,735 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
2026-09-29 20:20:46,744 INFO core: status() clients=0 connected=False forwarding=False
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-29 20:25:32,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:30:12,321 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-29 20:30:12,322 INFO core: _init_accounts coroutine started
2026-09-29 20:30:12,322 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 20:30:12,343 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:35:19,400 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 20:35:22,958 INFO core: Event loop thread started, running loop forever
2026-09-29 20:35:23,259 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 20:35:23,265 INFO core: _init_accounts coroutine started
2026-09-29 20:35:23,266 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 20:35:23,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:40:36,991 INFO core: Event loop thread started, running loop forever
2026-09-29 20:40:37,293 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 20:40:37,297 INFO core: _init_accounts coroutine started
2026-09-29 20:40:37,301 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 20:40:37,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:45:04,374 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 20:45:41,932 INFO core: Event loop thread started, running loop forever
2026-09-29 20:45:42,233 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 20:45:42,237 INFO core: _init_accounts coroutine started
2026-09-29 20:45:42,237 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 20:45:42,243 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:50:39,375 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 20:50:39,375 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 20:50:39,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 20:50:39,380 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 20:50:39,388 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 20:55:15,547 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:00:14,917 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:05:20,492 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 21:05:33,829 INFO core: Event loop thread started, running loop forever
2026-09-29 21:05:34,132 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 21:05:34,135 INFO core: _init_accounts coroutine started
2026-09-29 21:05:34,136 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 21:05:34,146 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 21:05:34,147 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 21:05:34,150 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 21:05:34,151 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 21:05:34,154 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:10:22,692 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 21:10:22,692 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 21:10:22,695 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:10:22,699 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 21:10:22,700 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 21:15:08,946 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 21:15:08,946 WARNING core: Account 2: connect timed out after 35s
2026-09-29 21:15:08,947 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 21:15:08,947 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 21:15:08,948 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 21:15:08,950 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 21:15:08,950 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 21:15:08,966 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:20:15,415 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 21:20:15,416 WARNING core: Account 2: connect timed out after 35s
2026-09-29 21:20:15,416 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-29 21:20:15,416 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-29 21:20:15,417 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 21:20:15,418 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-29 21:20:15,418 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-29 21:20:33,615 INFO core: Event loop thread started, running loop forever
2026-09-29 21:20:33,925 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 21:20:33,932 INFO core: _init_accounts coroutine started
2026-09-29 21:20:33,933 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 21:20:33,958 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:25:52,658 INFO core: Event loop thread started, running loop forever
2026-09-29 21:25:52,959 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 21:25:52,964 INFO core: _init_accounts coroutine started
2026-09-29 21:25:52,965 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 21:25:52,986 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 21:25:52,986 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 21:25:52,987 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 21:25:52,989 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 21:25:52,993 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:30:06,540 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:35:21,617 INFO core: Event loop thread started, running loop forever
2026-09-29 21:35:21,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 21:35:21,927 INFO core: _init_accounts coroutine started
2026-09-29 21:35:21,927 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 21:35:21,935 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:40:16,500 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:45:22,416 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 21:45:35,591 INFO core: Event loop thread started, running loop forever
2026-09-29 21:45:35,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 21:45:35,896 INFO core: _init_accounts coroutine started
2026-09-29 21:45:35,897 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 21:45:35,903 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:50:33,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 21:55:40,491 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 21:55:40,505 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 21:55:40,505 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-29 21:55:40,714 INFO core: Event loop thread started, running loop forever
2026-09-29 21:55:41,015 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 21:55:41,026 INFO core: _init_accounts coroutine started
2026-09-29 21:55:41,028 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 21:55:41,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:00:48,542 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-29 22:00:55,760 INFO core: Event loop thread started, running loop forever
2026-09-29 22:00:56,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 22:00:56,077 INFO core: _init_accounts coroutine started
2026-09-29 22:00:56,077 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 22:00:56,100 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:05:26,684 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:05:26,685 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 22:05:26,685 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 22:10:32,231 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:15:38,398 WARNING core: ensure_llm_schema failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-29 22:15:38,398 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 22:15:38,398 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-29 22:15:38,399 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 22:15:38,399 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-29 22:15:38,399 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 22:15:38,399 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 22:15:44,262 INFO core: Event loop thread started, running loop forever
2026-09-29 22:15:44,563 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 22:15:44,566 INFO core: _init_accounts coroutine started
2026-09-29 22:15:44,568 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 22:15:44,579 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:20:07,855 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:25:16,977 INFO core: Event loop thread started, running loop forever
2026-09-29 22:25:17,279 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 22:25:17,284 INFO core: _init_accounts coroutine started
2026-09-29 22:25:17,285 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 22:25:17,291 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:30:44,505 INFO core: Event loop thread started, running loop forever
2026-09-29 22:30:44,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 22:30:44,809 INFO core: _init_accounts coroutine started
2026-09-29 22:30:44,810 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 22:30:44,817 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:35:40,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:40:10,820 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 22:40:10,820 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 22:40:10,822 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 22:40:10,828 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:45:06,101 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 22:45:06,107 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:50:11,925 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 22:50:11,930 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 22:50:11,931 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 22:55:35,860 INFO core: Event loop thread started, running loop forever
2026-09-29 22:55:36,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 22:55:36,168 INFO core: _init_accounts coroutine started
2026-09-29 22:55:36,168 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 22:55:36,174 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:00:16,632 INFO core: Event loop thread started, running loop forever
2026-09-29 23:00:16,933 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 23:00:16,938 INFO core: _init_accounts coroutine started
2026-09-29 23:00:16,938 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 23:00:16,946 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:05:22,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 23:05:31,569 INFO core: Event loop thread started, running loop forever
2026-09-29 23:05:31,870 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 23:05:31,873 INFO core: _init_accounts coroutine started
2026-09-29 23:05:31,874 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 23:05:31,887 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:05:31,891 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 23:05:31,892 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 23:05:31,893 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 23:05:31,894 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 23:10:19,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:15:25,496 INFO core: Event loop thread started, running loop forever
2026-09-29 23:15:25,797 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 23:15:25,800 INFO core: _init_accounts coroutine started
2026-09-29 23:15:25,803 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 23:15:25,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:20:32,455 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 23:20:34,982 INFO core: Event loop thread started, running loop forever
2026-09-29 23:20:35,285 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 23:20:35,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:25:17,730 INFO core: _init_accounts coroutine started
2026-09-29 23:25:17,731 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 23:25:17,772 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:30:23,545 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-29 23:30:51,084 INFO core: Event loop thread started, running loop forever
2026-09-29 23:30:51,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 23:30:51,390 INFO core: _init_accounts coroutine started
2026-09-29 23:30:51,390 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 23:30:51,395 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:35:37,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:40:19,022 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:40:19,022 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 23:40:19,023 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 23:45:39,172 INFO core: Event loop thread started, running loop forever
2026-09-29 23:45:39,473 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-29 23:45:39,477 INFO core: _init_accounts coroutine started
2026-09-29 23:45:39,477 INFO core: _init_accounts_inner: starting DB migrations
2026-09-29 23:45:39,495 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-29 23:45:39,496 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-29 23:45:39,496 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-29 23:45:39,498 INFO core: _init_accounts_inner: reloading LLM config
2026-09-29 23:45:39,510 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-29 23:45:39,510 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-29 23:45:39,511 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:50:22,874 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-29 23:50:22,878 INFO core: status() clients=0 connected=False forwarding=False
2026-09-29 23:50:22,880 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-29 23:55:16,020 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-29 23:55:16,020 WARNING core: Account 2: connect timed out after 35s
2026-09-29 23:55:16,021 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-29 23:55:16,022 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-29 23:55:16,022 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-29 23:55:16,023 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-29 23:55:16,024 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-29 23:55:16,032 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:00:21,574 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 00:00:21,575 WARNING core: Account 2: connect timed out after 35s
2026-09-30 00:00:21,576 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-30 00:00:21,576 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-30 00:00:21,577 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 00:00:21,578 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-30 00:00:21,579 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-30 00:00:21,585 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:05:27,425 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 00:05:27,426 WARNING core: Account 2: connect timed out after 35s
2026-09-30 00:05:27,426 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-30 00:05:27,426 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-30 00:05:27,427 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 00:05:27,428 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-30 00:05:41,704 INFO core: Event loop thread started, running loop forever
2026-09-30 00:05:42,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 00:05:42,028 INFO core: _init_accounts coroutine started
2026-09-30 00:05:42,028 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 00:05:42,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:10:48,612 INFO core: Event loop thread started, running loop forever
2026-09-30 00:10:48,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 00:10:48,919 INFO core: _init_accounts coroutine started
2026-09-30 00:10:48,923 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 00:10:48,929 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:15:23,957 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 00:15:23,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:20:25,202 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:25:40,718 INFO core: Event loop thread started, running loop forever
2026-09-30 00:25:41,020 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 00:25:41,023 INFO core: _init_accounts coroutine started
2026-09-30 00:25:41,025 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 00:25:41,033 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:25:41,037 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 00:25:41,037 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 00:30:38,816 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 00:30:38,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:35:16,997 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 00:35:17,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:40:48,793 INFO core: Event loop thread started, running loop forever
2026-09-30 00:40:49,095 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 00:40:49,098 INFO core: _init_accounts coroutine started
2026-09-30 00:40:49,099 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 00:40:49,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:45:07,173 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 00:45:07,174 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 00:45:07,177 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 00:45:07,179 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 00:45:07,182 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:50:19,326 INFO core: Event loop thread started, running loop forever
2026-09-30 00:50:19,627 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 00:50:19,632 INFO core: _init_accounts coroutine started
2026-09-30 00:50:19,633 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 00:50:19,642 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:55:19,001 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 00:55:19,001 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 00:55:19,001 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 01:00:29,732 INFO core: Event loop thread started, running loop forever
2026-09-30 01:00:30,033 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 01:00:30,043 INFO core: _init_accounts coroutine started
2026-09-30 01:00:30,044 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 01:00:30,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:00:30,067 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 01:00:30,067 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 01:05:36,437 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 01:05:36,438 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-30 01:05:36,438 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 01:05:36,438 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 01:05:36,438 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 01:05:36,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 01:05:45,961 INFO core: Event loop thread started, running loop forever
2026-09-30 01:05:46,262 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 01:05:46,266 INFO core: _init_accounts coroutine started
2026-09-30 01:05:46,268 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 01:05:46,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:05:46,277 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 01:05:46,278 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 01:10:11,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 01:10:11,463 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 01:10:11,477 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 01:10:11,477 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 01:10:11,483 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 01:10:11,484 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 01:10:11,491 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:15:04,400 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 01:15:04,401 WARNING core: Account 2: connect timed out after 35s
2026-09-30 01:15:04,402 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 01:15:04,402 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 01:15:04,403 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 01:15:04,404 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 01:15:04,404 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 01:15:38,474 INFO core: Event loop thread started, running loop forever
2026-09-30 01:15:38,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 01:15:38,780 INFO core: _init_accounts coroutine started
2026-09-30 01:15:38,781 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 01:15:38,788 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:20:12,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:25:21,693 INFO core: Event loop thread started, running loop forever
2026-09-30 01:25:21,994 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 01:25:22,000 INFO core: _init_accounts coroutine started
2026-09-30 01:25:22,001 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 01:25:22,009 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:30:12,134 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 01:30:12,150 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:35:22,569 INFO core: Event loop thread started, running loop forever
2026-09-30 01:35:22,871 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 01:35:22,879 INFO core: _init_accounts coroutine started
2026-09-30 01:35:22,879 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 01:35:22,888 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:40:50,905 INFO core: Event loop thread started, running loop forever
2026-09-30 01:40:51,206 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 01:40:51,210 INFO core: _init_accounts coroutine started
2026-09-30 01:40:51,213 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 01:40:51,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:45:27,786 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 01:45:27,786 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 01:45:27,787 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 01:45:27,789 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 01:45:27,808 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:50:22,976 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 01:55:17,087 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:00:24,399 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 02:00:53,669 INFO core: Event loop thread started, running loop forever
2026-09-30 02:00:53,970 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 02:00:53,973 INFO core: _init_accounts coroutine started
2026-09-30 02:00:53,975 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 02:00:53,982 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:05:43,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 02:05:43,439 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 02:05:43,439 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:10:15,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:15:18,756 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 02:15:18,776 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 02:15:18,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:20:45,414 INFO core: Event loop thread started, running loop forever
2026-09-30 02:20:45,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 02:20:45,718 INFO core: _init_accounts coroutine started
2026-09-30 02:20:45,720 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 02:20:45,733 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:25:50,003 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:25:50,004 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 02:30:31,044 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 02:30:31,065 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 02:30:31,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:35:38,468 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 02:35:38,482 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 02:35:38,483 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 02:35:38,483 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 02:35:52,678 INFO core: Event loop thread started, running loop forever
2026-09-30 02:35:52,983 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 02:35:52,987 INFO core: _init_accounts coroutine started
2026-09-30 02:35:52,989 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 02:35:53,012 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:40:49,332 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 02:40:49,333 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 02:40:49,339 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 02:40:49,345 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 02:40:49,391 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:45:46,004 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 02:45:46,005 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 02:45:46,007 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:50:30,737 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 02:55:37,701 INFO core: Event loop thread started, running loop forever
2026-09-30 02:55:38,005 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 02:55:38,013 INFO core: _init_accounts coroutine started
2026-09-30 02:55:38,013 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 02:55:38,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:00:33,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:05:39,634 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 03:05:56,248 INFO core: Event loop thread started, running loop forever
2026-09-30 03:05:56,552 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 03:05:56,561 INFO core: _init_accounts coroutine started
2026-09-30 03:05:56,561 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 03:05:56,591 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 03:05:56,591 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 03:05:56,616 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:10:28,893 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 03:10:28,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:15:34,416 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 03:15:55,781 INFO core: Event loop thread started, running loop forever
2026-09-30 03:15:56,084 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 03:15:56,089 INFO core: _init_accounts coroutine started
2026-09-30 03:15:56,090 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 03:15:56,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:20:13,906 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:25:20,500 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 03:25:24,572 INFO core: Event loop thread started, running loop forever
2026-09-30 03:25:24,874 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 03:25:24,880 INFO core: _init_accounts coroutine started
2026-09-30 03:25:24,880 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 03:25:24,900 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:30:50,621 INFO core: Event loop thread started, running loop forever
2026-09-30 03:30:50,922 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 03:30:50,925 INFO core: _init_accounts coroutine started
2026-09-30 03:30:50,926 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 03:30:50,946 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:35:40,034 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:40:14,212 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 03:40:14,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:45:12,070 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:50:44,299 INFO core: Event loop thread started, running loop forever
2026-09-30 03:50:44,600 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 03:50:44,603 INFO core: _init_accounts coroutine started
2026-09-30 03:50:44,604 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 03:50:44,618 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 03:50:44,619 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 03:50:44,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 03:55:22,169 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 03:55:22,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:00:22,350 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 04:00:22,366 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:05:27,115 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 04:05:27,116 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 04:05:27,119 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:05:27,124 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 04:05:27,126 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 04:10:34,432 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 04:10:34,434 WARNING core: Account 2: connect timed out after 35s
2026-09-30 04:10:34,435 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 04:10:47,359 INFO core: Event loop thread started, running loop forever
2026-09-30 04:10:47,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 04:10:47,666 INFO core: _init_accounts coroutine started
2026-09-30 04:10:47,667 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 04:10:47,676 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:15:19,214 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 04:15:19,215 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 04:15:19,217 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 04:15:19,217 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:15:19,218 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 04:20:26,457 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 04:20:26,458 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 04:20:26,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 04:20:30,897 INFO core: Event loop thread started, running loop forever
2026-09-30 04:20:31,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 04:20:31,203 INFO core: _init_accounts coroutine started
2026-09-30 04:20:31,206 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 04:20:31,213 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:25:09,837 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:30:36,034 INFO core: Event loop thread started, running loop forever
2026-09-30 04:30:36,338 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 04:30:36,341 INFO core: _init_accounts coroutine started
2026-09-30 04:30:36,349 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:30:36,350 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 04:35:43,437 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 04:35:49,920 INFO core: Event loop thread started, running loop forever
2026-09-30 04:35:50,222 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 04:35:50,226 INFO core: _init_accounts coroutine started
2026-09-30 04:35:50,227 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 04:35:50,241 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:40:24,565 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:45:30,752 INFO core: Event loop thread started, running loop forever
2026-09-30 04:45:31,053 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 04:45:31,056 INFO core: _init_accounts coroutine started
2026-09-30 04:45:31,057 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 04:45:31,064 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:45:31,068 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 04:45:31,068 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 04:45:31,069 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 04:50:46,773 INFO core: Event loop thread started, running loop forever
2026-09-30 04:50:47,080 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 04:50:47,086 INFO core: _init_accounts coroutine started
2026-09-30 04:50:47,087 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 04:50:47,106 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 04:50:47,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 04:50:47,107 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 04:50:47,108 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 04:50:47,109 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 04:55:50,910 INFO core: Event loop thread started, running loop forever
2026-09-30 04:55:51,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 04:55:51,214 INFO core: _init_accounts coroutine started
2026-09-30 04:55:51,216 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 04:55:51,224 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:00:19,093 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:05:25,450 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 05:05:31,877 INFO core: Event loop thread started, running loop forever
2026-09-30 05:05:32,179 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 05:05:32,183 INFO core: _init_accounts coroutine started
2026-09-30 05:05:32,186 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 05:05:32,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:10:38,463 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 05:10:41,292 INFO core: Event loop thread started, running loop forever
2026-09-30 05:10:41,594 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 05:10:41,600 INFO core: _init_accounts coroutine started
2026-09-30 05:10:41,600 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 05:10:41,606 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:15:40,585 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 05:15:40,586 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 05:15:40,589 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 05:15:40,592 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 05:15:40,607 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:15:40,610 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 05:20:35,452 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 05:20:35,468 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 05:20:35,469 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 05:20:35,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:25:32,158 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 05:25:32,160 WARNING core: Account 2: connect timed out after 35s
2026-09-30 05:25:32,161 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 05:25:32,161 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 05:25:32,162 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 05:25:32,163 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 05:25:32,163 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 05:25:32,213 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:30:24,291 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 05:30:24,291 WARNING core: Account 2: connect timed out after 35s
2026-09-30 05:30:24,292 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-30 05:30:24,292 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-30 05:30:24,292 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 05:30:24,294 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-30 05:30:24,294 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-30 05:30:24,301 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:35:12,527 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 05:35:12,527 WARNING core: Account 2: connect timed out after 35s
2026-09-30 05:35:12,535 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.182:443/TcpAbridged...
2026-09-30 05:35:12,536 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.182:443/TcpAbridged complete!
2026-09-30 05:35:12,537 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 05:35:12,538 INFO core: Account 2: connecting to Telegram via 91.108.56.186...
2026-09-30 05:35:12,539 INFO telethon.network.mtprotosender: Connecting to 91.108.56.186:443/TcpAbridged...
2026-09-30 05:35:12,542 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:40:19,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 05:40:19,419 WARNING core: Account 2: connect timed out after 35s
2026-09-30 05:40:27,398 INFO core: Event loop thread started, running loop forever
2026-09-30 05:40:27,702 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 05:40:27,706 INFO core: _init_accounts coroutine started
2026-09-30 05:40:27,707 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 05:40:27,727 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:45:04,392 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 05:45:54,559 INFO core: Event loop thread started, running loop forever
2026-09-30 05:45:54,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 05:45:54,865 INFO core: _init_accounts coroutine started
2026-09-30 05:45:54,866 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 05:45:54,870 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:50:45,195 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 05:50:45,196 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 05:50:45,199 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 05:55:12,500 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:00:47,041 INFO core: Event loop thread started, running loop forever
2026-09-30 06:00:47,342 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 06:00:47,346 INFO core: _init_accounts coroutine started
2026-09-30 06:00:47,347 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 06:00:47,353 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:05:30,577 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 06:05:30,578 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 06:05:30,579 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 06:05:30,581 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:10:13,736 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 06:10:13,747 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:15:19,540 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 06:15:19,541 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 06:15:19,541 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 06:15:22,855 INFO core: Event loop thread started, running loop forever
2026-09-30 06:15:23,156 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 06:15:23,160 INFO core: _init_accounts coroutine started
2026-09-30 06:15:23,160 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 06:15:23,167 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:20:29,398 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 06:20:39,157 INFO core: Event loop thread started, running loop forever
2026-09-30 06:20:39,460 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 06:20:39,472 INFO core: _init_accounts coroutine started
2026-09-30 06:20:39,472 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 06:20:39,473 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:25:26,977 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:30:31,271 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:35:13,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:40:26,153 INFO core: Event loop thread started, running loop forever
2026-09-30 06:40:26,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 06:40:26,457 INFO core: _init_accounts coroutine started
2026-09-30 06:40:26,459 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 06:40:26,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:45:09,416 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 06:45:09,423 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:50:16,250 INFO core: Event loop thread started, running loop forever
2026-09-30 06:50:16,551 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 06:50:16,559 INFO core: _init_accounts coroutine started
2026-09-30 06:50:16,560 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 06:50:16,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 06:55:23,421 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 06:55:23,430 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 06:55:23,430 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-30 06:55:23,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 06:55:23,431 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-30 06:55:23,431 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 06:55:23,431 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 06:55:23,431 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 06:55:23,431 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 06:55:41,524 INFO core: Event loop thread started, running loop forever
2026-09-30 06:55:41,825 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 06:55:41,835 INFO core: _init_accounts coroutine started
2026-09-30 06:55:41,836 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 06:55:41,842 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:00:17,203 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:05:20,379 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 07:05:20,379 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 07:05:20,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 07:05:20,384 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 07:05:20,393 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:10:18,939 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:15:23,495 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:20:30,459 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 07:20:30,464 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 07:20:53,571 INFO core: Event loop thread started, running loop forever
2026-09-30 07:20:53,872 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 07:20:53,881 INFO core: _init_accounts coroutine started
2026-09-30 07:20:53,881 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 07:20:53,889 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:25:27,021 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 07:25:27,074 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:30:49,570 INFO core: Event loop thread started, running loop forever
2026-09-30 07:30:49,871 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 07:30:49,875 INFO core: _init_accounts coroutine started
2026-09-30 07:30:49,877 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 07:30:49,883 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:35:26,020 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 07:35:26,021 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 07:35:26,023 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 07:35:26,025 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 07:35:26,056 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:40:06,800 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 07:40:06,800 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 07:40:06,806 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 07:40:06,807 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 07:40:06,816 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:45:13,433 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 07:45:13,433 WARNING core: Account 2: connect timed out after 35s
2026-09-30 07:45:13,434 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 07:45:13,434 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 07:45:13,435 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 07:45:13,435 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 07:45:13,436 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 07:45:27,524 INFO core: Event loop thread started, running loop forever
2026-09-30 07:45:27,825 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 07:45:27,828 INFO core: _init_accounts coroutine started
2026-09-30 07:45:27,828 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 07:45:27,843 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:50:38,780 INFO core: Event loop thread started, running loop forever
2026-09-30 07:50:39,087 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 07:50:39,093 INFO core: _init_accounts coroutine started
2026-09-30 07:50:39,094 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 07:50:39,103 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 07:55:04,795 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 07:55:04,803 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 07:55:04,809 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:00:05,430 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 08:00:05,462 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 08:00:05,462 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 08:00:05,463 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 08:00:05,463 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 08:00:54,383 INFO core: Event loop thread started, running loop forever
2026-09-30 08:00:54,688 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 08:00:54,691 INFO core: _init_accounts coroutine started
2026-09-30 08:00:54,692 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 08:00:54,696 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:05:15,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:10:22,419 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 08:10:26,377 INFO core: Event loop thread started, running loop forever
2026-09-30 08:10:26,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 08:10:26,688 INFO core: _init_accounts coroutine started
2026-09-30 08:10:26,690 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 08:10:26,697 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:15:49,053 INFO core: Event loop thread started, running loop forever
2026-09-30 08:15:49,355 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 08:15:49,358 INFO core: _init_accounts coroutine started
2026-09-30 08:15:49,360 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 08:15:49,369 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:20:38,295 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 08:20:38,296 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 08:20:38,303 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:25:10,981 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 08:25:11,019 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:30:17,503 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 08:30:35,404 INFO core: Event loop thread started, running loop forever
2026-09-30 08:30:35,713 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 08:30:35,718 INFO core: _init_accounts coroutine started
2026-09-30 08:30:35,719 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 08:30:35,775 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:35:06,453 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:40:13,469 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 08:40:13,471 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 08:40:13,471 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-30 08:40:13,472 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 08:40:13,472 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-30 08:40:13,472 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 08:40:13,472 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 08:40:13,472 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 08:40:13,472 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 08:40:22,353 INFO core: Event loop thread started, running loop forever
2026-09-30 08:40:22,655 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 08:40:22,661 INFO core: _init_accounts coroutine started
2026-09-30 08:40:22,663 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 08:40:22,666 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:45:09,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:50:16,450 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 08:50:20,286 INFO core: Event loop thread started, running loop forever
2026-09-30 08:50:20,588 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 08:50:20,594 INFO core: _init_accounts coroutine started
2026-09-30 08:50:20,595 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 08:50:20,602 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 08:55:13,717 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:00:24,074 INFO core: Event loop thread started, running loop forever
2026-09-30 09:00:24,379 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 09:00:24,381 INFO core: _init_accounts coroutine started
2026-09-30 09:00:24,384 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 09:00:24,392 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:05:31,428 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 09:05:51,373 INFO core: Event loop thread started, running loop forever
2026-09-30 09:05:51,675 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 09:05:51,679 INFO core: _init_accounts coroutine started
2026-09-30 09:05:51,681 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 09:05:51,687 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:10:37,462 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 09:10:37,462 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 09:10:37,463 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 09:10:37,464 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 09:10:37,485 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:15:32,756 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:20:08,214 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 09:20:08,215 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 09:20:08,220 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:25:28,561 INFO core: Event loop thread started, running loop forever
2026-09-30 09:25:28,863 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 09:25:28,867 INFO core: _init_accounts coroutine started
2026-09-30 09:25:28,869 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 09:25:28,880 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:30:53,763 INFO core: Event loop thread started, running loop forever
2026-09-30 09:30:54,064 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 09:30:54,067 INFO core: _init_accounts coroutine started
2026-09-30 09:30:54,067 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 09:30:54,076 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:35:43,417 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:40:14,958 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 09:40:14,969 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:45:21,722 INFO core: Event loop thread started, running loop forever
2026-09-30 09:45:22,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 09:45:22,026 INFO core: _init_accounts coroutine started
2026-09-30 09:45:22,029 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 09:45:22,041 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:50:17,212 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 09:50:17,225 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 09:55:35,511 INFO core: Event loop thread started, running loop forever
2026-09-30 09:55:35,811 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 09:55:35,814 INFO core: _init_accounts coroutine started
2026-09-30 09:55:35,817 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 09:55:35,823 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:00:42,434 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 10:00:43,861 INFO core: Event loop thread started, running loop forever
2026-09-30 10:00:44,162 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 10:00:44,168 INFO core: _init_accounts coroutine started
2026-09-30 10:00:44,168 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 10:00:44,176 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:05:43,044 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 10:05:43,045 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 10:05:43,048 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 10:05:43,050 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:05:43,051 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 10:10:46,277 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:15:03,445 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 10:15:03,446 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 10:15:03,447 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 10:15:30,786 INFO core: Event loop thread started, running loop forever
2026-09-30 10:15:31,088 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 10:15:31,093 INFO core: _init_accounts coroutine started
2026-09-30 10:15:31,095 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 10:15:31,096 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:20:37,453 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 10:20:49,098 INFO core: Event loop thread started, running loop forever
2026-09-30 10:20:49,399 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 10:20:49,403 INFO core: _init_accounts coroutine started
2026-09-30 10:20:49,404 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 10:20:49,413 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:25:10,596 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:30:12,290 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 10:30:12,291 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 10:30:12,294 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 10:30:12,296 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 10:30:12,298 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:35:52,825 INFO core: Event loop thread started, running loop forever
2026-09-30 10:35:53,127 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 10:35:53,130 INFO core: _init_accounts coroutine started
2026-09-30 10:35:53,132 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 10:35:53,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:40:45,877 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 10:40:45,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 10:40:45,881 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 10:40:45,884 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 10:40:45,890 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:45:23,444 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:50:09,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 10:50:09,411 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 10:50:09,419 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 10:50:09,421 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 10:50:09,424 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 10:55:14,789 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 10:55:14,789 WARNING core: Account 2: connect timed out after 35s
2026-09-30 10:55:14,790 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 10:55:14,790 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 10:55:14,791 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 10:55:14,792 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 10:55:14,792 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 10:55:14,796 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:00:46,392 INFO core: Event loop thread started, running loop forever
2026-09-30 11:00:46,693 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 11:00:46,698 INFO core: _init_accounts coroutine started
2026-09-30 11:00:46,698 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 11:00:46,707 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:05:52,770 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 11:05:52,770 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 11:05:52,776 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 11:05:52,779 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:10:20,718 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 11:10:20,731 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:15:26,482 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 11:15:26,483 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 11:15:43,702 INFO core: Event loop thread started, running loop forever
2026-09-30 11:15:44,004 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 11:15:44,016 INFO core: _init_accounts coroutine started
2026-09-30 11:15:44,016 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 11:15:44,022 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 11:15:44,022 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 11:15:44,023 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 11:15:44,024 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 11:15:44,031 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:20:36,339 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:20:36,340 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 11:20:36,340 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 11:25:10,898 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 11:25:10,900 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 11:25:10,908 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:30:17,418 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 11:30:17,418 WARNING core: Account 2: connect timed out after 35s
2026-09-30 11:30:17,419 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 11:30:17,419 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 11:30:17,420 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 11:30:17,421 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 11:30:17,421 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 11:30:51,573 INFO core: Event loop thread started, running loop forever
2026-09-30 11:30:51,875 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 11:30:51,878 INFO core: _init_accounts coroutine started
2026-09-30 11:30:51,879 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 11:30:51,885 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:35:53,314 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:40:49,733 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 11:40:49,733 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 11:40:49,741 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:45:14,983 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 11:45:14,988 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 11:45:14,989 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:50:20,548 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 11:50:43,073 INFO core: Event loop thread started, running loop forever
2026-09-30 11:50:43,374 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 11:50:43,378 INFO core: _init_accounts coroutine started
2026-09-30 11:50:43,380 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 11:50:43,388 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 11:55:33,744 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:00:54,148 INFO core: Event loop thread started, running loop forever
2026-09-30 12:00:54,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 12:00:54,455 INFO core: _init_accounts coroutine started
2026-09-30 12:00:54,456 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 12:00:54,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:05:52,199 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:10:32,505 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 12:10:32,505 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 12:10:32,510 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 12:10:32,512 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 12:10:32,522 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:15:18,679 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:20:14,091 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:25:16,907 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:25:16,908 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 12:30:05,449 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 12:30:22,502 INFO core: Event loop thread started, running loop forever
2026-09-30 12:30:22,803 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 12:30:22,807 INFO core: _init_accounts coroutine started
2026-09-30 12:30:22,808 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 12:30:22,814 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:35:06,666 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 12:35:06,699 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:40:28,170 INFO core: Event loop thread started, running loop forever
2026-09-30 12:40:28,471 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 12:40:28,478 INFO core: _init_accounts coroutine started
2026-09-30 12:40:28,478 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 12:40:28,482 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:45:28,258 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 12:45:28,259 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 12:45:28,260 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 12:45:28,263 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:45:28,263 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 12:50:12,947 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 12:55:46,825 INFO core: Event loop thread started, running loop forever
2026-09-30 12:55:47,127 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 12:55:47,131 INFO core: _init_accounts coroutine started
2026-09-30 12:55:47,134 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 12:55:47,147 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:00:44,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:05:20,943 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 13:05:20,956 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:10:13,902 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:15:42,289 INFO core: Event loop thread started, running loop forever
2026-09-30 13:15:42,590 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 13:15:42,594 INFO core: _init_accounts coroutine started
2026-09-30 13:15:42,597 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 13:15:42,601 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:20:45,469 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 13:20:45,477 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:25:11,487 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:30:19,571 INFO core: Event loop thread started, running loop forever
2026-09-30 13:30:19,876 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 13:30:19,883 INFO core: _init_accounts coroutine started
2026-09-30 13:30:19,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 13:30:19,897 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:35:25,482 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 13:35:48,862 INFO core: Event loop thread started, running loop forever
2026-09-30 13:35:49,163 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 13:35:49,166 INFO core: _init_accounts coroutine started
2026-09-30 13:35:49,167 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 13:35:49,175 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:40:39,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:45:34,595 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 13:45:34,596 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 13:45:34,598 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:50:40,302 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 13:55:38,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 13:55:38,455 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:00:08,328 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 14:00:08,411 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:05:52,686 INFO core: Event loop thread started, running loop forever
2026-09-30 14:05:52,987 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 14:05:52,992 INFO core: _init_accounts coroutine started
2026-09-30 14:05:52,993 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 14:05:53,000 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:10:48,099 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:15:41,656 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 14:15:41,656 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 14:15:41,673 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 14:15:41,677 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 14:15:41,678 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:20:19,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:25:26,406 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 14:25:41,376 INFO core: Event loop thread started, running loop forever
2026-09-30 14:25:41,677 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 14:25:41,684 INFO core: _init_accounts coroutine started
2026-09-30 14:25:41,684 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 14:25:41,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:25:41,692 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 14:25:41,695 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 14:30:46,470 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 14:30:46,471 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:35:04,180 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 14:35:04,207 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:40:10,372 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:45:05,411 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 14:45:05,412 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 14:45:05,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 14:45:16,656 INFO core: Event loop thread started, running loop forever
2026-09-30 14:45:16,964 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 14:45:16,967 INFO core: _init_accounts coroutine started
2026-09-30 14:45:16,967 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 14:45:16,978 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:50:30,441 INFO core: Event loop thread started, running loop forever
2026-09-30 14:50:30,743 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 14:50:30,748 INFO core: _init_accounts coroutine started
2026-09-30 14:50:30,748 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 14:50:30,758 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 14:55:21,652 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:00:37,700 INFO core: Event loop thread started, running loop forever
2026-09-30 15:00:38,000 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 15:00:38,008 INFO core: _init_accounts coroutine started
2026-09-30 15:00:38,008 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 15:00:38,021 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:05:38,115 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:10:50,840 INFO core: Event loop thread started, running loop forever
2026-09-30 15:10:51,142 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 15:10:51,343 INFO core: _init_accounts coroutine started
2026-09-30 15:10:51,345 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 15:10:51,365 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:10:51,368 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 15:15:13,274 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 15:15:13,279 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:15:13,293 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 15:20:35,282 INFO core: Event loop thread started, running loop forever
2026-09-30 15:20:35,586 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 15:20:35,592 INFO core: _init_accounts coroutine started
2026-09-30 15:20:35,592 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 15:20:35,625 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:25:33,367 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 15:25:33,368 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 15:25:33,391 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 15:25:33,399 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:30:10,666 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 15:30:10,687 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:35:12,764 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:40:05,713 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 15:40:05,715 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 15:40:05,721 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 15:40:05,722 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 15:40:05,782 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:45:11,475 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 15:45:11,475 WARNING core: Account 2: connect timed out after 35s
2026-09-30 15:45:11,476 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 15:45:11,476 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 15:45:11,477 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 15:45:11,478 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 15:45:11,479 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 15:45:21,379 INFO core: Event loop thread started, running loop forever
2026-09-30 15:45:21,680 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 15:45:21,684 INFO core: _init_accounts coroutine started
2026-09-30 15:45:21,686 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 15:45:21,706 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 15:45:21,706 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 15:45:21,708 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 15:45:21,709 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 15:45:21,730 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:50:17,483 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 15:50:17,484 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 15:50:17,492 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 15:50:17,494 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 15:50:17,496 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 15:55:24,400 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 15:55:24,401 WARNING core: Account 2: connect timed out after 35s
2026-09-30 15:55:24,402 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 15:55:24,402 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 15:55:24,403 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 15:55:24,405 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 15:55:24,405 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 15:55:47,883 INFO core: Event loop thread started, running loop forever
2026-09-30 15:55:48,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 15:55:48,190 INFO core: _init_accounts coroutine started
2026-09-30 15:55:48,191 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 15:55:48,200 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:00:12,677 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 16:00:12,677 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 16:00:12,679 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 16:00:12,681 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 16:00:12,683 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:05:19,462 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 16:05:19,462 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 16:05:19,463 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 16:05:30,719 INFO core: Event loop thread started, running loop forever
2026-09-30 16:05:31,021 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 16:05:31,030 INFO core: _init_accounts coroutine started
2026-09-30 16:05:31,031 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 16:05:31,043 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:10:40,153 INFO core: Event loop thread started, running loop forever
2026-09-30 16:10:40,454 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 16:10:40,457 INFO core: _init_accounts coroutine started
2026-09-30 16:10:40,459 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 16:10:40,466 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:15:38,349 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 16:15:38,349 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 16:15:38,350 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 16:15:38,351 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 16:15:38,362 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 16:15:38,363 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 16:15:38,369 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 16:15:38,370 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 16:15:38,376 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:20:45,527 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 16:20:45,527 WARNING core: Account 2: connect timed out after 35s
2026-09-30 16:20:45,528 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 16:20:45,528 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 16:20:45,529 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 16:20:45,530 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 16:20:45,530 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 16:20:54,157 INFO core: Event loop thread started, running loop forever
2026-09-30 16:20:54,461 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 16:20:54,471 INFO core: _init_accounts coroutine started
2026-09-30 16:20:54,471 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 16:20:54,483 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:25:36,631 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 16:25:36,675 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:30:31,641 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:35:29,040 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-30 16:35:29,047 INFO core: _init_accounts coroutine started
2026-09-30 16:35:29,047 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 16:35:29,057 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:40:13,113 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 16:40:13,113 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 16:40:13,115 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 16:40:13,116 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:45:20,417 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 16:45:20,418 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 16:45:25,234 INFO core: Event loop thread started, running loop forever
2026-09-30 16:45:25,535 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 16:45:25,545 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:50:32,401 INFO core: _init_accounts coroutine started
2026-09-30 16:50:32,402 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 16:50:32,402 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-09-30 16:50:51,994 INFO core: Event loop thread started, running loop forever
2026-09-30 16:50:52,295 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 16:50:52,300 INFO core: _init_accounts coroutine started
2026-09-30 16:50:52,301 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 16:50:52,305 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:55:04,189 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 16:55:04,190 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 17:00:11,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 17:00:11,450 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 17:00:11,450 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-30 17:00:11,451 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 17:00:11,451 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 17:00:11,451 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 17:00:11,451 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 17:00:42,591 INFO core: Event loop thread started, running loop forever
2026-09-30 17:00:42,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 17:00:42,896 INFO core: _init_accounts coroutine started
2026-09-30 17:00:42,897 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 17:00:42,903 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:05:18,976 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 17:05:18,976 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 17:05:18,983 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:10:04,173 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 17:10:04,180 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 17:10:04,184 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:15:48,174 INFO core: Event loop thread started, running loop forever
2026-09-30 17:15:48,477 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 17:15:48,482 INFO core: _init_accounts coroutine started
2026-09-30 17:15:48,482 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 17:15:48,493 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:15:48,498 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 17:15:48,498 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 17:15:48,499 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 17:15:48,501 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 17:20:45,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:25:08,475 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:30:15,411 WARNING core: LLM config load failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 17:30:44,307 INFO core: Event loop thread started, running loop forever
2026-09-30 17:30:44,608 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 17:30:44,613 INFO core: _init_accounts coroutine started
2026-09-30 17:30:44,613 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 17:30:44,619 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:35:36,679 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 17:35:36,680 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:35:36,680 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 17:40:15,128 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 17:40:15,140 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 17:40:15,152 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:45:24,221 INFO core: Event loop thread started, running loop forever
2026-09-30 17:45:24,522 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 17:45:24,537 INFO core: _init_accounts coroutine started
2026-09-30 17:45:24,537 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 17:45:24,557 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 17:45:24,557 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 17:45:24,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 17:45:24,566 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 17:45:24,567 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:50:09,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 17:55:26,937 INFO core: Event loop thread started, running loop forever
2026-09-30 17:55:27,239 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 17:55:27,244 INFO core: _init_accounts coroutine started
2026-09-30 17:55:27,245 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 17:55:27,250 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:00:32,351 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 18:00:32,358 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:05:05,354 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:10:41,717 INFO core: Event loop thread started, running loop forever
2026-09-30 18:10:42,019 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 18:10:42,023 INFO core: _init_accounts coroutine started
2026-09-30 18:10:42,024 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 18:10:42,040 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:15:09,752 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:20:15,422 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 18:20:15,423 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 18:20:44,807 INFO core: Event loop thread started, running loop forever
2026-09-30 18:20:45,109 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 18:20:45,114 INFO core: _init_accounts coroutine started
2026-09-30 18:20:45,114 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 18:20:45,124 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:25:31,865 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:30:04,419 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 18:30:56,356 INFO core: Event loop thread started, running loop forever
2026-09-30 18:30:56,660 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 18:30:56,668 INFO core: _init_accounts coroutine started
2026-09-30 18:30:56,668 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 18:30:56,672 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:35:52,122 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:40:51,520 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 18:40:51,521 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 18:40:51,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:45:12,200 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 18:45:12,213 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 18:45:12,219 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:50:48,257 INFO core: Event loop thread started, running loop forever
2026-09-30 18:50:48,559 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 18:50:48,562 INFO core: _init_accounts coroutine started
2026-09-30 18:50:48,564 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 18:50:48,570 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 18:55:17,410 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:00:14,522 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 19:00:14,522 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 19:00:14,523 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:05:21,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 19:05:22,370 INFO core: Event loop thread started, running loop forever
2026-09-30 19:05:22,672 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 19:05:22,677 INFO core: _init_accounts coroutine started
2026-09-30 19:05:22,677 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 19:05:22,690 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:05:22,695 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 19:05:22,705 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 19:10:29,388 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 19:10:52,146 INFO core: Event loop thread started, running loop forever
2026-09-30 19:10:52,446 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 19:10:52,451 INFO core: _init_accounts coroutine started
2026-09-30 19:10:52,451 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 19:10:52,461 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 19:10:52,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 19:10:52,462 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 19:10:52,464 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 19:10:52,470 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:15:40,948 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:20:46,052 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:20:46,052 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 19:20:46,053 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 19:25:27,410 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 19:25:27,411 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 19:25:27,415 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:30:33,397 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 19:30:37,594 INFO core: Event loop thread started, running loop forever
2026-09-30 19:30:37,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 19:30:37,906 INFO core: _init_accounts coroutine started
2026-09-30 19:30:37,907 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 19:30:37,910 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:35:16,266 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:40:22,904 INFO core: Event loop thread started, running loop forever
2026-09-30 19:40:23,207 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 19:40:23,210 INFO core: _init_accounts coroutine started
2026-09-30 19:40:23,212 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 19:40:23,227 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:45:37,801 INFO core: Event loop thread started, running loop forever
2026-09-30 19:45:38,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 19:45:38,105 INFO core: _init_accounts coroutine started
2026-09-30 19:45:38,107 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 19:45:38,114 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:50:36,510 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 19:55:43,397 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 19:55:43,399 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 19:55:43,957 INFO core: Event loop thread started, running loop forever
2026-09-30 19:55:44,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 19:55:44,261 INFO core: _init_accounts coroutine started
2026-09-30 19:55:44,262 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 19:55:44,270 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:00:04,838 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 20:00:04,891 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:05:09,246 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:10:07,578 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-30 20:10:07,578 INFO core: _init_accounts coroutine started
2026-09-30 20:10:07,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 20:10:07,589 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:10:07,591 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 20:10:07,591 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 20:10:07,592 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 20:10:07,594 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 20:15:13,443 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 20:15:52,780 INFO core: Event loop thread started, running loop forever
2026-09-30 20:15:53,081 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 20:15:53,087 INFO core: _init_accounts coroutine started
2026-09-30 20:15:53,087 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 20:15:53,097 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 20:15:53,097 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 20:15:53,098 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 20:15:53,099 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 20:15:53,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:20:45,815 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:25:36,465 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:30:43,426 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 20:30:43,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 20:30:43,427 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 20:30:53,876 INFO core: Event loop thread started, running loop forever
2026-09-30 20:30:54,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 20:30:54,187 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:35:42,791 INFO core: _init_accounts coroutine started
2026-09-30 20:35:42,793 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 20:35:42,803 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:40:24,299 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 20:40:24,322 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:45:22,413 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:50:46,909 INFO core: Event loop thread started, running loop forever
2026-09-30 20:50:47,210 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 20:50:47,216 INFO core: _init_accounts coroutine started
2026-09-30 20:50:47,217 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 20:50:47,223 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 20:55:15,552 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 20:55:15,552 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 20:55:15,554 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 20:55:15,556 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 20:55:15,556 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:00:29,272 INFO core: Event loop thread started, running loop forever
2026-09-30 21:00:29,573 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 21:00:29,576 INFO core: _init_accounts coroutine started
2026-09-30 21:00:29,579 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 21:00:29,583 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:05:32,979 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:10:38,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 21:10:41,284 INFO core: Event loop thread started, running loop forever
2026-09-30 21:10:41,585 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 21:10:41,589 INFO core: _init_accounts coroutine started
2026-09-30 21:10:41,590 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 21:10:41,600 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:10:41,601 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 21:10:41,601 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 21:15:48,382 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 21:15:48,531 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-09-30 21:15:48,531 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 21:15:48,531 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-09-30 21:15:48,531 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 21:15:48,531 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-09-30 21:15:50,514 INFO core: Event loop thread started, running loop forever
2026-09-30 21:15:50,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 21:15:50,820 INFO core: _init_accounts coroutine started
2026-09-30 21:15:50,822 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 21:15:50,827 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:20:51,251 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:25:24,247 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 21:25:24,249 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 21:25:24,252 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:30:15,041 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 21:30:15,045 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 21:30:15,053 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:35:53,754 INFO core: Event loop thread started, running loop forever
2026-09-30 21:35:54,055 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 21:35:54,062 INFO core: _init_accounts coroutine started
2026-09-30 21:35:54,062 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 21:35:54,075 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 21:35:54,075 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 21:35:54,077 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 21:35:54,078 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 21:35:54,080 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:40:37,620 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:45:25,835 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:45:25,843 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 21:45:25,848 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-09-30 21:50:12,939 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-09-30 21:50:12,940 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-09-30 21:50:12,949 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 21:55:08,098 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 21:55:08,099 WARNING core: Account 2: connect timed out after 35s
2026-09-30 21:55:08,100 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-09-30 21:55:08,100 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-09-30 21:55:08,102 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 21:55:08,103 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-09-30 21:55:08,103 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-09-30 21:55:08,106 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:00:14,673 INFO core: Event loop thread started, running loop forever
2026-09-30 22:00:14,678 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-09-30 22:00:14,679 WARNING core: Account 2: connect timed out after 35s
2026-09-30 22:00:14,679 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-09-30 22:00:14,680 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-09-30 22:00:14,680 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-09-30 22:00:14,681 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-09-30 22:00:14,682 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-09-30 22:00:14,981 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 22:00:14,990 INFO core: _init_accounts coroutine started
2026-09-30 22:00:14,990 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 22:00:15,018 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:05:22,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 22:05:22,475 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 22:05:22,475 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-09-30 22:05:22,476 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 22:05:51,710 INFO core: Event loop thread started, running loop forever
2026-09-30 22:05:52,010 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 22:05:52,017 INFO core: _init_accounts coroutine started
2026-09-30 22:05:52,018 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 22:05:52,024 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:10:12,501 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 22:10:12,513 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:15:38,131 INFO core: Event loop thread started, running loop forever
2026-09-30 22:15:38,431 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 22:15:38,436 INFO core: _init_accounts coroutine started
2026-09-30 22:15:38,438 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 22:15:38,448 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:20:28,872 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 22:20:28,872 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 22:20:28,892 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:25:18,267 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 22:25:18,275 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 22:25:18,276 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:30:20,617 INFO core: Event loop thread started, running loop forever
2026-09-30 22:30:20,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 22:30:20,922 INFO core: _init_accounts coroutine started
2026-09-30 22:30:20,923 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 22:30:20,936 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-09-30 22:30:20,938 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-09-30 22:30:25,671 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 22:35:13,306 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:40:37,274 INFO core: Event loop thread started, running loop forever
2026-09-30 22:40:37,577 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 22:40:37,635 INFO core: _init_accounts coroutine started
2026-09-30 22:40:37,636 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 22:40:37,648 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:45:43,578 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 22:45:43,603 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:50:36,951 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:53:44,688 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-09-30 22:53:44,689 INFO core: _init_accounts coroutine started
2026-09-30 22:53:44,689 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 22:53:44,694 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 22:53:44,709 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 22:53:44,709 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 22:55:21,747 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 22:55:21,749 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 22:55:21,751 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:00:06,375 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-09-30 23:00:18,555 INFO core: Event loop thread started, running loop forever
2026-09-30 23:00:18,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 23:00:18,864 INFO core: _init_accounts coroutine started
2026-09-30 23:00:18,866 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 23:00:18,867 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:05:20,713 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:10:21,526 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-09-30 23:10:21,542 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:15:22,657 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:20:43,058 INFO core: Event loop thread started, running loop forever
2026-09-30 23:20:43,359 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 23:20:43,364 INFO core: _init_accounts coroutine started
2026-09-30 23:20:43,364 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 23:20:43,374 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 23:20:43,375 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 23:20:43,375 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:20:43,377 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 23:25:09,072 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 23:25:09,102 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:30:55,613 INFO core: Event loop thread started, running loop forever
2026-09-30 23:30:55,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 23:30:55,927 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:35:15,912 INFO core: _init_accounts coroutine started
2026-09-30 23:35:15,912 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 23:35:15,926 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:35:15,926 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-09-30 23:35:15,926 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-09-30 23:40:18,968 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:40:18,969 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-09-30 23:45:07,142 INFO core: _init_accounts_inner: reloading LLM config
2026-09-30 23:45:07,146 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:50:52,575 INFO core: Event loop thread started, running loop forever
2026-09-30 23:50:52,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-09-30 23:50:52,882 INFO core: _init_accounts coroutine started
2026-09-30 23:50:52,883 INFO core: _init_accounts_inner: starting DB migrations
2026-09-30 23:50:52,893 INFO core: status() clients=0 connected=False forwarding=False
2026-09-30 23:55:33,687 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:00:39,438 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 00:00:41,502 INFO core: Event loop thread started, running loop forever
2026-10-01 00:00:41,805 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 00:00:41,811 INFO core: _init_accounts coroutine started
2026-10-01 00:00:41,811 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 00:00:41,815 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:05:38,110 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 00:05:38,118 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:10:12,817 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:15:39,962 INFO core: Event loop thread started, running loop forever
2026-10-01 00:15:40,264 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 00:15:40,270 INFO core: _init_accounts coroutine started
2026-10-01 00:15:40,271 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 00:15:40,276 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:20:11,845 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 00:20:11,845 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 00:20:11,846 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 00:20:11,848 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 00:20:11,863 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:25:46,678 INFO core: Event loop thread started, running loop forever
2026-10-01 00:25:46,979 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 00:25:46,991 INFO core: _init_accounts coroutine started
2026-10-01 00:25:46,992 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 00:25:47,003 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 00:25:47,003 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 00:25:47,004 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:25:47,004 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 00:25:47,017 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 00:30:53,568 INFO core: Event loop thread started, running loop forever
2026-10-01 00:30:53,869 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 00:30:53,880 INFO core: _init_accounts coroutine started
2026-10-01 00:30:53,880 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 00:30:53,886 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:35:26,327 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 00:35:26,341 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:40:30,983 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:45:10,737 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-01 00:45:10,750 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:50:06,877 INFO core: _init_accounts coroutine started
2026-10-01 00:50:06,878 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 00:50:06,904 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 00:55:12,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 00:55:30,365 INFO core: Event loop thread started, running loop forever
2026-10-01 00:55:30,667 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 00:55:30,672 INFO core: _init_accounts coroutine started
2026-10-01 00:55:30,673 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 00:55:30,682 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:00:37,456 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 01:00:37,456 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 01:00:37,459 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 01:00:37,460 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 01:00:37,461 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 01:00:37,461 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 01:00:37,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 01:00:55,051 INFO core: Event loop thread started, running loop forever
2026-10-01 01:00:55,354 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:00:55,358 INFO core: _init_accounts coroutine started
2026-10-01 01:00:55,359 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:00:55,367 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:05:22,812 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 01:05:22,813 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 01:05:22,815 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 01:05:22,817 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 01:05:22,818 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:10:54,842 INFO core: Event loop thread started, running loop forever
2026-10-01 01:10:55,143 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:10:55,147 INFO core: _init_accounts coroutine started
2026-10-01 01:10:55,148 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:10:55,214 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:15:07,358 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 01:15:18,264 INFO core: Event loop thread started, running loop forever
2026-10-01 01:15:18,565 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:15:18,568 INFO core: _init_accounts coroutine started
2026-10-01 01:15:18,569 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:15:18,577 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:20:25,512 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 01:20:31,291 INFO core: Event loop thread started, running loop forever
2026-10-01 01:20:31,592 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:20:31,596 INFO core: _init_accounts coroutine started
2026-10-01 01:20:31,597 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:20:31,605 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:25:38,463 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 01:25:48,657 INFO core: Event loop thread started, running loop forever
2026-10-01 01:25:48,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:25:48,964 INFO core: _init_accounts coroutine started
2026-10-01 01:25:48,970 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:25:48,971 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:30:54,472 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-10-01 01:30:56,665 INFO core: Event loop thread started, running loop forever
2026-10-01 01:30:56,966 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:30:56,974 INFO core: _init_accounts coroutine started
2026-10-01 01:30:56,976 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:30:56,982 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:35:31,321 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:40:37,591 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 01:40:37,607 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:45:48,475 INFO core: Event loop thread started, running loop forever
2026-10-01 01:45:48,776 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:45:48,781 INFO core: _init_accounts coroutine started
2026-10-01 01:45:48,783 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:45:48,792 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:50:39,384 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 01:50:39,384 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 01:50:39,385 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 01:50:39,386 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 01:55:48,594 INFO core: Event loop thread started, running loop forever
2026-10-01 01:55:48,895 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 01:55:48,899 INFO core: _init_accounts coroutine started
2026-10-01 01:55:48,900 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 01:55:48,909 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:00:32,137 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 02:00:32,138 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 02:00:32,159 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:05:37,649 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:10:32,562 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 02:10:32,574 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:15:16,025 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 02:15:16,034 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:20:42,163 INFO core: Event loop thread started, running loop forever
2026-10-01 02:20:42,464 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 02:20:42,467 INFO core: _init_accounts coroutine started
2026-10-01 02:20:42,469 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 02:20:42,489 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:20:42,494 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 02:20:42,495 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 02:25:21,148 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 02:25:21,152 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 02:25:21,158 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:25:21,163 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 02:25:21,163 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 02:25:21,167 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-01 02:25:21,168 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-01 02:30:27,432 WARNING core: Account 2: connect timed out after 35s
2026-10-01 02:30:27,433 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-01 02:30:27,433 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-01 02:30:27,434 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-01 02:30:27,435 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-10-01 02:30:27,437 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-10-01 02:30:29,706 INFO core: Event loop thread started, running loop forever
2026-10-01 02:30:30,013 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 02:30:30,025 INFO core: _init_accounts coroutine started
2026-10-01 02:30:30,025 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 02:30:30,050 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:35:04,650 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 02:35:04,650 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 02:35:04,661 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 02:35:04,668 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:40:10,409 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 02:40:10,410 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 02:40:10,411 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 02:40:44,124 INFO core: Event loop thread started, running loop forever
2026-10-01 02:40:44,426 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 02:40:44,431 INFO core: _init_accounts coroutine started
2026-10-01 02:40:44,433 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 02:40:44,466 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:45:09,811 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:50:08,518 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 02:50:08,518 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 02:50:08,519 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 02:55:09,149 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 02:55:09,153 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 02:55:09,171 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:00:08,490 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:05:28,117 INFO core: Event loop thread started, running loop forever
2026-10-01 03:05:28,420 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 03:05:28,427 INFO core: _init_accounts coroutine started
2026-10-01 03:05:28,430 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 03:05:28,442 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:10:27,518 INFO core: Event loop thread started, running loop forever
2026-10-01 03:10:27,819 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 03:10:27,823 INFO core: _init_accounts coroutine started
2026-10-01 03:10:27,823 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 03:10:27,840 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:10:35,523 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 03:15:34,500 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 03:15:50,345 INFO core: Event loop thread started, running loop forever
2026-10-01 03:15:50,647 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 03:15:50,653 INFO core: _init_accounts coroutine started
2026-10-01 03:15:50,654 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 03:15:50,656 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:20:49,920 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:25:45,866 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 03:25:45,871 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 03:25:45,879 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:30:30,174 INFO core: Event loop thread started, running loop forever
2026-10-01 03:30:30,475 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 03:30:30,481 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:35:10,236 INFO core: _init_accounts coroutine started
2026-10-01 03:35:10,239 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 03:35:10,249 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:40:16,386 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 03:40:33,590 INFO core: Event loop thread started, running loop forever
2026-10-01 03:40:33,891 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 03:40:33,895 INFO core: _init_accounts coroutine started
2026-10-01 03:40:33,896 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 03:40:33,901 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:45:10,863 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:50:14,628 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 03:50:14,631 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 03:50:14,638 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 03:55:20,381 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 03:55:20,381 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-01 03:55:20,386 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 03:55:35,514 INFO core: Event loop thread started, running loop forever
2026-10-01 03:55:35,815 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 03:55:35,821 INFO core: _init_accounts coroutine started
2026-10-01 03:55:35,821 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 03:55:35,825 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:00:41,625 INFO core: Event loop thread started, running loop forever
2026-10-01 04:00:41,615 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-10-01 04:00:41,926 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 04:00:41,932 INFO core: _init_accounts coroutine started
2026-10-01 04:00:41,932 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 04:00:41,940 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:05:17,183 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:10:23,420 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 04:10:51,558 INFO core: Event loop thread started, running loop forever
2026-10-01 04:10:51,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 04:10:51,863 INFO core: _init_accounts coroutine started
2026-10-01 04:10:51,865 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 04:10:51,870 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:15:52,655 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:20:13,444 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 04:20:13,456 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 04:20:13,468 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 04:20:13,473 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:25:42,199 INFO core: Event loop thread started, running loop forever
2026-10-01 04:25:42,499 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 04:25:42,503 INFO core: _init_accounts coroutine started
2026-10-01 04:25:42,505 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 04:25:42,524 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:30:10,876 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 04:30:10,877 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 04:30:10,883 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 04:30:10,886 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 04:30:10,893 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:35:19,114 INFO core: Event loop thread started, running loop forever
2026-10-01 04:35:19,416 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 04:35:19,423 INFO core: _init_accounts coroutine started
2026-10-01 04:35:19,423 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 04:35:19,447 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 04:35:19,448 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 04:35:19,452 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 04:35:19,454 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:35:19,456 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 04:40:13,846 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:45:35,893 INFO core: Event loop thread started, running loop forever
2026-10-01 04:45:36,195 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 04:45:36,199 INFO core: _init_accounts coroutine started
2026-10-01 04:45:36,201 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 04:45:36,305 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:50:25,157 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 04:50:25,158 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 04:50:25,281 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:55:06,777 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 04:55:06,783 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 04:55:06,785 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 04:55:06,806 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 04:55:06,807 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 04:55:06,813 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-01 04:55:06,814 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-01 05:00:12,458 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-01 05:00:12,459 WARNING core: Account 2: connect timed out after 35s
2026-10-01 05:00:12,460 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-01 05:00:12,460 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-01 05:00:12,461 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-01 05:00:12,463 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-10-01 05:00:41,750 INFO core: Event loop thread started, running loop forever
2026-10-01 05:00:42,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 05:00:42,058 INFO core: _init_accounts coroutine started
2026-10-01 05:00:42,058 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 05:00:42,062 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:05:40,581 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:10:32,372 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 05:10:32,373 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 05:10:32,375 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:15:42,477 INFO core: Event loop thread started, running loop forever
2026-10-01 05:15:42,778 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 05:15:42,782 INFO core: _init_accounts coroutine started
2026-10-01 05:15:42,784 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 05:15:42,788 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:20:41,791 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:25:18,306 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:30:14,931 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 05:30:14,931 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 05:30:14,934 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:35:15,499 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 05:35:15,502 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:40:29,636 INFO core: Event loop thread started, running loop forever
2026-10-01 05:40:29,937 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 05:40:29,946 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:45:03,388 INFO core: _init_accounts coroutine started
2026-10-01 05:45:48,934 INFO core: Event loop thread started, running loop forever
2026-10-01 05:45:49,235 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 05:45:49,239 INFO core: _init_accounts coroutine started
2026-10-01 05:45:49,240 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 05:45:49,243 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:50:12,069 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 05:50:12,096 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 05:55:09,344 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:00:30,449 INFO core: Event loop thread started, running loop forever
2026-10-01 06:00:30,750 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 06:00:30,755 INFO core: _init_accounts coroutine started
2026-10-01 06:00:30,755 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 06:00:30,765 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:05:16,734 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:10:24,908 INFO core: Event loop thread started, running loop forever
2026-10-01 06:10:25,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 06:10:25,222 INFO core: _init_accounts coroutine started
2026-10-01 06:10:25,222 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 06:10:25,232 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:15:16,500 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 06:15:16,500 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:15:16,501 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 06:20:10,111 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 06:20:10,120 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:20:10,121 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 06:25:38,761 INFO core: Event loop thread started, running loop forever
2026-10-01 06:25:39,063 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 06:25:39,066 INFO core: _init_accounts coroutine started
2026-10-01 06:25:39,069 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 06:25:39,074 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:30:06,476 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 06:30:06,478 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 06:30:06,482 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 06:30:06,482 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:30:06,483 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 06:35:06,486 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 06:35:06,503 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:35:06,519 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 06:35:06,526 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-01 06:35:06,527 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-01 06:40:12,382 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-01 06:40:14,781 INFO core: Event loop thread started, running loop forever
2026-10-01 06:40:15,082 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 06:40:15,086 INFO core: _init_accounts coroutine started
2026-10-01 06:40:15,087 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 06:40:15,095 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:45:21,390 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 06:45:41,269 INFO core: Event loop thread started, running loop forever
2026-10-01 06:45:41,570 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 06:45:41,726 INFO core: _init_accounts coroutine started
2026-10-01 06:45:41,726 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 06:45:41,730 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:50:38,666 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 06:55:41,219 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 06:55:41,219 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 06:55:41,227 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:00:48,384 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 07:00:48,386 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-01 07:00:48,387 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 07:00:48,387 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 07:00:48,387 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 07:00:48,387 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 07:00:51,773 INFO core: Event loop thread started, running loop forever
2026-10-01 07:00:52,075 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 07:00:52,078 INFO core: _init_accounts coroutine started
2026-10-01 07:00:52,081 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 07:00:52,092 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:05:09,293 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:10:16,371 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 07:10:17,082 INFO core: Event loop thread started, running loop forever
2026-10-01 07:10:17,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 07:10:17,389 INFO core: _init_accounts coroutine started
2026-10-01 07:10:17,390 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 07:10:17,396 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:15:24,375 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 07:15:39,962 INFO core: Event loop thread started, running loop forever
2026-10-01 07:15:40,263 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 07:15:40,272 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:16:17,663 INFO core: _init_accounts coroutine started
2026-10-01 07:16:17,664 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 07:16:17,669 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:20:34,780 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 07:20:34,781 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 07:20:34,784 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:25:46,784 INFO core: Event loop thread started, running loop forever
2026-10-01 07:25:47,085 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 07:25:47,088 INFO core: _init_accounts coroutine started
2026-10-01 07:25:47,091 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 07:25:47,210 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:30:47,966 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:30:47,966 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 07:30:47,967 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 07:35:25,645 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:40:53,077 INFO core: Event loop thread started, running loop forever
2026-10-01 07:40:53,378 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 07:40:53,385 INFO core: _init_accounts coroutine started
2026-10-01 07:40:53,385 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 07:40:53,390 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:45:11,230 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:50:18,450 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 07:50:22,873 INFO core: Event loop thread started, running loop forever
2026-10-01 07:50:23,174 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 07:50:23,178 INFO core: _init_accounts coroutine started
2026-10-01 07:50:23,178 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 07:50:23,195 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 07:50:23,195 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 07:50:23,198 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 07:50:23,205 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:50:23,210 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 07:55:31,328 INFO core: Event loop thread started, running loop forever
2026-10-01 07:55:31,628 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 07:55:31,631 INFO core: _init_accounts coroutine started
2026-10-01 07:55:31,632 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 07:55:31,641 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 07:55:31,647 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 07:55:31,647 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 08:00:31,869 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 08:00:31,873 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 08:00:31,889 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:05:53,753 INFO core: Event loop thread started, running loop forever
2026-10-01 08:05:54,054 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 08:05:54,057 INFO core: _init_accounts coroutine started
2026-10-01 08:05:54,059 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 08:05:54,067 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:10:29,603 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 08:10:29,604 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 08:10:29,605 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 08:10:29,606 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 08:10:29,618 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:15:36,439 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 08:15:48,672 INFO core: Event loop thread started, running loop forever
2026-10-01 08:15:48,974 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 08:15:48,979 INFO core: _init_accounts coroutine started
2026-10-01 08:15:48,986 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:15:48,990 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 08:20:45,966 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:25:44,841 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:30:35,575 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 08:30:35,576 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 08:30:35,578 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 08:30:35,580 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 08:30:35,584 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:35:17,275 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:40:24,335 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 08:40:24,336 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 08:40:24,336 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 08:40:46,865 INFO core: Event loop thread started, running loop forever
2026-10-01 08:40:47,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 08:40:47,173 INFO core: _init_accounts coroutine started
2026-10-01 08:40:47,173 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 08:40:47,179 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:45:50,882 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:50:21,454 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 08:50:21,455 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 08:50:21,458 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 08:50:21,459 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 08:50:21,468 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 08:50:21,469 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 08:50:21,472 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-01 08:50:21,473 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-01 08:50:21,480 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 08:55:28,357 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-01 08:55:28,359 WARNING core: Account 2: connect timed out after 35s
2026-10-01 08:55:28,360 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-01 08:55:28,360 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-01 08:55:32,397 INFO core: Event loop thread started, running loop forever
2026-10-01 08:55:32,698 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 08:55:32,704 INFO core: _init_accounts coroutine started
2026-10-01 08:55:32,705 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 08:55:32,721 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:00:12,352 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 09:00:12,358 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 09:00:12,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 09:00:12,384 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 09:00:12,391 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:05:11,260 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:10:41,845 INFO core: Event loop thread started, running loop forever
2026-10-01 09:10:42,146 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 09:10:42,153 INFO core: _init_accounts coroutine started
2026-10-01 09:10:42,154 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 09:10:42,158 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:15:08,555 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 09:15:08,556 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 09:15:08,557 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 09:15:08,559 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 09:15:08,565 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:20:15,457 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 09:20:15,458 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 09:20:15,458 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 09:20:23,763 INFO core: Event loop thread started, running loop forever
2026-10-01 09:20:24,064 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 09:20:24,069 INFO core: _init_accounts coroutine started
2026-10-01 09:20:24,070 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 09:20:24,078 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:25:10,342 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:30:27,224 INFO core: Event loop thread started, running loop forever
2026-10-01 09:30:27,525 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 09:30:27,530 INFO core: _init_accounts coroutine started
2026-10-01 09:30:27,533 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 09:30:27,536 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:35:34,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 09:35:35,315 INFO core: Event loop thread started, running loop forever
2026-10-01 09:35:35,617 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 09:35:35,620 INFO core: _init_accounts coroutine started
2026-10-01 09:35:35,623 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 09:35:35,631 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:40:04,177 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 09:40:04,178 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 09:40:04,180 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:45:49,994 INFO core: Event loop thread started, running loop forever
2026-10-01 09:45:50,295 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 09:45:50,301 INFO core: _init_accounts coroutine started
2026-10-01 09:45:50,302 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 09:45:50,307 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:50:17,760 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 09:50:17,762 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 09:50:17,762 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 09:55:30,747 INFO core: Event loop thread started, running loop forever
2026-10-01 09:55:31,048 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 09:55:31,053 INFO core: _init_accounts coroutine started
2026-10-01 09:55:31,054 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 09:55:31,060 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:00:37,380 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 10:00:44,784 INFO core: Event loop thread started, running loop forever
2026-10-01 10:00:45,085 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 10:00:45,088 INFO core: _init_accounts coroutine started
2026-10-01 10:00:45,090 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 10:00:45,099 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:00:45,104 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 10:00:45,106 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 10:05:05,165 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 10:05:05,168 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:10:04,949 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 10:10:04,955 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:15:21,200 INFO core: Event loop thread started, running loop forever
2026-10-01 10:15:21,502 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 10:15:21,505 INFO core: _init_accounts coroutine started
2026-10-01 10:15:21,505 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 10:15:21,520 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:20:15,435 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 10:20:15,435 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 10:20:15,438 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:25:21,454 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 10:25:24,070 INFO core: Event loop thread started, running loop forever
2026-10-01 10:25:24,371 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 10:25:24,375 INFO core: _init_accounts coroutine started
2026-10-01 10:25:24,377 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 10:25:24,389 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:30:19,768 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 10:30:19,788 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:35:05,304 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:40:25,804 INFO core: Event loop thread started, running loop forever
2026-10-01 10:40:26,105 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 10:40:26,116 INFO core: _init_accounts coroutine started
2026-10-01 10:40:26,116 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 10:40:26,125 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:40:26,127 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 10:40:26,127 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 10:45:07,253 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 10:45:07,255 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 10:45:07,266 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:50:14,372 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 10:50:14,374 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 10:50:24,104 INFO core: Event loop thread started, running loop forever
2026-10-01 10:50:24,405 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 10:50:24,409 INFO core: _init_accounts coroutine started
2026-10-01 10:50:24,409 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 10:50:24,425 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 10:55:31,354 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 10:55:41,558 INFO core: Event loop thread started, running loop forever
2026-10-01 10:55:41,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 10:55:41,862 INFO core: _init_accounts coroutine started
2026-10-01 10:55:41,864 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 10:55:41,870 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:00:14,974 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 11:00:14,974 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 11:00:14,975 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:05:18,741 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:10:06,595 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 11:10:06,600 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 11:10:06,632 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:15:51,068 INFO core: Event loop thread started, running loop forever
2026-10-01 11:15:51,369 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 11:15:51,372 INFO core: _init_accounts coroutine started
2026-10-01 11:15:51,374 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 11:15:51,380 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:20:46,781 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 11:20:46,781 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 11:20:46,784 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 11:20:46,785 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 11:20:46,794 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:20:46,796 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 11:20:46,796 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 11:20:46,800 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-01 11:20:46,801 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-01 11:25:19,331 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-01 11:25:19,332 WARNING core: Account 2: connect timed out after 35s
2026-10-01 11:25:19,332 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-01 11:25:19,332 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-01 11:25:19,333 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-01 11:25:19,334 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-10-01 11:25:19,336 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-10-01 11:25:19,340 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:30:25,701 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-01 11:30:25,703 WARNING core: Account 2: connect timed out after 35s
2026-10-01 11:30:25,708 INFO core: Event loop thread started, running loop forever
2026-10-01 11:30:26,011 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 11:30:26,018 INFO core: _init_accounts coroutine started
2026-10-01 11:30:26,019 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 11:30:26,030 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:35:27,494 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:40:07,342 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:45:11,548 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:50:18,494 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 11:50:48,972 INFO core: Event loop thread started, running loop forever
2026-10-01 11:50:49,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 11:50:49,288 INFO core: _init_accounts coroutine started
2026-10-01 11:50:49,290 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 11:50:49,300 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 11:55:07,172 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:00:14,407 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 12:00:38,957 INFO core: Event loop thread started, running loop forever
2026-10-01 12:00:39,258 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 12:00:39,261 INFO core: _init_accounts coroutine started
2026-10-01 12:00:39,264 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 12:00:39,269 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:05:45,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 12:05:53,016 INFO core: Event loop thread started, running loop forever
2026-10-01 12:05:53,320 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 12:05:53,325 INFO core: _init_accounts coroutine started
2026-10-01 12:05:53,326 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 12:05:53,331 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:10:20,323 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 12:10:20,330 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:15:28,366 INFO core: Event loop thread started, running loop forever
2026-10-01 12:15:28,667 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 12:15:28,671 INFO core: _init_accounts coroutine started
2026-10-01 12:15:28,672 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 12:15:28,680 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:20:49,355 INFO core: Event loop thread started, running loop forever
2026-10-01 12:20:49,657 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 12:20:49,670 INFO core: _init_accounts coroutine started
2026-10-01 12:20:49,670 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 12:20:49,670 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:25:34,793 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 12:25:34,795 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 12:25:34,802 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:30:29,769 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 12:30:29,784 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 12:30:29,818 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:35:04,939 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:40:10,403 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 12:40:10,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 12:40:40,898 INFO core: Event loop thread started, running loop forever
2026-10-01 12:40:41,199 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 12:40:41,208 INFO core: _init_accounts coroutine started
2026-10-01 12:40:41,209 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 12:40:41,244 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:45:06,803 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:50:12,409 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 12:50:12,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 12:50:12,410 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-01 12:50:12,411 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 12:50:12,411 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-01 12:50:12,411 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 12:50:12,411 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 12:50:12,411 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 12:50:12,412 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 12:50:42,464 INFO core: Event loop thread started, running loop forever
2026-10-01 12:50:42,765 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 12:50:42,771 INFO core: _init_accounts coroutine started
2026-10-01 12:50:42,771 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 12:50:42,783 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 12:55:31,291 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 12:55:31,292 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 12:55:31,294 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:00:16,746 INFO core: Event loop thread started, running loop forever
2026-10-01 13:00:17,047 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:00:17,053 INFO core: _init_accounts coroutine started
2026-10-01 13:00:17,054 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:00:17,058 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:00:38,765 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 13:05:39,759 INFO core: Event loop thread started, running loop forever
2026-10-01 13:05:40,059 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:05:40,064 INFO core: _init_accounts coroutine started
2026-10-01 13:05:40,065 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:05:40,073 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:10:18,941 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 13:10:18,941 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 13:10:18,955 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 13:10:18,957 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:10:18,958 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 13:15:15,942 INFO core: Event loop thread started, running loop forever
2026-10-01 13:15:16,243 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:15:16,254 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:15:26,003 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 13:15:26,003 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 13:15:26,004 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 13:20:22,441 INFO core: _init_accounts coroutine started
2026-10-01 13:20:22,442 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:20:25,084 INFO core: Event loop thread started, running loop forever
2026-10-01 13:20:25,385 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:20:25,390 INFO core: _init_accounts coroutine started
2026-10-01 13:20:25,390 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:20:25,397 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:25:43,399 INFO core: Event loop thread started, running loop forever
2026-10-01 13:25:43,700 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:25:43,705 INFO core: _init_accounts coroutine started
2026-10-01 13:25:43,705 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:25:43,726 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 13:25:43,726 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 13:25:43,727 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 13:25:43,728 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 13:25:43,737 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 13:25:43,737 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 13:25:43,741 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-01 13:25:43,742 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-01 13:25:43,750 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:30:08,364 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-01 13:30:08,365 WARNING core: Account 2: connect timed out after 35s
2026-10-01 13:30:08,365 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-01 13:30:08,365 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-01 13:30:08,366 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-01 13:30:08,367 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-10-01 13:30:08,367 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-10-01 13:30:18,722 INFO core: Event loop thread started, running loop forever
2026-10-01 13:30:19,023 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:30:19,029 INFO core: _init_accounts coroutine started
2026-10-01 13:30:19,030 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:30:19,036 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:35:54,603 INFO core: Event loop thread started, running loop forever
2026-10-01 13:35:54,904 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:35:54,907 INFO core: _init_accounts coroutine started
2026-10-01 13:35:54,908 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:35:54,923 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:40:31,220 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:40:31,226 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 13:40:31,226 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 13:45:15,785 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 13:45:15,799 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 13:45:15,801 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:50:25,841 INFO core: Event loop thread started, running loop forever
2026-10-01 13:50:26,141 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 13:50:26,145 INFO core: _init_accounts coroutine started
2026-10-01 13:50:26,146 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 13:50:26,151 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 13:55:18,998 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:00:24,328 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 14:00:24,328 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 14:00:24,333 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 14:00:24,344 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 14:00:24,364 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:05:31,500 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 14:05:44,181 INFO core: Event loop thread started, running loop forever
2026-10-01 14:05:44,482 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 14:05:44,487 INFO core: _init_accounts coroutine started
2026-10-01 14:05:44,488 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 14:05:44,493 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:10:30,608 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 14:10:30,608 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 14:10:30,620 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:15:36,437 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 14:15:36,438 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-01 14:15:36,439 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 14:15:36,440 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 14:15:36,440 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 14:15:36,440 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 14:15:39,948 INFO core: Event loop thread started, running loop forever
2026-10-01 14:15:40,250 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 14:15:40,254 INFO core: _init_accounts coroutine started
2026-10-01 14:15:40,255 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 14:15:40,279 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:15:40,286 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 14:15:40,293 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 14:20:49,883 INFO core: Event loop thread started, running loop forever
2026-10-01 14:20:50,184 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 14:20:50,188 INFO core: _init_accounts coroutine started
2026-10-01 14:20:50,189 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 14:20:50,200 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:25:20,347 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:25:20,349 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 14:25:20,349 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 14:30:47,873 INFO core: Event loop thread started, running loop forever
2026-10-01 14:30:48,177 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 14:30:48,180 INFO core: _init_accounts coroutine started
2026-10-01 14:30:48,182 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 14:30:48,189 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:35:28,548 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 14:35:28,548 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 14:35:28,549 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:40:13,446 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 14:40:13,451 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:40:13,452 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 14:45:27,478 INFO core: Event loop thread started, running loop forever
2026-10-01 14:45:27,779 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 14:45:27,785 INFO core: _init_accounts coroutine started
2026-10-01 14:45:27,785 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 14:45:27,788 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:50:15,396 INFO core: Event loop thread started, running loop forever
2026-10-01 14:50:15,697 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 14:50:15,700 INFO core: _init_accounts coroutine started
2026-10-01 14:50:15,702 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 14:50:15,707 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 14:50:34,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 14:55:22,773 INFO core: Event loop thread started, running loop forever
2026-10-01 14:55:23,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 14:55:23,079 INFO core: _init_accounts coroutine started
2026-10-01 14:55:23,080 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 14:55:23,087 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:00:42,086 INFO core: Event loop thread started, running loop forever
2026-10-01 15:00:42,388 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 15:00:42,393 INFO core: _init_accounts coroutine started
2026-10-01 15:00:42,394 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 15:00:42,401 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:05:43,495 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:10:38,452 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 15:10:38,453 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 15:10:38,458 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:15:11,464 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 15:15:11,470 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:15:11,470 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 15:20:08,085 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:25:46,142 INFO core: Event loop thread started, running loop forever
2026-10-01 15:25:46,443 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 15:25:46,446 INFO core: _init_accounts coroutine started
2026-10-01 15:25:46,447 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 15:25:46,456 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:30:38,929 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 15:30:38,930 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 15:30:38,940 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 15:30:38,942 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:30:38,943 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 15:35:13,282 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:40:12,906 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:40:12,907 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 15:45:04,335 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 15:45:04,336 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 15:45:12,525 INFO core: Event loop thread started, running loop forever
2026-10-01 15:45:12,826 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 15:45:12,830 INFO core: _init_accounts coroutine started
2026-10-01 15:45:12,831 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 15:45:12,834 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:50:11,145 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 15:50:11,151 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 15:55:15,133 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:00:15,454 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-01 16:00:15,455 INFO core: _init_accounts coroutine started
2026-10-01 16:00:15,455 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 16:00:15,461 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:05:22,382 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 16:05:42,534 INFO core: Event loop thread started, running loop forever
2026-10-01 16:05:42,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 16:05:42,843 INFO core: _init_accounts coroutine started
2026-10-01 16:05:42,844 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 16:05:42,850 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:10:23,965 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:15:51,887 INFO core: Event loop thread started, running loop forever
2026-10-01 16:15:52,188 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 16:15:52,197 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:20:38,154 INFO core: _init_accounts coroutine started
2026-10-01 16:20:38,155 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 16:20:38,163 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:25:03,674 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:30:09,404 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 16:30:35,443 INFO core: Event loop thread started, running loop forever
2026-10-01 16:30:35,744 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 16:30:35,747 INFO core: _init_accounts coroutine started
2026-10-01 16:30:35,749 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 16:30:35,756 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:35:21,005 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 16:35:21,006 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 16:35:21,008 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 16:35:21,009 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:40:16,684 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 16:40:16,688 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:45:22,432 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 16:45:28,857 INFO core: Event loop thread started, running loop forever
2026-10-01 16:45:29,159 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 16:45:29,163 INFO core: _init_accounts coroutine started
2026-10-01 16:45:29,165 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 16:45:29,174 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:50:28,532 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 16:50:28,532 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 16:50:28,534 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 16:50:28,534 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 16:50:28,535 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 16:55:29,363 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:00:35,435 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 17:00:35,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 17:00:52,484 INFO core: Event loop thread started, running loop forever
2026-10-01 17:00:52,794 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 17:00:52,797 INFO core: _init_accounts coroutine started
2026-10-01 17:00:52,799 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 17:00:52,805 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:05:31,635 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 17:05:31,636 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 17:05:31,638 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 17:05:31,638 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:10:09,183 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 17:10:09,190 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:15:17,363 INFO core: Event loop thread started, running loop forever
2026-10-01 17:15:17,665 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 17:15:17,672 INFO core: _init_accounts coroutine started
2026-10-01 17:15:17,673 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 17:15:17,688 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 17:15:17,688 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 17:15:17,690 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:15:17,693 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 17:20:24,419 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 17:20:47,062 INFO core: Event loop thread started, running loop forever
2026-10-01 17:20:47,363 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 17:20:47,367 INFO core: _init_accounts coroutine started
2026-10-01 17:20:47,368 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 17:20:47,374 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:25:17,422 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:30:21,396 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 17:30:21,397 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 17:30:21,398 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 17:30:21,399 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:35:07,953 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 17:35:07,967 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:40:30,561 INFO core: Event loop thread started, running loop forever
2026-10-01 17:40:30,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 17:40:30,866 INFO core: _init_accounts coroutine started
2026-10-01 17:40:30,867 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 17:40:30,873 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:45:20,776 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:50:19,012 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 17:50:19,038 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 17:55:21,887 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:00:53,176 INFO core: Event loop thread started, running loop forever
2026-10-01 18:00:53,478 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 18:00:53,485 INFO core: _init_accounts coroutine started
2026-10-01 18:00:53,485 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 18:00:53,489 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:05:46,550 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:10:25,813 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:15:10,275 INFO core: Event loop thread started, running loop forever
2026-10-01 18:15:10,578 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 18:15:10,588 INFO core: _init_accounts coroutine started
2026-10-01 18:15:10,588 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 18:15:10,592 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:15:32,299 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 18:20:16,378 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 18:20:19,161 INFO core: Event loop thread started, running loop forever
2026-10-01 18:20:19,462 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 18:20:19,468 INFO core: _init_accounts coroutine started
2026-10-01 18:20:19,468 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 18:20:19,474 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:25:12,151 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 18:25:12,151 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 18:25:12,155 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:30:33,673 INFO core: Event loop thread started, running loop forever
2026-10-01 18:30:33,974 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 18:30:33,979 INFO core: _init_accounts coroutine started
2026-10-01 18:30:33,979 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 18:30:33,983 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:35:12,301 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 18:35:12,302 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 18:35:12,302 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:35:12,304 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 18:40:35,689 INFO core: Event loop thread started, running loop forever
2026-10-01 18:40:35,990 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 18:40:35,992 INFO core: _init_accounts coroutine started
2026-10-01 18:40:35,994 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 18:40:36,000 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:45:10,050 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:50:06,154 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 18:50:06,162 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 18:55:23,965 INFO core: Event loop thread started, running loop forever
2026-10-01 18:55:24,266 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 18:55:24,270 INFO core: _init_accounts coroutine started
2026-10-01 18:55:24,273 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 18:55:24,277 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:00:53,607 INFO core: Event loop thread started, running loop forever
2026-10-01 19:00:53,915 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 19:00:53,922 INFO core: _init_accounts coroutine started
2026-10-01 19:00:53,922 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 19:00:53,930 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:05:34,422 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:10:05,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 19:10:05,395 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 19:10:05,398 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:10:05,398 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 19:15:45,653 INFO core: Event loop thread started, running loop forever
2026-10-01 19:15:45,954 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 19:15:45,957 INFO core: _init_accounts coroutine started
2026-10-01 19:15:45,958 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 19:15:45,963 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:20:25,197 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:25:31,429 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-10-01 19:25:40,082 INFO core: Event loop thread started, running loop forever
2026-10-01 19:25:40,383 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 19:25:40,389 INFO core: _init_accounts coroutine started
2026-10-01 19:25:40,389 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 19:25:40,396 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:30:42,476 INFO core: Event loop thread started, running loop forever
2026-10-01 19:30:42,786 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 19:30:42,789 INFO core: _init_accounts coroutine started
2026-10-01 19:30:42,791 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 19:30:42,797 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:30:47,471 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 19:35:39,063 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 19:35:39,073 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:40:32,044 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:45:12,684 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-01 19:45:12,685 INFO core: _init_accounts coroutine started
2026-10-01 19:45:12,685 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 19:45:12,690 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:50:18,353 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 19:50:18,354 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 19:50:50,562 INFO core: Event loop thread started, running loop forever
2026-10-01 19:50:50,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 19:50:50,865 INFO core: _init_accounts coroutine started
2026-10-01 19:50:50,867 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 19:50:50,873 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:55:19,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 19:55:19,440 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 19:55:19,442 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 19:55:19,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 20:00:29,297 INFO core: Event loop thread started, running loop forever
2026-10-01 20:00:29,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:00:29,600 INFO core: _init_accounts coroutine started
2026-10-01 20:00:29,603 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:00:29,612 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:05:05,293 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:10:11,358 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 20:10:18,832 INFO core: Event loop thread started, running loop forever
2026-10-01 20:10:19,133 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:10:19,137 INFO core: _init_accounts coroutine started
2026-10-01 20:10:19,138 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:10:19,151 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:15:43,247 INFO core: Event loop thread started, running loop forever
2026-10-01 20:15:43,548 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:15:43,552 INFO core: _init_accounts coroutine started
2026-10-01 20:15:43,554 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:15:43,563 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:20:32,228 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 20:20:32,228 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 20:20:32,230 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 20:20:32,230 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:25:07,194 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 20:25:07,197 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:30:15,848 INFO core: Event loop thread started, running loop forever
2026-10-01 20:30:16,150 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:30:16,157 INFO core: _init_accounts coroutine started
2026-10-01 20:30:16,158 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:30:16,160 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:35:22,384 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 20:35:23,584 INFO core: Event loop thread started, running loop forever
2026-10-01 20:35:23,885 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:35:23,888 INFO core: _init_accounts coroutine started
2026-10-01 20:35:23,889 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:35:23,895 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:40:29,370 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 20:40:36,577 INFO core: Event loop thread started, running loop forever
2026-10-01 20:40:36,877 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:40:36,883 INFO core: _init_accounts coroutine started
2026-10-01 20:40:36,883 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:40:36,887 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:45:43,395 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 20:45:45,739 INFO core: Event loop thread started, running loop forever
2026-10-01 20:45:46,040 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:45:46,115 INFO core: _init_accounts coroutine started
2026-10-01 20:45:46,115 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:45:46,135 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:50:23,322 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 20:50:23,333 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 20:55:30,173 INFO core: Event loop thread started, running loop forever
2026-10-01 20:55:30,473 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 20:55:30,477 INFO core: _init_accounts coroutine started
2026-10-01 20:55:30,480 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 20:55:30,485 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:00:25,126 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 21:00:25,143 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:05:17,754 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:10:16,255 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-01 21:10:16,256 INFO core: _init_accounts coroutine started
2026-10-01 21:10:16,256 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 21:10:16,261 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 21:10:16,261 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 21:10:16,263 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 21:10:16,263 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:15:23,387 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 21:15:23,388 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 21:15:23,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 21:15:23,388 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 21:15:26,766 INFO core: Event loop thread started, running loop forever
2026-10-01 21:15:27,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 21:15:27,074 INFO core: _init_accounts coroutine started
2026-10-01 21:15:27,075 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 21:15:27,082 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:20:33,378 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 21:20:51,773 INFO core: Event loop thread started, running loop forever
2026-10-01 21:20:52,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 21:20:52,078 INFO core: _init_accounts coroutine started
2026-10-01 21:20:52,079 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 21:20:52,086 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:25:17,476 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:30:24,406 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 21:30:40,617 INFO core: Event loop thread started, running loop forever
2026-10-01 21:30:40,918 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 21:30:40,924 INFO core: _init_accounts coroutine started
2026-10-01 21:30:40,925 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 21:30:40,937 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 21:30:40,938 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 21:30:40,939 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 21:30:40,940 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:35:35,682 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 21:35:35,692 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:40:23,460 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:45:34,409 INFO core: Event loop thread started, running loop forever
2026-10-01 21:45:34,710 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 21:45:34,715 INFO core: _init_accounts coroutine started
2026-10-01 21:45:34,716 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 21:45:34,720 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:50:46,494 INFO core: Event loop thread started, running loop forever
2026-10-01 21:50:46,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 21:50:46,920 INFO core: _init_accounts coroutine started
2026-10-01 21:50:46,920 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 21:50:46,927 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 21:55:50,883 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:00:15,869 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:05:46,914 INFO core: Event loop thread started, running loop forever
2026-10-01 22:05:47,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 22:05:47,217 INFO core: _init_accounts coroutine started
2026-10-01 22:05:47,219 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 22:05:47,228 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:10:31,668 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 22:10:31,681 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:15:50,131 INFO core: Event loop thread started, running loop forever
2026-10-01 22:15:50,433 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 22:15:50,437 INFO core: _init_accounts coroutine started
2026-10-01 22:15:50,438 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 22:15:50,461 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:20:52,467 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:25:12,661 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 22:25:12,661 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 22:25:12,663 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:30:18,374 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 22:30:18,375 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-01 22:30:18,376 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 22:30:18,376 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 22:30:18,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 22:30:18,376 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 22:30:28,070 INFO core: Event loop thread started, running loop forever
2026-10-01 22:30:28,372 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 22:30:28,376 INFO core: _init_accounts coroutine started
2026-10-01 22:30:28,378 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 22:30:28,384 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:35:27,173 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:40:11,167 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:40:11,169 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 22:45:18,405 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 22:45:18,406 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-01 22:45:18,407 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 22:45:18,407 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-01 22:45:18,408 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 22:45:34,759 INFO core: Event loop thread started, running loop forever
2026-10-01 22:45:35,061 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 22:45:35,068 INFO core: _init_accounts coroutine started
2026-10-01 22:45:35,069 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 22:45:35,076 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:50:37,229 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 22:55:17,153 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 22:55:17,153 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 22:55:17,156 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:00:24,401 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 23:00:24,401 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-01 23:00:24,402 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 23:00:24,403 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 23:00:27,193 INFO core: Event loop thread started, running loop forever
2026-10-01 23:00:27,494 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 23:00:27,502 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:05:34,365 INFO core: _init_accounts coroutine started
2026-10-01 23:05:34,366 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 23:05:34,366 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-10-01 23:05:43,194 INFO core: Event loop thread started, running loop forever
2026-10-01 23:05:43,495 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 23:05:43,499 INFO core: _init_accounts coroutine started
2026-10-01 23:05:43,501 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 23:05:43,509 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:10:26,937 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:15:18,586 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 23:15:18,586 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 23:15:18,608 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:15:18,608 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 23:20:17,212 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 23:20:17,216 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:25:24,373 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 23:25:24,373 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 23:25:24,374 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 23:25:44,121 INFO core: Event loop thread started, running loop forever
2026-10-01 23:25:44,424 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 23:25:44,428 INFO core: _init_accounts coroutine started
2026-10-01 23:25:44,429 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 23:25:44,436 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 23:25:44,436 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 23:25:44,437 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 23:25:44,438 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 23:25:44,439 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:30:14,527 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:35:21,348 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-01 23:35:25,775 INFO core: Event loop thread started, running loop forever
2026-10-01 23:35:26,077 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 23:35:26,081 INFO core: _init_accounts coroutine started
2026-10-01 23:35:26,082 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 23:35:26,089 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:40:13,780 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 23:40:13,780 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 23:40:13,781 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 23:40:13,782 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 23:40:13,785 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:45:32,933 INFO core: Event loop thread started, running loop forever
2026-10-01 23:45:33,234 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 23:45:33,237 INFO core: _init_accounts coroutine started
2026-10-01 23:45:33,238 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 23:45:33,247 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-01 23:45:33,247 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-01 23:45:33,249 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:45:33,249 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-01 23:50:39,376 INFO core: _init_accounts_inner: reloading LLM config
2026-10-01 23:50:39,376 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-01 23:50:39,376 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-01 23:50:39,377 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-01 23:50:40,099 INFO core: Event loop thread started, running loop forever
2026-10-01 23:50:40,404 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-01 23:50:40,407 INFO core: _init_accounts coroutine started
2026-10-01 23:50:40,408 INFO core: _init_accounts_inner: starting DB migrations
2026-10-01 23:50:40,425 INFO core: status() clients=0 connected=False forwarding=False
2026-10-01 23:55:35,988 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-01 23:55:35,996 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:00:16,827 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:05:19,097 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-02 00:05:19,098 INFO core: _init_accounts coroutine started
2026-10-02 00:05:19,098 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 00:05:19,103 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 00:05:19,103 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 00:05:19,105 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 00:05:19,105 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:10:09,379 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 00:10:09,384 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:15:05,470 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 00:15:41,906 INFO core: Event loop thread started, running loop forever
2026-10-02 00:15:42,207 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 00:15:42,212 INFO core: _init_accounts coroutine started
2026-10-02 00:15:42,213 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 00:15:42,223 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:20:48,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 00:20:48,506 INFO core: Event loop thread started, running loop forever
2026-10-02 00:20:48,807 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 00:20:48,828 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:25:33,568 INFO core: _init_accounts coroutine started
2026-10-02 00:25:33,570 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 00:25:33,576 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:30:34,674 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 00:30:34,674 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 00:30:34,676 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:35:30,949 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 00:35:30,952 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:40:37,379 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 00:40:52,498 INFO core: Event loop thread started, running loop forever
2026-10-02 00:40:52,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 00:40:52,803 INFO core: _init_accounts coroutine started
2026-10-02 00:40:52,805 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 00:40:52,825 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:45:50,262 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:50:18,273 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 00:50:18,273 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 00:50:18,282 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 00:50:18,283 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 00:50:18,286 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 00:55:24,373 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 00:55:46,611 INFO core: Event loop thread started, running loop forever
2026-10-02 00:55:46,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 00:55:46,917 INFO core: _init_accounts coroutine started
2026-10-02 00:55:46,928 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 00:55:46,927 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:00:22,982 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:05:29,450 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 01:05:29,754 INFO core: Event loop thread started, running loop forever
2026-10-02 01:05:30,055 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 01:05:30,061 INFO core: _init_accounts coroutine started
2026-10-02 01:05:30,061 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 01:05:30,067 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:10:23,494 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:15:37,161 INFO core: Event loop thread started, running loop forever
2026-10-02 01:15:37,473 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 01:15:37,482 INFO core: _init_accounts coroutine started
2026-10-02 01:15:37,483 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 01:15:37,497 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:20:36,382 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:25:18,542 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 01:25:18,543 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 01:25:18,545 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 01:25:18,547 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 01:25:18,547 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:30:04,975 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 01:30:04,976 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 01:30:04,984 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-02 01:30:04,992 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-02 01:30:05,003 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:35:11,385 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-02 01:35:34,256 INFO core: Event loop thread started, running loop forever
2026-10-02 01:35:34,557 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 01:35:34,561 INFO core: _init_accounts coroutine started
2026-10-02 01:35:34,563 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 01:35:34,571 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:40:35,379 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 01:40:35,385 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:45:32,962 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:50:40,567 INFO core: Event loop thread started, running loop forever
2026-10-02 01:50:40,868 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 01:50:40,872 INFO core: _init_accounts coroutine started
2026-10-02 01:50:40,873 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 01:50:40,879 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 01:55:47,402 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 01:55:53,170 INFO core: Event loop thread started, running loop forever
2026-10-02 01:55:53,471 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 01:55:53,477 INFO core: _init_accounts coroutine started
2026-10-02 01:55:53,477 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 01:55:53,484 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 01:55:53,485 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 01:55:53,486 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 01:55:53,488 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:00:43,857 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 02:00:43,874 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:05:24,128 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:10:22,195 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:15:31,049 INFO core: Event loop thread started, running loop forever
2026-10-02 02:15:31,350 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 02:15:31,354 INFO core: _init_accounts coroutine started
2026-10-02 02:15:31,354 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 02:15:31,374 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 02:15:31,374 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 02:15:31,376 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:20:24,255 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 02:20:24,258 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:20:24,259 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 02:25:46,788 INFO core: Event loop thread started, running loop forever
2026-10-02 02:25:47,089 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 02:25:47,095 INFO core: _init_accounts coroutine started
2026-10-02 02:25:47,095 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 02:25:47,103 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:30:36,690 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:35:25,345 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 02:35:25,353 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:40:42,769 INFO core: Event loop thread started, running loop forever
2026-10-02 02:40:43,070 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 02:40:43,074 INFO core: _init_accounts coroutine started
2026-10-02 02:40:43,076 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 02:40:43,090 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:45:40,528 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:50:13,834 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 02:55:19,474 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 02:55:41,422 INFO core: Event loop thread started, running loop forever
2026-10-02 02:55:41,724 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 02:55:41,732 INFO core: _init_accounts coroutine started
2026-10-02 02:55:41,732 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 02:55:41,750 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:00:07,370 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 03:00:52,971 INFO core: Event loop thread started, running loop forever
2026-10-02 03:00:53,273 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 03:00:53,280 INFO core: _init_accounts coroutine started
2026-10-02 03:00:53,280 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 03:00:53,284 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:05:06,716 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:10:03,699 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 03:10:03,720 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:15:23,979 INFO core: Event loop thread started, running loop forever
2026-10-02 03:15:24,281 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 03:15:24,291 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:15:24,293 INFO core: _init_accounts coroutine started
2026-10-02 03:20:26,408 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 03:20:26,432 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 03:20:26,432 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 03:20:26,433 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 03:20:26,434 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 03:20:26,437 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:25:35,638 INFO core: Event loop thread started, running loop forever
2026-10-02 03:25:35,941 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 03:25:35,950 INFO core: _init_accounts coroutine started
2026-10-02 03:25:35,951 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 03:25:35,965 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 03:25:35,966 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 03:25:35,967 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 03:25:35,971 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 03:25:35,971 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:30:18,803 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:35:48,691 INFO core: Event loop thread started, running loop forever
2026-10-02 03:35:48,992 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 03:35:48,996 INFO core: _init_accounts coroutine started
2026-10-02 03:35:48,997 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 03:35:49,003 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:40:06,900 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 03:40:06,906 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:45:04,178 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:50:38,914 INFO core: Event loop thread started, running loop forever
2026-10-02 03:50:39,215 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 03:50:39,219 INFO core: _init_accounts coroutine started
2026-10-02 03:50:39,221 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 03:50:39,227 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 03:55:43,525 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 03:55:43,525 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 03:55:43,526 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 03:55:43,528 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 03:55:43,531 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:00:40,914 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:05:12,053 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 04:05:12,056 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 04:05:12,065 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:10:09,291 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-02 04:10:09,298 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:10:09,299 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-02 04:15:15,611 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-02 04:15:15,611 WARNING core: Account 2: connect timed out after 35s
2026-10-02 04:15:15,612 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-02 04:15:16,250 INFO core: Event loop thread started, running loop forever
2026-10-02 04:15:16,551 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 04:15:16,555 INFO core: _init_accounts coroutine started
2026-10-02 04:15:16,555 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 04:15:16,563 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:20:22,902 INFO core: Event loop thread started, running loop forever
2026-10-02 04:20:22,893 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 04:20:23,204 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 04:20:23,211 INFO core: _init_accounts coroutine started
2026-10-02 04:20:23,212 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 04:20:23,216 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:25:15,917 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 04:25:15,917 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 04:25:15,924 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 04:25:15,927 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 04:25:15,938 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:30:21,513 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 04:30:21,517 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 04:30:40,426 INFO core: Event loop thread started, running loop forever
2026-10-02 04:30:40,727 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 04:30:40,731 INFO core: _init_accounts coroutine started
2026-10-02 04:30:40,734 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 04:30:40,739 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:35:28,883 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 04:35:28,886 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 04:35:28,887 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:35:28,888 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 04:40:38,555 INFO core: Event loop thread started, running loop forever
2026-10-02 04:40:38,864 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 04:40:38,868 INFO core: _init_accounts coroutine started
2026-10-02 04:40:38,869 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 04:40:38,888 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:45:39,496 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 04:45:39,497 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:45:39,497 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 04:50:43,732 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 04:50:43,736 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 04:50:43,737 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 04:55:15,518 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:00:35,655 INFO core: Event loop thread started, running loop forever
2026-10-02 05:00:35,958 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 05:00:35,965 INFO core: _init_accounts coroutine started
2026-10-02 05:00:35,967 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 05:00:35,975 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:05:39,038 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 05:05:39,039 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 05:05:39,059 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 05:05:39,061 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:10:51,775 INFO core: Event loop thread started, running loop forever
2026-10-02 05:10:52,076 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 05:10:52,080 INFO core: _init_accounts coroutine started
2026-10-02 05:10:52,083 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 05:10:52,089 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:15:04,337 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 05:15:45,018 INFO core: Event loop thread started, running loop forever
2026-10-02 05:15:45,319 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 05:15:45,322 INFO core: _init_accounts coroutine started
2026-10-02 05:15:45,323 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 05:15:45,328 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:20:51,907 INFO core: Event loop thread started, running loop forever
2026-10-02 05:20:52,208 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 05:20:52,211 INFO core: _init_accounts coroutine started
2026-10-02 05:20:52,212 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 05:20:52,217 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:25:07,242 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 05:25:07,243 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:25:07,246 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 05:30:13,438 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 05:30:13,440 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-02 05:30:24,413 INFO core: Event loop thread started, running loop forever
2026-10-02 05:30:24,715 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 05:30:24,719 INFO core: _init_accounts coroutine started
2026-10-02 05:30:24,724 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 05:30:24,736 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:35:50,811 INFO core: Event loop thread started, running loop forever
2026-10-02 05:35:51,112 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 05:35:51,116 INFO core: _init_accounts coroutine started
2026-10-02 05:35:51,118 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 05:35:51,124 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:40:50,870 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 05:40:50,870 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 05:40:50,872 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 05:40:50,874 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 05:40:50,889 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:45:27,934 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 05:45:27,934 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 05:45:27,940 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-02 05:45:27,941 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-02 05:45:27,956 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:50:26,022 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-02 05:50:26,026 WARNING core: Account 2: connect timed out after 35s
2026-10-02 05:50:26,026 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-02 05:50:26,026 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-02 05:50:26,027 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-02 05:50:26,028 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-10-02 05:50:26,028 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-10-02 05:50:26,036 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 05:55:33,427 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-02 05:55:33,428 WARNING core: Account 2: connect timed out after 35s
2026-10-02 05:55:33,428 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-10-02 05:55:33,428 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-10-02 05:55:33,429 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-02 05:55:33,429 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-10-02 05:55:33,430 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-10-02 05:55:35,504 INFO core: Event loop thread started, running loop forever
2026-10-02 05:55:35,806 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 05:55:35,812 INFO core: _init_accounts coroutine started
2026-10-02 05:55:35,813 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 05:55:35,825 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:00:37,954 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 06:00:37,961 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:05:51,701 INFO core: Event loop thread started, running loop forever
2026-10-02 06:05:52,007 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 06:05:52,012 INFO core: _init_accounts coroutine started
2026-10-02 06:05:52,013 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 06:05:52,030 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:10:33,991 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:15:40,393 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 06:15:42,455 INFO core: Event loop thread started, running loop forever
2026-10-02 06:15:42,758 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 06:15:42,768 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:15:42,770 INFO core: _init_accounts coroutine started
2026-10-02 06:20:41,000 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 06:20:41,010 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:25:09,753 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 06:25:09,753 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 06:25:09,758 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 06:25:09,760 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 06:25:09,764 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:30:16,477 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 06:30:16,477 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 06:30:16,478 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 06:30:19,535 INFO core: Event loop thread started, running loop forever
2026-10-02 06:30:19,836 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 06:30:19,840 INFO core: _init_accounts coroutine started
2026-10-02 06:30:19,842 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 06:30:19,846 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:35:43,533 INFO core: Event loop thread started, running loop forever
2026-10-02 06:35:43,834 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 06:35:43,837 INFO core: _init_accounts coroutine started
2026-10-02 06:35:43,839 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 06:35:43,853 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:40:07,198 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:45:14,355 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 06:45:48,231 INFO core: Event loop thread started, running loop forever
2026-10-02 06:45:48,532 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 06:45:48,535 INFO core: _init_accounts coroutine started
2026-10-02 06:45:48,538 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 06:45:48,544 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:50:17,602 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 06:50:17,614 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 06:55:25,317 INFO core: Event loop thread started, running loop forever
2026-10-02 06:55:25,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 06:55:25,623 INFO core: _init_accounts coroutine started
2026-10-02 06:55:25,624 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 06:55:25,637 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:00:16,461 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 07:00:16,461 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 07:00:16,463 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:05:12,103 INFO core: Event loop thread started, running loop forever
2026-10-02 07:05:12,410 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 07:05:12,413 INFO core: _init_accounts coroutine started
2026-10-02 07:05:12,415 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 07:05:12,426 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:05:12,429 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
2026-10-02 07:05:22,113 INFO core: _init_accounts_inner: running ensure_pair_schema
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-10-02 07:10:26,498 INFO core: Event loop thread started, running loop forever
2026-10-02 07:10:26,799 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 07:10:26,802 INFO core: _init_accounts coroutine started
2026-10-02 07:10:26,804 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 07:10:26,809 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:15:27,992 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:20:29,489 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 07:20:29,490 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 07:20:29,496 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:25:10,928 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 07:25:10,931 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:30:04,396 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 07:30:04,397 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 07:30:04,398 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 07:30:04,398 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 07:30:09,939 INFO core: Event loop thread started, running loop forever
2026-10-02 07:30:10,241 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 07:30:10,250 INFO core: _init_accounts coroutine started
2026-10-02 07:30:10,250 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 07:30:10,253 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:35:20,439 INFO core: Event loop thread started, running loop forever
2026-10-02 07:35:20,741 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 07:35:20,751 INFO core: _init_accounts coroutine started
2026-10-02 07:35:20,751 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 07:35:20,758 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:40:26,279 INFO core: Event loop thread started, running loop forever
2026-10-02 07:40:26,272 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 07:40:26,580 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 07:40:26,584 INFO core: _init_accounts coroutine started
2026-10-02 07:40:26,586 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 07:40:26,592 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:45:32,440 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 07:45:32,441 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 07:45:32,441 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-02 07:45:32,442 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 07:45:32,442 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-02 07:45:32,442 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 07:45:32,442 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 07:45:32,443 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 07:45:32,443 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 07:45:44,534 INFO core: Event loop thread started, running loop forever
2026-10-02 07:45:44,835 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 07:45:44,838 INFO core: _init_accounts coroutine started
2026-10-02 07:45:44,838 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 07:45:44,850 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:50:52,721 INFO core: Event loop thread started, running loop forever
2026-10-02 07:50:53,028 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 07:50:53,032 INFO core: _init_accounts coroutine started
2026-10-02 07:50:53,033 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 07:50:53,040 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 07:55:12,185 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:00:10,759 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 08:00:10,761 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 08:00:10,766 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:05:16,419 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 08:05:16,420 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-02 08:05:16,421 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 08:05:16,421 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 08:05:16,421 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 08:05:16,421 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 08:05:45,047 INFO core: Event loop thread started, running loop forever
2026-10-02 08:05:45,348 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 08:05:45,352 INFO core: _init_accounts coroutine started
2026-10-02 08:05:45,354 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 08:05:45,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 08:05:45,362 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 08:05:45,363 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:10:36,022 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 08:10:36,028 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:15:38,535 INFO core: Event loop thread started, running loop forever
2026-10-02 08:15:38,841 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 08:15:38,845 INFO core: _init_accounts coroutine started
2026-10-02 08:15:38,852 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 08:15:38,858 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:15:43,538 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 08:15:43,539 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 08:20:37,087 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 08:20:37,097 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:25:35,156 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:30:33,761 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-02 08:30:33,762 INFO core: _init_accounts coroutine started
2026-10-02 08:30:33,762 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 08:30:33,766 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:35:46,155 INFO core: Event loop thread started, running loop forever
2026-10-02 08:35:46,458 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 08:35:46,463 INFO core: _init_accounts coroutine started
2026-10-02 08:35:46,463 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 08:35:46,469 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:40:29,800 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 08:40:29,807 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:45:10,659 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:50:33,847 INFO core: Event loop thread started, running loop forever
2026-10-02 08:50:34,151 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 08:50:34,154 INFO core: _init_accounts coroutine started
2026-10-02 08:50:34,156 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 08:50:34,161 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 08:55:14,507 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 08:55:14,521 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:00:50,834 INFO core: Event loop thread started, running loop forever
2026-10-02 09:00:51,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 09:00:51,138 INFO core: _init_accounts coroutine started
2026-10-02 09:00:51,139 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 09:00:51,148 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:05:07,821 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:10:13,411 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 09:10:22,591 INFO core: Event loop thread started, running loop forever
2026-10-02 09:10:22,892 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 09:10:22,897 INFO core: _init_accounts coroutine started
2026-10-02 09:10:22,899 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 09:10:22,904 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:15:22,085 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:20:23,473 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 09:20:23,474 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 09:20:23,482 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 09:20:23,484 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 09:20:23,488 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:25:17,430 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:30:18,810 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:30:18,813 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 09:35:14,346 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 09:35:14,354 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:40:21,398 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-02 09:40:21,399 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-02 09:40:46,816 INFO core: Event loop thread started, running loop forever
2026-10-02 09:40:47,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 09:40:47,125 INFO core: _init_accounts coroutine started
2026-10-02 09:40:47,129 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 09:40:47,134 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:45:41,582 INFO core: Event loop thread started, running loop forever
2026-10-02 09:45:41,883 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 09:45:41,887 INFO core: _init_accounts coroutine started
2026-10-02 09:45:41,887 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 09:45:41,892 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:50:28,697 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 09:55:34,874 INFO core: Event loop thread started, running loop forever
2026-10-02 09:55:35,175 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 09:55:35,178 INFO core: _init_accounts coroutine started
2026-10-02 09:55:35,179 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 09:55:35,185 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:00:28,509 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:05:48,383 INFO core: Event loop thread started, running loop forever
2026-10-02 10:05:48,684 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 10:05:48,694 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:10:45,888 INFO core: _init_accounts coroutine started
2026-10-02 10:10:45,890 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 10:10:45,894 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:15:32,504 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:20:12,121 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 10:20:12,127 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:25:12,326 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:30:09,182 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-02 10:30:09,184 INFO core: _init_accounts coroutine started
2026-10-02 10:30:09,184 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 10:30:09,193 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:35:15,391 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 10:35:52,113 INFO core: Event loop thread started, running loop forever
2026-10-02 10:35:52,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 10:35:52,418 INFO core: _init_accounts coroutine started
2026-10-02 10:35:52,420 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 10:35:52,425 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:40:10,365 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 10:40:10,366 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 10:40:10,367 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 10:40:10,368 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 10:40:10,373 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:45:12,994 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:50:07,786 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 10:55:13,415 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 10:55:13,416 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 10:55:13,416 ERROR core: _init_accounts failed: cannot schedule new futures after interpreter shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 173, in submit
    raise RuntimeError('cannot schedule new futures after '
                       'interpreter shutdown')
RuntimeError: cannot schedule new futures after interpreter shutdown
2026-10-02 10:55:26,443 INFO core: Event loop thread started, running loop forever
2026-10-02 10:55:26,744 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 10:55:26,750 INFO core: _init_accounts coroutine started
2026-10-02 10:55:26,751 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 10:55:26,757 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:00:39,593 INFO core: Event loop thread started, running loop forever
2026-10-02 11:00:39,894 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 11:00:39,898 INFO core: _init_accounts coroutine started
2026-10-02 11:00:39,899 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 11:00:39,932 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 11:00:39,933 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 11:00:39,933 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:00:39,935 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 11:05:45,634 INFO core: Event loop thread started, running loop forever
2026-10-02 11:05:45,935 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 11:05:45,939 INFO core: _init_accounts coroutine started
2026-10-02 11:05:45,940 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 11:05:45,952 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:10:50,816 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 11:10:50,816 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:10:50,816 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 11:15:38,725 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:20:44,387 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 11:20:44,403 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 11:20:44,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 11:20:44,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 11:20:44,405 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 11:20:52,866 INFO core: Event loop thread started, running loop forever
2026-10-02 11:20:53,168 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 11:20:53,171 INFO core: _init_accounts coroutine started
2026-10-02 11:20:53,172 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 11:20:53,182 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 11:20:53,182 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 11:20:53,183 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 11:20:53,184 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 11:20:53,189 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:25:50,426 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:30:49,102 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 11:30:49,103 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 11:30:49,113 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-02 11:30:49,116 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-02 11:30:49,117 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:35:32,595 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-02 11:35:32,595 WARNING core: Account 2: connect timed out after 35s
2026-10-02 11:35:32,596 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-02 11:35:32,596 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-02 11:35:32,597 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-02 11:35:32,598 INFO core: Account 2: connecting to Telegram via 91.108.56.181...
2026-10-02 11:35:32,598 INFO telethon.network.mtprotosender: Connecting to 91.108.56.181:443/TcpAbridged...
2026-10-02 11:35:32,600 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:40:36,188 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-02 11:40:36,188 WARNING core: Account 2: connect timed out after 35s
2026-10-02 11:40:36,188 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.181:443/TcpAbridged...
2026-10-02 11:40:36,189 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.181:443/TcpAbridged complete!
2026-10-02 11:40:36,189 INFO telethon.network.mtprotosender: Not disconnecting (already have no connection)
2026-10-02 11:40:36,189 INFO core: Account 2: connecting to Telegram via 91.108.56.182...
2026-10-02 11:40:36,190 INFO telethon.network.mtprotosender: Connecting to 91.108.56.182:443/TcpAbridged...
2026-10-02 11:40:36,196 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:45:43,389 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-02 11:45:48,250 INFO core: Event loop thread started, running loop forever
2026-10-02 11:45:48,555 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 11:45:48,561 INFO core: _init_accounts coroutine started
2026-10-02 11:45:48,562 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 11:45:48,567 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:50:43,059 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:55:17,223 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 11:55:17,224 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 12:00:05,410 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 12:00:05,458 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 12:00:05,458 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-02 12:00:05,459 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 12:00:05,459 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 12:00:05,459 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 12:00:05,459 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 12:00:47,762 INFO core: Event loop thread started, running loop forever
2026-10-02 12:00:48,067 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 12:00:48,070 INFO core: _init_accounts coroutine started
2026-10-02 12:00:48,072 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 12:00:48,077 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:00:48,090 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 12:05:10,827 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 12:05:10,832 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 12:05:10,835 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:05:10,835 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 12:10:17,591 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 12:10:48,117 INFO core: Event loop thread started, running loop forever
2026-10-02 12:10:48,428 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 12:10:48,439 INFO core: _init_accounts coroutine started
2026-10-02 12:10:48,439 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 12:10:48,447 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:15:52,601 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:20:50,984 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:25:03,997 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 12:25:03,998 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 12:25:04,004 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:30:11,194 INFO core: Event loop thread started, running loop forever
2026-10-02 12:30:11,497 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 12:30:11,504 INFO core: _init_accounts coroutine started
2026-10-02 12:30:11,504 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 12:30:11,516 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
2026-10-02 12:30:11,518 INFO core: status() clients=0 connected=False forwarding=False
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-10-02 12:35:09,687 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:40:03,926 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-02 12:40:03,928 INFO core: _init_accounts coroutine started
2026-10-02 12:40:03,928 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 12:40:03,936 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:45:27,348 INFO core: Event loop thread started, running loop forever
2026-10-02 12:45:27,651 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 12:45:27,654 INFO core: _init_accounts coroutine started
2026-10-02 12:45:27,660 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 12:45:27,664 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:50:34,431 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 12:50:51,909 INFO core: Event loop thread started, running loop forever
2026-10-02 12:50:52,211 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 12:50:52,215 INFO core: _init_accounts coroutine started
2026-10-02 12:50:52,216 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 12:50:52,225 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 12:55:04,762 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 12:55:04,771 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:00:19,460 INFO core: Event loop thread started, running loop forever
2026-10-02 13:00:19,765 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 13:00:19,769 INFO core: _init_accounts coroutine started
2026-10-02 13:00:19,769 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 13:00:19,785 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:05:21,763 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 13:05:21,776 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:10:37,952 INFO core: Event loop thread started, running loop forever
2026-10-02 13:10:38,262 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 13:10:38,271 INFO core: _init_accounts coroutine started
2026-10-02 13:10:38,282 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 13:10:38,274 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:15:28,501 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 13:15:28,515 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:20:48,870 INFO core: Event loop thread started, running loop forever
2026-10-02 13:20:49,171 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 13:20:49,176 INFO core: _init_accounts coroutine started
2026-10-02 13:20:49,177 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 13:20:49,184 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:25:14,189 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 13:25:14,189 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 13:25:14,190 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 13:25:14,191 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:30:21,452 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 13:30:21,453 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 13:30:21,453 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 13:30:21,454 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 13:30:24,744 INFO core: Event loop thread started, running loop forever
2026-10-02 13:30:25,052 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 13:30:25,057 INFO core: _init_accounts coroutine started
2026-10-02 13:30:25,059 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 13:30:25,071 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:30:25,072 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 13:30:25,073 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 13:35:51,951 INFO core: Event loop thread started, running loop forever
2026-10-02 13:35:52,261 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 13:35:52,267 INFO core: _init_accounts coroutine started
2026-10-02 13:35:52,268 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 13:35:52,278 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:35:52,283 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 13:35:52,283 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 13:35:52,287 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 13:35:52,288 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 13:40:31,222 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:45:38,428 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 13:45:38,436 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 13:45:38,436 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 13:45:41,550 INFO core: Event loop thread started, running loop forever
2026-10-02 13:45:41,851 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 13:45:41,856 INFO core: _init_accounts coroutine started
2026-10-02 13:45:41,856 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 13:45:41,875 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:50:31,661 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 13:50:31,661 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 13:50:31,662 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 13:50:31,664 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 13:50:31,664 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 13:55:33,561 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:00:40,492 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 14:00:50,454 INFO core: Event loop thread started, running loop forever
2026-10-02 14:00:50,759 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 14:00:50,763 INFO core: _init_accounts coroutine started
2026-10-02 14:00:50,766 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 14:00:50,774 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:05:27,712 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:10:33,396 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 14:10:42,338 INFO core: Event loop thread started, running loop forever
2026-10-02 14:10:42,640 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 14:10:42,643 INFO core: _init_accounts coroutine started
2026-10-02 14:10:42,647 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 14:10:42,669 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:15:03,416 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 14:15:03,416 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 14:15:03,416 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-02 14:15:03,417 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 14:15:03,417 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-02 14:15:03,417 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 14:15:03,417 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 14:15:03,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 14:15:03,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 14:15:21,926 INFO core: Event loop thread started, running loop forever
2026-10-02 14:15:22,227 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 14:15:22,231 INFO core: _init_accounts coroutine started
2026-10-02 14:15:22,231 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 14:15:22,238 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:20:04,568 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 14:20:04,568 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 14:20:04,570 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 14:20:04,573 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 14:20:04,578 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:25:45,813 INFO core: Event loop thread started, running loop forever
2026-10-02 14:25:46,115 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 14:25:46,118 INFO core: _init_accounts coroutine started
2026-10-02 14:25:46,119 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 14:25:46,127 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:30:36,305 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:35:27,893 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 14:35:27,894 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 14:35:27,899 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 14:35:27,900 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:40:33,371 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 14:40:33,371 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 14:40:33,371 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 14:40:33,372 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 14:40:49,313 INFO core: Event loop thread started, running loop forever
2026-10-02 14:40:49,614 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 14:40:49,617 INFO core: _init_accounts coroutine started
2026-10-02 14:40:49,617 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 14:40:49,629 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:45:52,634 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 14:45:52,658 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:50:49,041 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 14:55:28,481 INFO app: Retrying account initialization (clients=0 but authorized accounts in DB)
2026-10-02 14:55:28,482 INFO core: _init_accounts coroutine started
2026-10-02 14:55:28,482 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 14:55:28,486 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:00:50,321 INFO core: Event loop thread started, running loop forever
2026-10-02 15:00:50,622 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 15:00:50,624 INFO core: _init_accounts coroutine started
2026-10-02 15:00:50,626 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 15:00:50,632 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:05:31,575 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:10:14,991 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 687, in migrate_legacy_session
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 717, in checkout
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 715, in checkout
    dbapi_connection = rec.get_connection()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 866, in get_connection
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 15:10:14,997 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:15:50,114 INFO core: Event loop thread started, running loop forever
2026-10-02 15:15:50,415 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 15:15:50,418 INFO core: _init_accounts coroutine started
2026-10-02 15:15:50,420 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 15:15:50,425 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:20:24,384 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 15:20:24,385 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 15:20:24,387 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:25:20,262 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 15:25:20,266 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 15:25:20,267 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:30:09,574 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:35:15,417 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 15:35:15,417 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 15:35:15,417 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 15:35:29,708 INFO core: Event loop thread started, running loop forever
2026-10-02 15:35:30,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 15:35:30,019 INFO core: _init_accounts coroutine started
2026-10-02 15:35:30,020 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 15:35:30,027 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:40:05,598 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:45:42,048 INFO core: Event loop thread started, running loop forever
2026-10-02 15:45:42,352 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 15:45:42,357 INFO core: _init_accounts coroutine started
2026-10-02 15:45:42,358 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 15:45:42,363 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:50:20,433 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 15:55:45,694 INFO core: Event loop thread started, running loop forever
2026-10-02 15:55:45,995 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 15:55:46,000 INFO core: _init_accounts coroutine started
2026-10-02 15:55:46,002 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 15:55:46,010 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:00:37,686 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:05:05,783 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:05:05,784 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 16:10:11,378 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 16:10:11,383 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-02 16:10:21,642 INFO core: Event loop thread started, running loop forever
2026-10-02 16:10:21,943 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 16:10:21,954 INFO core: _init_accounts coroutine started
2026-10-02 16:10:21,955 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 16:10:21,965 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:15:27,376 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 16:15:31,900 INFO core: Event loop thread started, running loop forever
2026-10-02 16:15:32,201 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 16:15:32,205 INFO core: _init_accounts coroutine started
2026-10-02 16:15:32,208 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 16:15:32,214 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:20:07,420 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:25:14,362 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 16:25:14,363 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 16:25:14,363 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-02 16:25:14,364 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 16:25:14,364 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-02 16:25:14,364 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 16:25:14,364 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 16:25:14,365 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 16:25:14,365 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 16:25:20,495 INFO core: Event loop thread started, running loop forever
2026-10-02 16:25:20,795 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 16:25:20,803 INFO core: _init_accounts coroutine started
2026-10-02 16:25:20,803 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 16:25:20,807 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:30:03,343 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 126, in _init_accounts_inner
    accounts = await self._run_db(self.db.get_accounts)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 540, in get_accounts
    with self._conn() as conn:
         ~~~~~~~~~~^^
  File "/opt/alt/python313/lib64/python3.13/contextlib.py", line 141, in __enter__
    return next(self.gen)
  File "/home/wovewbge/quill.nx.kg/db.py", line 59, in _conn
    conn = _pool.connect()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 448, in connect
    return _ConnectionFairy._checkout(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 1272, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 712, in checkout
    rec = pool._do_get()
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 178, in _do_get
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/impl.py", line 176, in _do_get
    return self._create_connection()
           ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 389, in _create_connection
    return _ConnectionRecord(self)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 674, in __init__
    self.__connect()
    ~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 900, in __connect
    with util.safe_reraise():
         ~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/util/langhelpers.py", line 122, in __exit__
    raise exc_value.with_traceback(exc_tb)
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 896, in __connect
    self.dbapi_connection = connection = pool._invoke_creator(self)
                                         ~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib64/python3.13/site-packages/sqlalchemy/pool/base.py", line 361, in <lambda>
    return lambda rec: creator_fn()
                       ~~~~~~~~~~^^
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 16:30:50,318 INFO core: Event loop thread started, running loop forever
2026-10-02 16:30:50,619 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 16:30:50,622 INFO core: _init_accounts coroutine started
2026-10-02 16:30:50,624 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 16:30:50,631 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:35:27,921 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:40:09,800 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 16:40:09,800 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 16:40:09,802 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:40:09,803 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 16:45:22,509 INFO core: Event loop thread started, running loop forever
2026-10-02 16:45:22,810 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 16:45:22,814 INFO core: _init_accounts coroutine started
2026-10-02 16:45:22,815 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 16:45:22,822 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:50:24,243 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 16:55:07,058 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 16:55:07,069 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:00:13,952 INFO core: Event loop thread started, running loop forever
2026-10-02 17:00:14,254 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 17:00:14,260 INFO core: _init_accounts coroutine started
2026-10-02 17:00:14,260 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 17:00:14,268 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:05:13,130 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 17:05:13,142 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:10:20,865 INFO core: Event loop thread started, running loop forever
2026-10-02 17:10:21,166 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 17:10:21,172 INFO core: _init_accounts coroutine started
2026-10-02 17:10:21,173 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 17:10:21,177 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:15:27,461 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 17:15:32,517 INFO core: Event loop thread started, running loop forever
2026-10-02 17:15:32,819 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 17:15:32,829 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:15:32,834 INFO core: _init_accounts coroutine started
2026-10-02 17:20:38,142 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 17:20:38,154 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:25:28,094 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 17:25:28,107 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:30:08,112 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:35:20,606 INFO core: Event loop thread started, running loop forever
2026-10-02 17:35:20,907 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 17:35:20,911 INFO core: _init_accounts coroutine started
2026-10-02 17:35:20,912 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 17:35:20,920 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:40:10,651 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 17:40:10,675 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:45:24,508 INFO core: Event loop thread started, running loop forever
2026-10-02 17:45:24,809 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 17:45:24,814 INFO core: _init_accounts coroutine started
2026-10-02 17:45:24,815 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 17:45:24,821 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:50:52,559 INFO core: Event loop thread started, running loop forever
2026-10-02 17:50:52,859 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 17:50:52,864 INFO core: _init_accounts coroutine started
2026-10-02 17:50:52,865 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 17:50:52,868 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 17:55:27,950 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:00:20,059 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 18:00:20,059 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:00:20,060 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 18:05:27,367 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 18:05:36,819 INFO core: Event loop thread started, running loop forever
2026-10-02 18:05:37,120 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 18:05:37,124 INFO core: _init_accounts coroutine started
2026-10-02 18:05:37,126 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 18:05:37,130 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:10:14,518 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:15:21,484 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 18:15:37,345 INFO core: Event loop thread started, running loop forever
2026-10-02 18:15:37,670 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 18:15:37,674 INFO core: _init_accounts coroutine started
2026-10-02 18:15:37,675 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 18:15:37,679 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:20:25,366 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 18:20:25,367 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 18:20:25,367 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:25:31,712 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 18:25:31,715 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 18:25:31,719 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:30:16,294 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:35:23,395 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 18:35:23,396 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 18:35:23,396 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 18:35:33,420 INFO core: Event loop thread started, running loop forever
2026-10-02 18:35:33,721 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 18:35:33,725 INFO core: _init_accounts coroutine started
2026-10-02 18:35:33,727 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 18:35:33,735 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:40:39,061 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 18:40:39,062 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 18:40:39,066 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:45:09,456 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:45:09,457 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 18:50:08,800 INFO core: Event loop thread started, running loop forever
2026-10-02 18:50:09,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 18:50:09,112 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 18:50:16,797 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 18:50:16,797 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 18:50:16,798 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 18:50:16,798 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 18:55:04,090 INFO core: _init_accounts coroutine started
2026-10-02 18:55:04,091 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 18:55:04,109 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 18:55:04,109 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 18:55:04,110 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 18:55:04,111 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 18:55:04,135 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:00:10,375 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 19:00:22,519 INFO core: Event loop thread started, running loop forever
2026-10-02 19:00:22,820 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 19:00:22,829 INFO core: _init_accounts coroutine started
2026-10-02 19:00:22,829 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 19:00:22,831 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:05:06,013 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:10:04,543 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 19:10:04,544 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 19:10:04,555 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:15:11,385 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 19:15:23,912 INFO core: Event loop thread started, running loop forever
2026-10-02 19:15:24,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 19:15:24,220 INFO core: _init_accounts coroutine started
2026-10-02 19:15:24,221 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 19:15:24,229 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:20:11,802 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:25:17,431 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 19:25:47,967 INFO core: Event loop thread started, running loop forever
2026-10-02 19:25:48,268 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 19:25:48,275 INFO core: _init_accounts coroutine started
2026-10-02 19:25:48,275 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 19:25:48,281 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:30:11,250 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:35:18,392 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 19:35:42,092 INFO core: Event loop thread started, running loop forever
2026-10-02 19:35:42,398 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 19:35:42,402 INFO core: _init_accounts coroutine started
2026-10-02 19:35:42,404 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 19:35:42,420 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:40:22,290 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 19:40:22,290 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 19:40:22,293 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:45:16,788 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 19:45:16,790 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 19:45:16,794 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:50:11,298 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 19:55:18,400 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 19:55:31,113 INFO core: Event loop thread started, running loop forever
2026-10-02 19:55:31,414 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 19:55:31,419 INFO core: _init_accounts coroutine started
2026-10-02 19:55:31,420 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 19:55:31,426 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:00:38,679 INFO core: Event loop thread started, running loop forever
2026-10-02 20:00:38,982 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 20:00:38,986 INFO core: _init_accounts coroutine started
2026-10-02 20:00:38,987 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 20:00:38,991 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:05:11,239 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:10:50,112 INFO core: Event loop thread started, running loop forever
2026-10-02 20:10:50,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 20:10:50,417 INFO core: _init_accounts coroutine started
2026-10-02 20:10:50,419 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 20:10:50,423 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:15:12,192 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:20:19,379 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 20:20:25,974 INFO core: Event loop thread started, running loop forever
2026-10-02 20:20:26,275 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 20:20:26,278 INFO core: _init_accounts coroutine started
2026-10-02 20:20:26,280 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 20:20:26,285 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:25:03,339 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:30:05,093 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 20:30:05,094 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 20:30:05,097 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 20:30:05,107 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:35:11,381 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 20:35:11,383 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 20:35:36,629 INFO core: Event loop thread started, running loop forever
2026-10-02 20:35:36,931 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 20:35:36,934 INFO core: _init_accounts coroutine started
2026-10-02 20:35:36,937 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 20:35:36,950 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:40:20,154 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:45:21,297 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 20:45:21,297 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 20:45:21,299 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 20:45:21,299 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:50:22,910 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 20:50:22,916 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 20:55:28,415 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 20:55:53,010 INFO core: Event loop thread started, running loop forever
2026-10-02 20:55:53,311 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 20:55:53,316 INFO core: _init_accounts coroutine started
2026-10-02 20:55:53,317 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 20:55:53,323 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:00:10,119 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:05:17,406 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 21:05:17,406 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 21:05:17,406 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-02 21:05:40,039 INFO core: Event loop thread started, running loop forever
2026-10-02 21:05:40,341 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 21:05:40,344 INFO core: _init_accounts coroutine started
2026-10-02 21:05:40,344 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 21:05:40,362 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:10:14,733 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:15:08,012 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:20:05,793 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 21:20:05,793 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 21:20:05,796 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:20:05,797 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 21:25:12,358 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 21:25:12,359 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 21:25:40,800 INFO core: Event loop thread started, running loop forever
2026-10-02 21:25:41,101 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 21:25:41,104 INFO core: _init_accounts coroutine started
2026-10-02 21:25:41,106 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 21:25:41,114 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:30:40,856 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 21:30:40,856 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 21:30:40,859 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 21:30:40,860 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 21:30:40,861 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:35:05,453 INFO core: Event loop thread started, running loop forever
2026-10-02 21:35:05,754 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 21:35:05,758 INFO core: _init_accounts coroutine started
2026-10-02 21:35:05,759 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 21:35:05,789 INFO core: Another worker holds the core lock \u2014 running passive (HTTP only)
--- Logging error ---
Traceback (most recent call last):
  File "/opt/alt/python313/lib64/python3.13/logging/__init__.py", line 1154, in emit
    stream.write(msg + self.terminator)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'ascii' codec can't encode character '\u2014' in position 70: ordinal not in range(128)
Call stack:
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1015, in _bootstrap
    self._bootstrap_inner()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 1044, in _bootstrap_inner
    self.run()
  File "/opt/alt/python313/lib64/python3.13/threading.py", line 995, in run
    self._target(*self._args, **self._kwargs)
  File "/home/wovewbge/quill.nx.kg/core.py", line 79, in _run_loop
    self.loop.run_forever()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 684, in run_forever
    self._run_once()
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 2061, in _run_once
    handle._run()
  File "/opt/alt/python313/lib64/python3.13/asyncio/events.py", line 89, in _run
    self._context.run(self._callback, *self._args)
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 143, in _init_accounts_inner
    logger.info(
Message: 'Another worker holds the core lock \u2014 running passive (HTTP only)'
Arguments: ()
2026-10-02 21:35:05,806 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:35:47,543 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 21:35:47,544 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 21:35:47,544 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 21:40:48,816 INFO core: Event loop thread started, running loop forever
2026-10-02 21:40:49,119 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 21:40:49,122 INFO core: _init_accounts coroutine started
2026-10-02 21:40:49,124 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 21:40:49,130 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:45:31,854 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:50:37,355 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 21:50:40,027 INFO core: Event loop thread started, running loop forever
2026-10-02 21:50:40,329 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 21:50:40,333 INFO core: _init_accounts coroutine started
2026-10-02 21:50:40,335 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 21:50:40,342 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 21:55:19,817 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 21:55:19,818 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 21:55:19,818 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:00:25,540 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 22:00:25,549 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 22:00:25,552 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:05:50,498 INFO core: Event loop thread started, running loop forever
2026-10-02 22:05:50,802 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 22:05:50,807 INFO core: _init_accounts coroutine started
2026-10-02 22:05:50,807 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 22:05:50,812 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:10:47,955 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:15:11,328 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:20:18,424 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 22:20:18,424 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 22:20:18,425 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-02 22:20:18,425 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 22:20:18,425 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-02 22:20:18,425 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 22:20:18,425 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-02 22:20:18,426 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-02 22:20:18,426 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 22:20:22,829 INFO core: Event loop thread started, running loop forever
2026-10-02 22:20:23,130 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 22:20:23,134 INFO core: _init_accounts coroutine started
2026-10-02 22:20:23,136 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 22:20:23,141 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:25:12,022 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 22:25:12,022 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 22:25:12,024 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 22:25:12,026 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 22:25:12,029 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:30:34,135 INFO core: Event loop thread started, running loop forever
2026-10-02 22:30:34,436 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 22:30:34,441 INFO core: _init_accounts coroutine started
2026-10-02 22:30:34,442 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 22:30:34,452 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:35:21,766 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:40:50,351 INFO core: Event loop thread started, running loop forever
2026-10-02 22:40:50,652 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 22:40:50,654 INFO core: _init_accounts coroutine started
2026-10-02 22:40:50,656 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 22:40:50,662 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:45:36,901 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 22:45:36,902 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 22:45:36,903 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:45:36,903 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 22:50:30,112 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 22:50:30,115 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 22:55:04,808 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:00:11,375 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-02 23:00:17,207 INFO core: Event loop thread started, running loop forever
2026-10-02 23:00:17,508 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 23:00:17,511 INFO core: _init_accounts coroutine started
2026-10-02 23:00:17,512 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 23:00:17,519 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:05:24,351 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 23:05:43,652 INFO core: Event loop thread started, running loop forever
2026-10-02 23:05:43,955 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 23:05:43,960 INFO core: _init_accounts coroutine started
2026-10-02 23:05:43,960 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 23:05:43,966 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:10:07,702 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:15:13,389 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-02 23:15:17,417 INFO core: Event loop thread started, running loop forever
2026-10-02 23:15:17,718 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 23:15:17,721 INFO core: _init_accounts coroutine started
2026-10-02 23:15:17,722 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 23:15:17,728 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:20:05,585 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:25:12,360 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-02 23:25:37,086 INFO core: Event loop thread started, running loop forever
2026-10-02 23:25:37,387 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 23:25:37,389 INFO core: _init_accounts coroutine started
2026-10-02 23:25:37,391 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 23:25:37,399 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:25:37,400 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 23:25:37,404 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-02 23:30:13,817 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-02 23:30:13,826 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:35:20,388 INFO core: _init_accounts_inner: reloading LLM config
2026-10-02 23:35:27,131 INFO core: Event loop thread started, running loop forever
2026-10-02 23:35:27,432 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 23:35:27,435 INFO core: _init_accounts coroutine started
2026-10-02 23:35:27,436 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 23:35:27,441 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:40:16,764 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:45:22,425 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 23:45:45,184 INFO core: Event loop thread started, running loop forever
2026-10-02 23:45:45,485 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 23:45:45,488 INFO core: _init_accounts coroutine started
2026-10-02 23:45:45,490 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 23:45:45,495 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:50:17,511 INFO core: status() clients=0 connected=False forwarding=False
2026-10-02 23:55:24,398 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-02 23:55:44,900 INFO core: Event loop thread started, running loop forever
2026-10-02 23:55:45,201 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-02 23:55:45,209 INFO core: _init_accounts coroutine started
2026-10-02 23:55:45,209 INFO core: _init_accounts_inner: starting DB migrations
2026-10-02 23:55:45,215 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:00:16,520 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:05:23,029 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 00:05:23,029 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 00:05:23,030 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-03 00:05:23,515 INFO core: Event loop thread started, running loop forever
2026-10-03 00:05:23,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 00:05:23,819 INFO core: _init_accounts coroutine started
2026-10-03 00:05:23,820 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 00:05:23,827 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:10:30,360 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 00:10:43,692 INFO core: Event loop thread started, running loop forever
2026-10-03 00:10:43,993 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 00:10:43,997 INFO core: _init_accounts coroutine started
2026-10-03 00:10:43,999 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 00:10:44,005 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 00:10:44,005 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 00:10:44,007 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:15:05,355 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 00:15:05,355 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-03 00:15:05,356 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 00:15:05,356 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-03 00:15:05,356 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 00:15:05,356 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 00:15:53,377 INFO core: Event loop thread started, running loop forever
2026-10-03 00:15:53,679 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 00:15:53,682 INFO core: _init_accounts coroutine started
2026-10-03 00:15:53,683 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 00:15:53,692 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:20:15,505 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 00:20:15,505 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 00:20:15,508 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:25:06,210 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:30:13,380 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 00:30:13,391 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 00:30:28,913 INFO core: Event loop thread started, running loop forever
2026-10-03 00:30:29,213 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 00:30:29,217 INFO core: _init_accounts coroutine started
2026-10-03 00:30:29,219 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 00:30:29,226 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:35:51,239 INFO core: Event loop thread started, running loop forever
2026-10-03 00:35:51,540 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 00:35:51,546 INFO core: _init_accounts coroutine started
2026-10-03 00:35:51,546 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 00:35:51,559 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:40:48,389 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 00:40:48,390 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 00:40:48,395 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:45:48,601 INFO core: Event loop thread started, running loop forever
2026-10-03 00:45:48,902 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 00:45:48,909 INFO core: _init_accounts coroutine started
2026-10-03 00:45:48,909 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 00:45:48,912 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:50:36,211 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 00:50:36,212 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 00:50:36,213 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 00:55:52,919 INFO core: Event loop thread started, running loop forever
2026-10-03 00:55:53,221 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 00:55:53,224 INFO core: _init_accounts coroutine started
2026-10-03 00:55:53,225 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 00:55:53,233 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:00:39,787 INFO core: Event loop thread started, running loop forever
2026-10-03 01:00:40,088 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 01:00:40,093 INFO core: _init_accounts coroutine started
2026-10-03 01:00:40,094 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 01:00:40,101 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:01:00,803 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 01:05:23,493 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:10:44,773 INFO core: Event loop thread started, running loop forever
2026-10-03 01:10:45,074 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 01:10:45,077 INFO core: _init_accounts coroutine started
2026-10-03 01:10:45,079 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 01:10:45,084 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:15:31,795 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:20:37,297 INFO core: Event loop thread started, running loop forever
2026-10-03 01:20:37,598 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 01:20:37,602 INFO core: _init_accounts coroutine started
2026-10-03 01:20:37,605 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 01:20:37,612 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:25:15,162 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 01:25:15,184 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:30:13,787 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:35:38,325 INFO core: Event loop thread started, running loop forever
2026-10-03 01:35:38,627 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 01:35:38,636 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:35:38,637 INFO core: _init_accounts coroutine started
2026-10-03 01:35:38,638 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 01:40:35,497 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:45:32,127 INFO core: Event loop thread started, running loop forever
2026-10-03 01:45:32,428 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 01:45:32,432 INFO core: _init_accounts coroutine started
2026-10-03 01:45:32,434 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 01:45:32,442 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:45:41,141 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 01:50:38,383 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 01:50:43,025 INFO core: Event loop thread started, running loop forever
2026-10-03 01:50:43,326 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 01:50:43,330 INFO core: _init_accounts coroutine started
2026-10-03 01:50:43,331 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 01:50:43,337 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 01:55:05,281 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 01:55:05,294 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:00:15,069 INFO core: Event loop thread started, running loop forever
2026-10-03 02:00:15,370 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:00:15,376 INFO core: _init_accounts coroutine started
2026-10-03 02:00:15,377 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:00:15,385 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:05:18,096 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 02:05:18,097 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 02:05:18,097 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:10:48,002 INFO core: Event loop thread started, running loop forever
2026-10-03 02:10:48,303 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:10:48,309 INFO core: _init_accounts coroutine started
2026-10-03 02:10:48,310 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:10:48,317 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:15:04,539 INFO core: Event loop thread started, running loop forever
2026-10-03 02:15:04,840 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:15:04,847 INFO core: _init_accounts coroutine started
2026-10-03 02:15:04,847 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:15:04,861 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:15:54,599 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 02:20:30,595 INFO core: Event loop thread started, running loop forever
2026-10-03 02:20:30,896 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:20:30,901 INFO core: _init_accounts coroutine started
2026-10-03 02:20:30,903 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:20:30,909 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:25:27,841 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:25:27,842 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 02:25:27,842 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 02:30:42,482 INFO core: Event loop thread started, running loop forever
2026-10-03 02:30:42,783 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:30:42,787 INFO core: _init_accounts coroutine started
2026-10-03 02:30:42,788 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:30:42,792 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:35:50,970 INFO core: Event loop thread started, running loop forever
2026-10-03 02:35:51,272 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:35:51,275 INFO core: _init_accounts coroutine started
2026-10-03 02:35:51,276 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:35:51,283 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:40:13,716 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 02:40:13,719 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 02:40:13,720 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:45:20,352 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 02:45:20,352 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-03 02:45:20,353 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 02:45:20,353 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-03 02:45:20,353 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 02:45:20,353 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 02:45:22,405 INFO core: Event loop thread started, running loop forever
2026-10-03 02:45:22,709 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:45:22,712 INFO core: _init_accounts coroutine started
2026-10-03 02:45:22,715 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:45:22,721 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:50:29,375 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 02:50:34,708 INFO core: Event loop thread started, running loop forever
2026-10-03 02:50:35,009 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:50:35,015 INFO core: _init_accounts coroutine started
2026-10-03 02:50:35,015 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:50:35,021 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 02:55:48,613 INFO core: Event loop thread started, running loop forever
2026-10-03 02:55:48,914 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 02:55:48,919 INFO core: _init_accounts coroutine started
2026-10-03 02:55:48,919 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 02:55:48,925 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:00:20,434 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:05:25,770 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 03:05:25,770 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 03:05:25,773 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 03:05:25,775 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 03:05:25,791 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:10:31,409 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 03:10:31,410 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 03:10:31,410 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 03:10:39,915 INFO core: Event loop thread started, running loop forever
2026-10-03 03:10:40,216 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 03:10:40,220 INFO core: _init_accounts coroutine started
2026-10-03 03:10:40,220 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 03:10:40,233 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:15:37,032 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 03:15:37,033 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:15:37,033 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 03:15:37,035 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 03:15:37,036 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 03:20:40,602 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:25:20,739 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 03:25:20,740 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 03:25:20,740 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:30:04,167 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-03 03:30:04,172 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-03 03:30:04,182 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:35:11,345 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-03 03:35:18,973 INFO core: Event loop thread started, running loop forever
2026-10-03 03:35:19,274 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 03:35:19,283 INFO core: _init_accounts coroutine started
2026-10-03 03:35:19,283 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 03:35:19,289 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:40:25,435 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 03:40:33,320 INFO core: Event loop thread started, running loop forever
2026-10-03 03:40:33,621 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 03:40:33,626 INFO core: _init_accounts coroutine started
2026-10-03 03:40:33,627 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 03:40:33,633 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:45:50,342 INFO core: Event loop thread started, running loop forever
2026-10-03 03:45:50,643 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 03:45:50,651 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:50:36,726 INFO core: _init_accounts coroutine started
2026-10-03 03:50:36,728 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 03:50:36,733 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 03:55:21,716 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 03:55:21,726 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:00:07,508 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:05:25,753 INFO core: Event loop thread started, running loop forever
2026-10-03 04:05:26,055 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 04:05:26,061 INFO core: _init_accounts coroutine started
2026-10-03 04:05:26,062 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 04:05:26,073 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:10:27,247 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:15:34,418 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 04:15:34,420 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 04:15:40,232 INFO core: Event loop thread started, running loop forever
2026-10-03 04:15:40,533 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 04:15:40,539 INFO core: _init_accounts coroutine started
2026-10-03 04:15:40,540 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 04:15:40,545 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:20:19,653 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 04:20:19,653 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 04:20:19,658 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 04:20:19,663 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 04:20:19,667 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:25:20,524 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:30:27,357 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 04:30:27,357 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 04:30:27,357 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 04:30:35,860 INFO core: Event loop thread started, running loop forever
2026-10-03 04:30:36,161 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 04:30:36,165 INFO core: _init_accounts coroutine started
2026-10-03 04:30:36,166 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 04:30:36,174 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:35:43,561 INFO core: Event loop thread started, running loop forever
2026-10-03 04:35:43,862 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 04:35:43,865 INFO core: _init_accounts coroutine started
2026-10-03 04:35:43,867 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 04:35:43,874 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:40:09,019 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:45:03,374 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 04:45:03,378 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 04:45:03,421 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 04:45:03,421 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-03 04:45:03,422 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 04:45:03,422 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-03 04:45:03,422 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 04:45:03,423 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 04:45:35,935 INFO core: Event loop thread started, running loop forever
2026-10-03 04:45:36,236 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 04:45:36,240 INFO core: _init_accounts coroutine started
2026-10-03 04:45:36,241 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 04:45:36,245 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:50:05,246 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 04:50:05,247 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 04:50:05,250 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 04:50:05,252 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 04:50:05,256 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 04:55:07,823 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:00:07,169 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:05:13,400 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 05:05:16,696 INFO core: Event loop thread started, running loop forever
2026-10-03 05:05:16,997 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 05:05:17,001 INFO core: _init_accounts coroutine started
2026-10-03 05:05:17,002 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 05:05:17,010 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:10:03,860 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:15:10,395 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 05:15:10,396 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 05:15:10,396 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-03 05:15:10,397 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 05:15:10,397 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-03 05:15:10,397 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 05:15:10,397 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-03 05:15:10,397 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 05:15:10,397 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 05:15:45,000 INFO core: Event loop thread started, running loop forever
2026-10-03 05:15:45,301 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 05:15:45,305 INFO core: _init_accounts coroutine started
2026-10-03 05:15:45,306 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 05:15:45,316 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:20:04,792 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 05:20:04,807 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:25:17,056 INFO core: Event loop thread started, running loop forever
2026-10-03 05:25:17,357 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 05:25:17,365 INFO core: _init_accounts coroutine started
2026-10-03 05:25:17,365 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 05:25:17,367 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:30:23,497 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 05:30:52,177 INFO core: Event loop thread started, running loop forever
2026-10-03 05:30:52,481 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 05:30:52,489 INFO core: _init_accounts coroutine started
2026-10-03 05:30:52,490 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 05:30:52,493 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:35:37,285 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 05:35:37,286 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:35:37,287 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 05:40:09,127 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 05:40:09,132 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 05:40:09,144 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:45:16,402 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 05:45:47,416 INFO core: Event loop thread started, running loop forever
2026-10-03 05:45:47,717 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 05:45:47,721 INFO core: _init_accounts coroutine started
2026-10-03 05:45:47,724 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 05:45:47,734 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:50:05,860 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 05:50:05,861 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 05:50:05,892 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 05:50:05,895 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 05:50:05,920 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 05:50:05,921 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 05:50:05,936 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-03 05:50:05,937 INFO telethon.network.mtprotosender: Connecting to 91.108.56.178:443/TcpAbridged...
2026-10-03 05:50:05,941 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 05:55:11,420 WARNING telethon.network.mtprotosender: Attempt 1 at connecting failed: TimeoutError: 
2026-10-03 05:55:11,422 WARNING core: Account 2: connect timed out after 35s
2026-10-03 05:55:11,423 INFO telethon.network.mtprotosender: Disconnecting from 91.108.56.178:443/TcpAbridged...
2026-10-03 05:55:11,427 INFO telethon.network.mtprotosender: Disconnection from 91.108.56.178:443/TcpAbridged complete!
2026-10-03 05:55:51,723 INFO core: Event loop thread started, running loop forever
2026-10-03 05:55:52,026 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 05:55:52,054 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:00:25,231 INFO core: _init_accounts coroutine started
2026-10-03 06:00:25,233 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 06:00:25,239 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:05:50,084 INFO core: Event loop thread started, running loop forever
2026-10-03 06:05:50,389 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 06:05:50,395 INFO core: _init_accounts coroutine started
2026-10-03 06:05:50,396 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 06:05:50,408 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:10:38,454 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:15:25,110 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 06:15:25,112 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 06:15:25,116 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:20:32,368 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 06:20:37,468 INFO core: Event loop thread started, running loop forever
2026-10-03 06:20:37,770 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 06:20:37,773 INFO core: _init_accounts coroutine started
2026-10-03 06:20:37,776 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 06:20:37,791 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:25:11,493 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:30:17,405 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 06:30:35,164 INFO core: Event loop thread started, running loop forever
2026-10-03 06:30:35,468 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 06:30:35,473 INFO core: _init_accounts coroutine started
2026-10-03 06:30:35,475 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 06:30:35,496 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:35:39,848 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:40:32,832 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 06:40:32,833 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 06:40:32,837 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 06:40:32,838 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:45:23,220 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 06:45:23,230 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:50:11,161 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:55:10,233 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 06:55:10,235 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 07:00:02,388 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 07:00:02,420 INFO core: Account 2: connecting to Telegram via 91.108.56.178...
2026-10-03 07:00:54,111 INFO core: Event loop thread started, running loop forever
2026-10-03 07:00:54,413 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 07:00:54,418 INFO core: _init_accounts coroutine started
2026-10-03 07:00:54,419 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 07:00:54,423 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:05:06,145 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:10:13,402 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 07:10:13,403 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 07:10:13,403 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-03 07:10:13,404 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 07:10:13,404 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-03 07:10:13,404 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 07:10:13,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-03 07:10:13,404 INFO core: _init_accounts_inner: schema/LLM steps complete
2026-10-03 07:10:13,404 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 180, in _init_accounts_inner
    await self._start_account_client(acct["id"])
  File "/home/wovewbge/quill.nx.kg/core.py", line 236, in _start_account_client
    session_str = await self._run_db(self.db.get_account_session, account_id)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 07:10:34,495 INFO core: Event loop thread started, running loop forever
2026-10-03 07:10:34,797 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 07:10:34,801 INFO core: _init_accounts coroutine started
2026-10-03 07:10:34,802 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 07:10:34,808 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:15:12,779 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:20:18,472 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 07:20:41,931 INFO core: Event loop thread started, running loop forever
2026-10-03 07:20:42,232 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 07:20:42,236 INFO core: _init_accounts coroutine started
2026-10-03 07:20:42,238 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 07:20:42,248 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:25:35,683 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:25:35,684 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 07:30:35,586 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:35:39,747 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:40:49,834 INFO core: Event loop thread started, running loop forever
2026-10-03 07:40:50,135 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 07:40:50,140 INFO core: _init_accounts coroutine started
2026-10-03 07:40:50,142 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 07:40:50,150 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:45:39,494 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 07:45:39,496 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 07:45:39,497 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 07:45:39,499 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:45:39,500 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 07:50:53,732 INFO core: Event loop thread started, running loop forever
2026-10-03 07:50:54,034 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 07:50:54,039 INFO core: _init_accounts coroutine started
2026-10-03 07:50:54,039 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 07:50:54,047 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 07:55:25,168 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 07:55:25,168 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 07:55:25,201 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 07:55:25,209 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:00:40,148 INFO core: Event loop thread started, running loop forever
2026-10-03 08:00:40,449 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 08:00:40,456 INFO core: _init_accounts coroutine started
2026-10-03 08:00:40,456 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 08:00:40,461 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:05:47,414 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 149, in _init_accounts_inner
    await self._run_db(self.db.migrate_legacy_session)
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 08:05:49,969 INFO core: Event loop thread started, running loop forever
2026-10-03 08:05:50,270 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 08:05:50,275 INFO core: _init_accounts coroutine started
2026-10-03 08:05:50,276 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 08:05:50,291 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:10:06,121 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 08:10:06,121 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 08:10:06,124 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 08:10:06,126 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 08:10:06,130 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:15:13,390 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 08:15:37,967 INFO core: Event loop thread started, running loop forever
2026-10-03 08:15:38,268 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 08:15:38,283 INFO core: _init_accounts coroutine started
2026-10-03 08:15:38,283 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 08:15:38,284 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:20:09,514 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:25:15,251 INFO core: Event loop thread started, running loop forever
2026-10-03 08:25:15,552 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 08:25:15,556 INFO core: _init_accounts coroutine started
2026-10-03 08:25:15,558 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 08:25:15,568 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:30:08,332 ERROR core: _init_accounts failed: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
Traceback (most recent call last):
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 834, in _write_bytes
    self._sock.sendall(data)
    ~~~~~~~~~~~~~~~~~~^^^^^^
ConnectionResetError: [Errno 104] Connection reset by peer

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/wovewbge/quill.nx.kg/db.py", line 87, in acquire_core_lock
    conn = _create_connection()
  File "/home/wovewbge/quill.nx.kg/db.py", line 15, in _create_connection
    return pymysql.connect(
           ~~~~~~~~~~~~~~~^
        host=config.MYSQL_HOST,
        ^^^^^^^^^^^^^^^^^^^^^^^
    ...<13 lines>...
        connect_timeout=5,
        ^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 372, in __init__
    self.connect()
    ~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 702, in connect
    self._request_authentication()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 999, in _request_authentication
    self.write_packet(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 760, in write_packet
    self._write_bytes(data)
    ~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/wovewbge/virtualenv/quill.nx.kg/3.13/lib/python3.13/site-packages/pymysql/connections.py", line 837, in _write_bytes
    raise err.OperationalError(
        CR.CR_SERVER_GONE_ERROR, f"MySQL server has gone away ({e!r})"
    )
pymysql.err.OperationalError: (2006, "MySQL server has gone away (ConnectionResetError(104, 'Connection reset by peer'))")
2026-10-03 08:30:08,363 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:35:26,713 INFO core: Event loop thread started, running loop forever
2026-10-03 08:35:27,014 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 08:35:27,039 INFO core: _init_accounts coroutine started
2026-10-03 08:35:27,039 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 08:35:27,040 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:40:33,407 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 08:40:43,434 INFO core: Event loop thread started, running loop forever
2026-10-03 08:40:43,735 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 08:40:43,745 INFO core: _init_accounts coroutine started
2026-10-03 08:40:43,746 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 08:40:43,751 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:45:42,946 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:50:21,957 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 08:50:21,958 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 08:50:21,960 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 08:55:17,229 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 08:55:17,238 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:00:22,147 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 09:00:22,155 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:05:40,046 INFO core: Event loop thread started, running loop forever
2026-10-03 09:05:40,347 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 09:05:40,360 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:10:33,422 INFO core: _init_accounts coroutine started
2026-10-03 09:10:33,423 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 09:10:33,432 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:15:03,430 ERROR core: _init_accounts failed: cannot schedule new futures after shutdown
Traceback (most recent call last):
  File "/home/wovewbge/quill.nx.kg/core.py", line 114, in _init_accounts
    await self._init_accounts_inner()
  File "/home/wovewbge/quill.nx.kg/core.py", line 141, in _init_accounts_inner
    self._lock_conn = await self._run_db(self.db.acquire_core_lock)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/wovewbge/quill.nx.kg/core.py", line 96, in _run_db
    return await self.loop.run_in_executor(self._executor, func, *args)
                 ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/asyncio/base_events.py", line 902, in run_in_executor
    executor.submit(func, *args), loop=self)
    ~~~~~~~~~~~~~~~^^^^^^^^^^^^^
  File "/opt/alt/python313/lib64/python3.13/concurrent/futures/thread.py", line 171, in submit
    raise RuntimeError('cannot schedule new futures after shutdown')
RuntimeError: cannot schedule new futures after shutdown
2026-10-03 09:15:27,475 INFO core: Event loop thread started, running loop forever
2026-10-03 09:15:27,786 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 09:15:27,793 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:20:13,467 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:25:14,507 INFO core: _init_accounts coroutine started
2026-10-03 09:25:14,511 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 09:25:14,517 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:30:10,880 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:35:16,401 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 09:35:16,401 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 09:35:16,402 WARNING core: ensure_llm_schema failed: cannot schedule new futures after shutdown
2026-10-03 09:35:16,403 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 09:35:16,404 WARNING core: ensure_pair_schema failed: cannot schedule new futures after shutdown
2026-10-03 09:35:16,404 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 09:35:16,404 WARNING core: LLM config load failed: cannot schedule new futures after shutdown
2026-10-03 09:35:42,508 INFO core: Event loop thread started, running loop forever
2026-10-03 09:35:42,816 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 09:35:42,821 INFO core: _init_accounts coroutine started
2026-10-03 09:35:42,822 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 09:35:42,828 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:40:13,854 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:45:19,340 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 09:45:28,783 INFO core: Event loop thread started, running loop forever
2026-10-03 09:45:29,085 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 09:45:29,089 INFO core: _init_accounts coroutine started
2026-10-03 09:45:29,091 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 09:45:29,098 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:50:18,894 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 09:55:16,888 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:00:23,422 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 10:00:23,422 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 10:00:23,429 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 10:00:39,945 INFO core: Event loop thread started, running loop forever
2026-10-03 10:00:40,246 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 10:00:40,249 INFO core: _init_accounts coroutine started
2026-10-03 10:00:40,250 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 10:00:40,260 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:05:23,163 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 10:05:23,164 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 10:05:23,166 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 10:05:23,169 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 10:05:23,170 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:10:30,430 INFO core: LLM engine: {'enabled': False, 'provider': 'openai-compatible', 'model': 'zai-glm-4.7', 'base_url': 'https://api.cerebras.ai/v1', 'api_key_set': True, 'client_available': True, 'available': False, 'min_confidence': 0.8, 'webhook_url_set': False, 'timeout': 12.0, 'max_tokens': 512}
2026-10-03 10:10:50,836 INFO core: Event loop thread started, running loop forever
2026-10-03 10:10:51,137 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 10:10:51,142 INFO core: _init_accounts coroutine started
2026-10-03 10:10:51,142 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 10:10:51,148 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:15:52,140 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:20:36,345 INFO core: _init_accounts_inner: migrate_legacy_session done
2026-10-03 10:20:36,345 INFO core: _init_accounts_inner: running ensure_llm_schema
2026-10-03 10:20:36,348 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:25:36,336 INFO core: _init_accounts_inner: running ensure_pair_schema
2026-10-03 10:25:36,339 INFO core: _init_accounts_inner: reloading LLM config
2026-10-03 10:25:36,353 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:30:47,156 INFO core: Event loop thread started, running loop forever
2026-10-03 10:30:47,457 INFO core: Scheduling _init_accounts on event loop (alive=True)
2026-10-03 10:30:47,461 INFO core: _init_accounts coroutine started
2026-10-03 10:30:47,463 INFO core: _init_accounts_inner: starting DB migrations
2026-10-03 10:30:47,468 INFO core: status() clients=0 connected=False forwarding=False
2026-10-03 10:33:56,368 INFO core: status() clients=0 connected=False forwarding=False
